SA-MP Forums Archive
Detecting rapidshot - 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: Detecting rapidshot (/showthread.php?tid=583475)



Detecting rapidshot - Fancy - 28.07.2015

How can i detect rapid shots,i want to make my own anti cheat and i dont have any idea how to detect that the bullet was shot x seconds after the previous one.


Re: Detecting rapidshot - PaulDinam - 28.07.2015

You can use the OnPlayerWeaponShot callback and use gettime(), store it somewhere to keep track of shooting intervals.

For instance:

lastShot[playerid] = gettime();

gettime() - lastShot[playerid] returns the amount of seconds that have passed from the moment the player fired a weapon.


Re: Detecting rapidshot - Abagail - 28.07.2015

https://sampforum.blast.hk/showthread.php?tid=496637 has some accurate detection for all types of weapons.

@PaulDinam, it should also be noted that an MP5 and an AK-47 shoot a lot more bullets than normal weapons(I believe it's somewhere around 50(?) for MP5, and 70 for AK-47) per second.


Re: Detecting rapidshot - Fancy - 28.07.2015

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
You can use the OnPlayerWeaponShot callback and use gettime(), store it somewhere to keep track of shooting intervals.

For instance:

lastShot[playerid] = gettime();

gettime() - lastShot[playerid] returns the amount of seconds that have passed from the moment the player fired a weapon.
Thanks