Jump to content

Recommended Posts

Hello everyone!

 

Recently, whilst developing a map, I've run into some issues. I've worked now for several hours on this same set of scripts attempting to make them work, and looking at other scripts for reference, but to no avail. I've come to ask for help.

Essentially, I have precisely eight weapons in a mission that I am creating, and I want to make a sign with an addAction that allows the player to buy ammo for him / her and all other players currently in-game. My original plan was to create one large script, however this did not work well, so I divided it into nine different scripts. I know, I know, those of you who are very good at scripting will be very annoyed by this, but that's where the learning comes in, right? :wink: (Yes, by the way, I AM using mods, so some of the configs are modded).

 

Script 1 - called when the addAction is activated.

 

{
{
if (money < 500) exitWith {hint "Sorry, your team does not have enough money for that!"};
};
else
{
{execVM "ammorefill1.sqf", execVM "ammorefill2.sqf", execVM "ammorefill.sqf", execVM "ammorefill4.sqf", execVM "ammorefill5.sqf", execVM "ammorefill6.sqf", execVM "ammorefill7.sqf", execVM "ammorefill8.sqf"};
sleep 1;
{hint "Eligable for a restock! Restock Bought."};
sleep 3;
 
{hint format ["A Team Member has spent $500 dollars on an ammo refill, and your team now has $%1 dollars left!", TL_killCount]};
};
};

 

Those eight scripts that are called are here, listed as follows:

{
if (player1 hasWeapon "SMG_02_F") then {allPlayers addMagazines ["30Rnd_9x21_Mag_SMG_02", 5], _cost = 2};
};

{
if (player1 hasWeapon "arifle_AKS_F") then {allPlayers addMagazines ["30Rnd_545x39_Mag_F", 5], _cost = 2};
};

{
if (player1 hasWeapon "rhs_weap_m4") then {allPlayers addMagazines ["30Rnd_556x45_Stanag", 5], _cost = 2};
};

{
if (player1 hasWeapon "SMA_ACRMOE") then {allPlayers addMagazines ["30Rnd_556x45_Stanag", 5], _cost = 2};
};

{
if (player1 hasWeapon "rhs_weap_sr25_d") then {allPlayers addMagazines ["20Rnd_762x51_Mag", 5], _cost = 2};
};

{
if (player1 hasWeapon "rhs_weap_M590_8RD") then {allPlayers addMagazines ["rhsusf_8Rnd_00Buck", 5], _cost = 2};
};

{
if (player1 hasWeapon "LMG_Zafir_F") then {allPlayers addMagazines ["150Rnd_762x54_Box", 5], _cost = 2};
};

{
if (player1 hasWeapon "rhs_weap_m24sws_ghillie") then {allPlayers addMagazines ["30Rnd_9x21_Mag_SMG_02", 10], _cost = 2};
};

Each of those lines is in a different script. The eight scripts, however, are not the problem yet. The first script will not go through as it states that it is missing a Semicolon. If anyone could help me with this problem I would really appreciate it.

 

Thanks for your time,

 

~Nic

Share this post


Link to post
Share on other sites

//should be ok now 

//you should pass the payer by variable or value to the second script

{

{

if (money < 500) exitWith {hint "Sorry, your team does not have enough money for that!"};

}

else

{

{execVM "ammorefill1.sqf"; execVM "ammorefill2.sqf"; execVM "ammorefill.sqf"; execVM "ammorefill4.sqf"; execVM "ammorefill5.sqf"; execVM "ammorefill6.sqf"; execVM "ammorefill7.sqf"; execVM "ammorefill8.sqf"};

sleep 1;

{hint "Eligable for a restock! Restock Bought."};

sleep 3;

{hint format ["A Team Member has spent $500 dollars on an ammo refill, and your team now has $%1 dollars left!", TL_killCount]};

};

};

 

////////////////////////////////////////////

 

{

if (player1 hasWeapon "SMG_02_F") then {allPlayers addMagazines ["30Rnd_9x21_Mag_SMG_02", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "arifle_AKS_F") then {allPlayers addMagazines ["30Rnd_545x39_Mag_F", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "rhs_weap_m4") then {allPlayers addMagazines ["30Rnd_556x45_Stanag", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "SMA_ACRMOE") then {allPlayers addMagazines ["30Rnd_556x45_Stanag", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "rhs_weap_sr25_d") then {allPlayers addMagazines ["20Rnd_762x51_Mag", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "rhs_weap_M590_8RD") then {allPlayers addMagazines ["rhsusf_8Rnd_00Buck", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "LMG_Zafir_F") then {allPlayers addMagazines ["150Rnd_762x54_Box", 5]; _cost = 2};

};

 

{

if (player1 hasWeapon "rhs_weap_m24sws_ghillie") then {allPlayers addMagazines ["30Rnd_9x21_Mag_SMG_02", 10]; _cost = 2};

};

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×