[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
#2

Good job
Reply
#3

Quote:
Originally Posted by feartonyb
Посмотреть сообщение
Good job
Thank you very much, if you are testing and see a bug, report here!
Reply
#4

Very Good
I will test and here I take a @ Edit
Reply
#5

Good !!


By no reload you mean, when you the weapon have to reload but you swap gun and swap to the previous gun again to have ammo back ?

for example for a deagle, when we have 838-0. and we swap to have 831-7 it will detect it ?
Reply
#6

Quote:
Originally Posted by anou1
Посмотреть сообщение
Good !!


By no reload you mean, when you the weapon have to reload but you swap gun and swap to the previous gun again to have ammo back ?

for example for a deagle, when we have 838-0. and we swap to have 831-7 it will detect it ?
Goob question... The system only detect the changes in the ammo, so if you have 838-0 and reload changing to 831-7 you are not a cheater and the system will not accuse you! But if your ammo keep on 831-7 and not change, you are cheating!

@EDIT -
The system will apply the check for each weapon separately if you are using a Deagle and switch to a Tec-9 system will apply the function only for the Tec-9 without causing conflicts with other weapons.
Reply
#7

If a you shooting with the Minigun, the script kick you
Reply
#8

Quote:
Originally Posted by Fokus
Посмотреть сообщение
If a you shooting with the Minigun, the script kick you
Not, the script will not kick if you is not using No-reload, if your minigun is losing ammo the system will not accuse you!
Note: The script detect Rapid Fire because this cheat use No-reload too(Is needed), but if you want only a anti Rapid Fire I have another script to this. Keep calm, minigun shoot fast, but the system not is searching this, but your ammo, Reload/Losing ammo = good boy, No-reload/Keep ammo = cheater. Thanks!
Reply
#9

There would be problems occurring in case if the ammo of the weapon is set to the old value the script detects using "GivePlayerWeapon" or "SetPlayerAmmo". Hooking ammo related functions are necessary. Secondly, this is basically an anti ammo cheat. There are no reloads which would decrease ammo as well as does the no-reload thingy.

And followed by the reload cheat which would even reduce ammo, rapid shots can be even designed in a way which would decrease ammo and avoid the reload animation. I've created an include recently in regarding rapid fire, you can checkout the layout of it if interested.

https://sampforum.blast.hk/showthread.php?pid=2925838#pid2925838
Reply
#10

Quote:
Originally Posted by Lordz™
Посмотреть сообщение
There would be problems occurring in case if the ammo of the weapon is set to the old value the script detects using "GivePlayerWeapon" or "SetPlayerAmmo". Hooking ammo related functions are necessary. Secondly, this is basically an anti ammo cheat. There are no reloads which would decrease ammo as well as does the no-reload thingy.

And followed by the reload cheat which would even reduce ammo, rapid shots can be even designed in a way which would decrease ammo and avoid the reload animation. I've created an include recently in regarding rapid fire, you can checkout the layout of it if interested.

https://sampforum.blast.hk/showthread.php?pid=2925838#pid2925838
You're right, there are Mods / Cheats that do not lose ammo and recharge, but most do not reload, like the famous S0b3it!
My script does not detect the Rapid Fire specifically, but like most of the Mods / Cheats using freeze ammo it detects that too.
I tested your script and decide to create my own, because its not working well in my GM, I do not know what happened!
Reply
#11

Can use this on OnPlayerTakeDamage ?
Cuz on my server is lagshoot (Lagcomp = off)!
Reply
#12

is missing?
pawn Код:
forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
very good!!!
Reply
#13

If lag comp Off, OnPlayerWeaponShot is not call !
Reply
#14

Good Work Dude
Reply
#15

Thanks for use... if you found any bug please tell me!
Reply
#16

Good job
Reply
#17

Works in 0 3 7? Because someone hack us killing with liek minigun or rapid fire idk...
Reply
#18

Hmmm not tested but thanks..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)