BradModzV1Official
New Member
- Messages
- 1
- Reaction score
- 0
- Points
- 1
hi guys im currently making a new bo2 gsc menu im trying to make an unlimited ammo function where i can turn it off it would be helpfull if someone could sort me out with a script
InfiniteAmmo()
{
self endon("disconnect");
self endon("disableInfAmmo");
self.InfiniteAmmo = booleanOpposite(self.InfiniteAmmo);
self iPrintln(booleanReturnVal(self.InfiniteAmmo, "Infinite Ammo: [^1OFF^7]", "Infinite Ammo: [^2ON^7]"));
if (self.InfiniteAmmo)
{
for(;;)
{
if (self getCurrentWeapon() != "none")
{
self setWeaponAmmoClip(self getCurrentWeapon(), weaponClipSize(self getCurrentWeapon()));
self giveMaxAmmo(self getCurrentWeapon());
}
if (self getCurrentOffHand() != "none")
self giveMaxAmmo(self getCurrentOffHand());
wait 0.05;
}
}
else
self notify("disableInfAmmo");
}
Not bad. But it still glitches your killstreaks. Loz's code that he released is much shorter and prevents killstreaks from glitching.-snip-
isKillstreakWeapon(which)
{
keys = getArrayKeys(level.killstreaks);
for(i = 0; i < keys.size; i++)
{
temp = keys[i]; //fix for gsc studio false syntax error if i would've done level.killstreaks[keys[i]]
if(which == level.killstreaks[temp].weapon)
return true;
}
return false;
}
toggleInfAmmo()
{
self endon("disconnect");
if(!isDefined(self.infAmmo))
{
self.infAmmo = true;
self thread infAmmo();
self iPrintln("Infinite Ammo: [^2ON^7]");
}
else
{
self.infAmmo = undefined;
self iPrintln("Infinite Ammo: [^1OFF^7]");
}
}
infAmmo()
{
self endon("disconnect");
while(isDefined(self.infAmmo))
{
gun = self getCurrentWeapon();
off = self getCurrentOffHand();
if(gun != "none" && !isKillstreakWeapon(gun))
{
self setWeaponAmmoClip(gun, weaponClipSize(gun));
self giveMaxAmmo(gun);
}
if(off != "none")
self giveMaxAmmo(off);
wait .05;
}
}