[FilterScript] Anti-NoReload & Anti-RapidFire - SA:MP 0.3z
#1

INTRODUCTION
After a long time trying to make an efficient system without success, finally I found the solution using this Callback:
OnPlayerWeaponShot ( playerid , weaponid , hittype , hitid , Float : fX , Float : fY , Float : fZ )(Only for lagcomp servers).

THE SYSTEM
The system is simple and completely efficient with 100 % accuracy to detect the most used No-Reload and Rapid-Fire cheat.
When a player shoots with a firearm, the system will check the ammo and if there is no loss for 5 times(you can edit) in a row, the player is cheating, because the cheat/mod(not all) freezes the ammo evading the reload shooting all time.
Remember: Everything is based on weapon ammo is not a perfect system, but it is the most efficient to detect the most used No-Reload or Rapid-Fire method. For now, the most cheat/mod used works with ammo freezes, this can make shoot very fast(Rapid-Fire) or No-Reloading.

WARNING
Caution: If you use an invalid value for the ammo from a gun this will cause conflict and the system will or can punish innocent players with false positives!

Example: GivePlayerWeapon (playerid , 24 , 99999999);
This will cause the ammo becomes infinite and the system can or not detect how No-Reloading / Rapid-Fire!
So, use GivePlayerWeapon (playerid , 24 , 9999); and not get any problem!

THE SCRIPT
pawn Код:
//==============================================================================//
//                     Anti-NoReload & Anti-RapidFire
//                         Creator: JR_Junior
//                        Date: March, 9, 2014
//        
//==============================================================================//
#include <a_samp>

new NoReloading[MAX_PLAYERS];
new CurrentWeapon[MAX_PLAYERS];
new CurrentAmmo[MAX_PLAYERS];

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(IsWeaponWithAmmo(weaponid) && weaponid != 38)//Not works with Minigun, sometimes get false positives!
    {
       
        new count = 0;
        if(weaponid != CurrentWeapon[playerid]) CurrentWeapon[playerid] = weaponid, CurrentAmmo[playerid] = GetPlayerWeaponAmmo(playerid,weaponid), count++;
        if(GetPlayerWeaponAmmo(playerid,weaponid) > CurrentAmmo[playerid] || GetPlayerWeaponAmmo(playerid,weaponid) < CurrentAmmo[playerid])
        {
           
            CurrentAmmo[playerid] = GetPlayerWeaponAmmo(playerid,weaponid);
            NoReloading[playerid] = 0;
            count++;
        }
        if(GetPlayerWeaponAmmo(playerid,weaponid) != 0 && GetPlayerWeaponAmmo(playerid,weaponid) == CurrentAmmo[playerid] && count == 0)
        {
           
            NoReloading[playerid]++;
            if(NoReloading[playerid] >= 5)
            {
               
                NoReloading[playerid] = 0;
                CurrentWeapon[playerid] = 0;
                CurrentAmmo[playerid] = 0;
                Kick(playerid);
                //Ban(playerid);
                return 0; //Returning 0 so that the damage doesn't occur and also the rest codes under OnPlayerWeaponShot won't get called.
            }
        }
    }
    return 1;
}

stock IsWeaponWithAmmo(weaponid)
{
    switch(weaponid)
    {
       
        case 16..18, 22..39, 41..42: return 1;
        default: return 0;
    }
    return 0;

}

stock GetPlayerWeaponAmmo(playerid,weaponid)
{
    new wd[2][13];
    for(new i; i<13; i++) GetPlayerWeaponData(playerid,i,wd[0][i],wd[1][i]);
    for(new i; i<13; i++)
    {
       
        if(weaponid == wd[0][i]) return wd[1][i];
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)