Jump to content
Sign in to follow this  
bigshotking

Ammo Box script not working

Recommended Posts

while {alive _this} do
{

clearMagazineCargo _this;
clearWeaponCargo _this;

// LMG ammo
_this addMagazineCargo ["100Rnd_556x45_BetaCMag", 50];
_this addMagazineCargo ["100Rnd_762x51_M240", 50];
_this addMagazineCargo ["200Rnd_556x45_M249", 50];
_this addMagazineCargo ["ACE_200Rnd_556x45_T_M249", 50];
_this addMagazineCargo ["ACE_100Rnd_556x45_T_M249", 50];

// Sniper Rifle ammo
_this addMagazineCargo ["20Rnd_762x51_DMR", 50];
_this addMagazineCargo ["ACE_20Rnd_762x51_T_DMR", 50];
_this addMagazineCargo ["10Rnd_127x99_m107", 50];
_this addMagazineCargo ["ACE_10Rnd_127x99_T_m107", 50];
_this addMagazineCargo ["5Rnd_762x51_M24", 50];
_this addMagazineCargo ["ACE_5Rnd_762x51_T_M24", 50];
_this addMagazineCargo ["ACE_5Rnd_127x99_T_TAC50", 50];
_this addMagazineCargo ["ACE_5Rnd_127x99_S_TAC50", 50];

// MBR ammo
_this addMagazineCargo ["20Rnd_556x45_Stanag", 50];
_this addMagazineCargo ["30Rnd_556x45_G36", 50];
_this addMagazineCargo ["30Rnd_556x45_G36SD", 50];
_this addMagazineCargo ["ACE_30Rnd_556x45_T_G36", 50];
_this addMagazineCargo ["30Rnd_556x45_Stanag", 50];
_this addMagazineCargo ["30Rnd_556x45_StanagSD", 50];
_this addMagazineCargo ["ACE_30Rnd_556x45_T_Stanag", 50];
_this addMagazineCargo ["8Rnd_B_Beneli_74Slug", 50]; // Combat shotgun
_this addMagazineCargo ["8Rnd_B_Beneli_Pellets", 50]; // Combat shotgun
_this addMagazineCargo ["20Rnd_762x51_B_SCAR", 50];
_this addMagazineCargo ["20Rnd_762x51_SB_SCAR", 50];
_this addMagazineCargo ["ACE_20Rnd_762x51_T_SCAR", 50];
_this addMagazineCargo ["6Rnd_HE_M203", 50];

// SMG ammo
_this addMagazineCargo ["30Rnd_9x19_MP5", 50];
_this addMagazineCargo ["30Rnd_9x19_MP5SD", 50];
_this addMagazineCargo ["ACE_25Rnd_1143x23_S_UMP45", 50];
_this addMagazineCargo ["ACE_25Rnd_1143x23_B_UMP45", 50];

// Pistol ammo
_this addMagazineCargo ["15Rnd_9x19_M9", 50];
_this addMagazineCargo ["15Rnd_9x19_M9SD", 50];
_this addMagazineCargo ["7Rnd_45ACP_1911", 50];
_this addMagazineCargo ["ACE_12Rnd_45ACP_USP", 50];
_this addMagazineCargo ["ACE_12Rnd_45ACP_USPSD", 50];
_this addMagazineCargo ["ACE_15Rnd_9x19_P8", 50];
_this addMagazineCargo ["ACE_15Rnd_9x19_P226", 50];
_this addMagazineCargo ["7Rnd_45ACP_1911", 50];
_this addMagazineCargo ["ACE_33Rnd_9x19_G18", 50];
_this addMagazineCargo ["17Rnd_9x19_glock17", 50];
_this addMagazineCargo ["6Rnd_45ACP", 50];
_this addMagazineCargo ["ACE_SSYellow_FG", 50];
_this addMagazineCargo ["ACE_SSWhite_FG", 50];
_this addMagazineCargo ["ACE_SSRed_FG", 50];
_this addMagazineCargo ["ACE_SSGreen_FG", 50];

// M203 ammo
_this addMagazineCargo ["1Rnd_HE_M203", 50];
_this addMagazineCargo ["1Rnd_Smoke_M203", 50];
_this addMagazineCargo ["1Rnd_SmokeGreen_M203", 50];
_this addMagazineCargo ["1Rnd_SmokeRed_M203", 50];
_this addMagazineCargo ["1Rnd_SmokeYellow_M203", 50];
_this addMagazineCargo ["FlareGreen_M203", 50];
_this addMagazineCargo ["FlareRed_M203", 50];
_this addMagazineCargo ["FlareWhite_M203", 50];
_this addMagazineCargo ["FlareYellow_M203", 50];

// AT & AA ammo
_this addMagazineCargo ["Javelin", 50];	
_this addWeaponCargo ["ACE_Javelin_CLU", 50];
_this addMagazineCargo ["SMAW_HEAA", 50];
_this addMagazineCargo ["SMAW_HEDP", 50];
_this addMagazineCargo ["Stinger", 50];
_this addMagazineCargo ["NLAW", 50];
_this addMagazineCargo ["MAAWS_HEAT", 50];
_this addMagazineCargo ["MAAWS_HEDP", 50];

sleep 2400;
};

That is the script I'm using to empty a vehicle ammo box and fill full of this stuff...

I put this in the ammo box's init:

null = execVM "scripts\ammoammo.sqf";

But when I go in the box it still has the stock ammo the box comes with..

Any ideas whats wrong?

Thanks in advance!

-Bigshot

Share this post


Link to post
Share on other sites

I suppose, the box is meant to refill itself every 2400 seconds?

Give the box a name (eg. box1).

Use this script:

#start
_box = _this select 0;
if (!(isServer) or !(alive _box)) then { exit };

clearMagazineCargo[color="Red"]Global[/color] _box;
clearWeaponCargo[color="Red"]Global[/color] _box;

_box addMagazineCargo[color="Red"]Global[/color] ["100Rnd_556x45_BetaCMag", 50];
...

~2400
goto "start";

Put into the init-line of the box or into the file init.sqf or wherever:

[box1] exec "file.sqf";

The -global commands make it also multiplayer compatible.

Edited by RogueTrooper

Share this post


Link to post
Share on other sites

Don't use [box1] as that'll pass _this as an array so it'll need to be _this select 0 for the box. If you just use box execVM then _this (within the script) will be the same as box1 and not an array.

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
Sign in to follow this  

×