SA-MP Forums Archive
anti ammo cheat - 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: anti ammo cheat (/showthread.php?tid=633816)



anti ammo cheat - GoldenLion - 07.05.2017

Hi, I made this ammo anti cheat
Код:
//OnPlayerWeaponShot...
new ammo = GetPlayerAmmo(playerid) - 1, slot = GetWeaponSlot(weaponid);

if (ammo >= PlayerInfo[playerid][pAmmo][slot])
{
	//player is cheating ammo
}
else PlayerInfo[playerid][pAmmo][slot] = ammo;
and it works perfectly for all guns except MP5 because it's too fast. Does anyone have an idea how to make it work for MP5? I'd really appreciate it.


Re: anti ammo cheat - Toroi - 07.05.2017

Код:
PlayerInfo[playerid][pAmmo][slot] = ammo + 2
In my point of view, this way it'd reduce the false-positives as it gives chance to the server to update the player's ammo.


Re: anti ammo cheat - GoldenLion - 07.05.2017

It's not going to work because it always sets the new ammo to current ammo - 1 in the variable so for example if a weapon has 100 ammo, you shoot once, the new ammo is supposed to be 100 - 1 = 99, and you set the variable to 99 + 2 = 101, but your ammo is still 100 and when you shoot again the same thing happens: 100 - 1 = 99, variable is set to 99 + 2 = 101 and it will never get detected.


Re: anti ammo cheat - Toroi - 07.05.2017

I don't know how the ammo cheat works, but doesn't it increase the ammo? Or perhaps it stops the ammo usage?


Re: anti ammo cheat - GoldenLion - 07.05.2017

This one will detect infinite ammo and adding ammo. By the way what I did as a solution was create a variable with player's ammo cheat warnings and now every time it detects ammo cheat, it increments the warnings by 1, else if it doesn't detect ammo cheat it decrements the warnings by 1 if there are any, if 3 warnings are reached I ban the player. Seems to be working perfectly.


Re: anti ammo cheat - Logic_ - 07.05.2017

I believe that the ammo detection doesn't work as expected and, you can also try checking the player ammo if it's 65535 or -65535, he/ she is hacking.


Re: anti ammo cheat - GoldenLion - 07.05.2017

Quote:
Originally Posted by Logic_
Посмотреть сообщение
I believe that the ammo detection doesn't work as expected and, you can also try checking the player ammo if it's 65535 or -65535, he/ she is hacking.
It is working perfectly. :P