[Include] OPRF.inc - OnPlayerRapidFire [0.3z]
#1

OPRF - OnPlayerRapidFire
Recently, I saw an include by [uL]Pottus in limiting the weapon shots (in case of quicker shots or even for rapid fires). It inspired me to create a pretty simple include which detects rapid fires when it's being done.

Rapid Fire

Rapid Fire is a cleo cheat which does shots rapidly and can be harmful for servers on 0.3z with lagcompmode 'On' which concentrates on DM/TDM. It can even kill player in less than a second in case of weapons which are in categories like assault rifles, desert eagle, or shotgun.

If you still don't have any idea about Rapid Fire, please check out the video at the end of the topic.

Change Log
Код:
23-02-2014
 - Initial Release.
 - Fixed some issues with arrays.
 - Fixed the problem for sub-machine guns like Tec9 (ID:32) and uzi (ID:28)
 
24-02-2014 (v2 Released)
 - Added support for Sniper Rifle and Country Rifle.
 (Thanks to 'West X' for reporting about it)

26-8-2014

 - Improved the way of detection.
 - Added : GetPlayerLastShotTick which returns the last shot tick of the player.
 
    Usage : GetPlayerLastShotTick(playerid);
Hooked Callbacks

Following are the hooked callbacks on the version 3 of this include.

pawn Код:
OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
OnPlayerConnect(playerid);
OnGameModeInit(); //Even if it's used for filterscript, this callback gets called.
Usage
OnPlayerRapidFire is called when a player does rapid shots, it provides the playerid, weaponid and interval of the rapid shots. Returning 0 on this callback won't allow the rest data under OnPlayerWeaponShot to go on and also would cancel that shot sync.
pawn Код:
forward OnPlayerRapidFire(playerid, weaponid, intervals);
/*
    playerid - the player who shoots rapid fires.
    weaponid - the weapon which did rapid shots.
    intervals - the difference between last shot time and the current one.
    Return : 0 will stop sending the shot data sync to others, 1 will send the shot data sync to others.*/
Examples

pawn Код:
#include <a_samp>
#include <OPRF>

public OnPlayerRapidFire(playerid, weaponid, intervals)
{
    Kick(playerid); //Kicks the player for rapid firing.
    return 0; //Returning 0 so that the damage doesn't occur and also the rest codes under OnPlayerWeaponShot won't get called.
}
Downloads

GitHub - Includes source and complete examples
NOTE : If you're facing any false detections on assault rifles or submachine guns, consider using this snippet : http://forum.sa-mp.com/showpost.php?...6&postcount=27

Use the one called "OPRF.inc". If you've found anything wrong with "OPRF.inc", get to "oldfiles" directory and use "OPRF2.inc".

NOTE: I'm suggesting not to use things relating like sending/receiving data under the 'OnPlayerRapidFire' callback. Even if using, create an array or use the 'intervals' argument to get it flawless or else there would be lag occurring.

• If you got any suggestions for the improvement of the include, feel free to post it here.
• Download "OPRF.inc" version which is the latest one, v3.
• If this include detects someone whose innocent at first, I suggest you to create warning counts to ensure that things are alright.
This often happens only with assault rifles when it's shot on long distances. So a warning system would be good to cease that out or simply "return 0" on the callback when rapid fire is being called on assault rifles (ID 30 and 31).
Quote:
Originally Posted by BlueSky_
Посмотреть сообщение
There's a small issue with the detection, mainly due to FPS differences. I tested this on different FPS and came to see that M4 gets detected if we're shooting at LONG distances with better FPS rates. That would be what RCON1 reported too. I hope this gets fixed soon.
Media
[ame]http://www.youtube.com/watch?v=-ENba8dmIFU[/ame]

Regards,
Lordzy.
Reply


Messages In This Thread
OPRF.inc - OnPlayerRapidFire [0.3z] - by Lordzy - 23.02.2014, 03:42
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by TonyII - 23.02.2014, 03:44
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Lordzy - 23.02.2014, 04:24
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Scenario - 23.02.2014, 04:25
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Lordzy - 23.02.2014, 04:37
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Scaleta - 23.02.2014, 05:21
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by RCON1 - 23.02.2014, 09:29
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Lordzy - 23.02.2014, 09:41
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by amirab - 23.02.2014, 16:03
Re: OPRF.inc - OnPlayerRapidFire [0.3z] - by Sabur - 23.02.2014, 18:29

Forum Jump:


Users browsing this thread: 1 Guest(s)