Ammo cap - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Ammo cap (
/showthread.php?tid=567501)
Ammo cap -
Hybris - 14.03.2015
How do I make it so that when a player has over 200 ammo in his guns he gets banned for ammo hacking?
and how do I cap the ammo to stay at 200 and below
Re: Ammo cap -
CalvinC - 14.03.2015
Set up a timer like this:
pawn Код:
forward MyTimer();
public MyTimer()
{
new ammo[13]; // Create an array called "ammo" with the size of 13
foreach(new i : Player) // Loops through all online players (requires the foreach include)
{
for(new o = 0; o <= 12; o++) // Loops 12 times
{
GetPlayerWeaponData(playerid, o, ammo[o], ammo[o]);
// Each time it loops, store the weapon in the array "ammo", then store the ammo in the array "ammo" instead
// Because we don't need the weapon, so we just replace with the ammo
if(ammo[o] > 200) Ban(i); // If "ammo" is higher than 200, ban the player
}
}
}