Jump to content
Sign in to follow this  
celery

Unlimited ammo script

Recommended Posts

I made this little script for one of my deathmatch maps and I thought why not share it with whomever needs it as well. In addition to unlimited ammo, it gives your gun an unbelievable rate of fire. I didn't test it on vehicles, only humans.

Here it is, just remember to execute it at some point! wink_o.gif

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start

@alive player

~0.1

_playergun=primaryweapon player

player setvehicleammo 1

_ammo=(player ammo _playergun)

#check

?!alive player:goto "start"

?_playergun!=primaryweapon player:goto "start"

player setvehicleammo (1/_ammo)

~0.01

goto "check"

If you want a normal rate of fire, change (1/_ammo) to just 1.

Share this post


Link to post
Share on other sites

Sorry to steal your show Celery but I've improved on your ammo script - your version has some limits. It now works with every weapon on every vehicle. I have also translated it into .SQF:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

for [{_loop1=0},{_loop1>=0},{_loop1=_loop1}] do

{

   waitUntil {alive player};

   _muzzles = [];

   _weapons = weapons (vehicle player);

   _ammo = 10000;

   for [{_x=0},{_x<(count _weapons)},{_x=_x+1}] do

   {

       _weaponMuzzles = getArray (configFile >> "CfgWeapons" >> (_weapons select _x) >> "muzzles");

       if ((_weaponMuzzles select 0)=="this") then

       {

           _muzzles = _muzzles + [_weapons select _x];

       }

       else

       {

           _muzzles = _muzzles + _weaponMuzzles;

       };

   };

   (vehicle player) setvehicleammo 1;

   for [{_x=0},{_x<(count _muzzles)},{_x=_x+1}] do

   {

       _mxammo = ((vehicle player) ammo (_muzzles select _x));

       if (_mxammo<_ammo && _mxammo>0) then

       {

           _ammo=((vehicle player) ammo (_muzzles select _x));

       };

   };

   for [{_loop2=0},{_loop2>=0},{_loop2=_loop2}] do

   {

       if (_ammo>0) then {(vehicle player) setvehicleammo (1/_ammo);};

       sleep 0.01;

       if (!(alive player) || ((_weapons select 0)!=(weapons (vehicle player) select 0))) then {_loop2=-1;};

   };

};

Dare I say "pwnd".... no hard feelings. biggrin_o.gif

Share this post


Link to post
Share on other sites

Well that's the last time for me posting any scripts here if all people are gonna do is improve them!!!1 mad_o.gif

Share this post


Link to post
Share on other sites
Well that's the last time for me posting any scripts here if all people are gonna do is improve them!!!1  mad_o.gif

Is that supposed to be sarcasm or are you serious?

I didn't mean to offend you or anything, I just corrected a bug and added some functionality. I'm a compulsive scripter - I really can't help myself wink_o.gif .

Share this post


Link to post
Share on other sites
Well that's the last time for me posting any scripts here if all people are gonna do is improve them!!!1  mad_o.gif

Seriously? OMG confused_o.gif

Anyway, not taking that too seriously tounge2.gif

MadDogX, how do you paste code into a code snippet and keep prevailing identing spaces? I'm always getting those removed.

Share this post


Link to post
Share on other sites
(...)

MadDogX, how do you paste code into a code snippet and keep prevailing identing spaces? I'm always getting those removed.

I got that too, but only when using tabs. If you replace tabs with spaces they will not be removed.

Share this post


Link to post
Share on other sites
Well that's the last time for me posting any scripts here if all people are gonna do is improve them!!!1 mad_o.gif

You should be thanking him. If someone made a 2D nuke script, and someone improved it to 3D.. You sit there, fold your arms, and pout.

Thankx both of you. biggrin_o.gif

Share this post


Link to post
Share on other sites

Just because I'm feeling so generous, here is another script I wrote for the people posting here:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

_post = position player nearestObject "Post"

?getSarcasm _post > 0:hint "Just kidding!!!";playmusic "yaketysax"

~0.01

goto "loop"

It's very simple to use, I suggest people use it! smile_o.gif

P.S. Could someone convert it to SQF or even improve it for the SQS disabled ones?

Share this post


Link to post
Share on other sites
Guest
Just because I'm feeling so generous, here is another script I wrote for the people posting here:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

_post = position player nearestObject "Post"

?getSarcasm _post > 0:hint "Just kidding!!!";playmusic "yaketysax"

~0.01

goto "loop"

It's very simple to use, I suggest people use it!  smile_o.gif

P.S. Could someone convert it to SQF or even improve it for the SQS disabled ones?

I recieve an error, it cant find the music.

WTF am I doing wrong?

Share this post


Link to post
Share on other sites

Lol, awesome reply biggrin_o.gif

But I was hoping so. However, there will always be someone with thoughts like that.

Share this post


Link to post
Share on other sites
Sorry to steal your show Celery but I've improved on your ammo script - your version has some limits. It now works with every weapon on every vehicle. I have also translated it into .SQF:

Sorry for this little off topic but I see a lot of sqs file which

are translated in a sqf file.

Is there someone who can explain me why?

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  

×