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



anit cheat - Tomer!.$ - 26.04.2012

Well, I made a basic anti cheat, just for forbidden weapons (minigun, rocket launcher, heat seeking etc..)
And it kicks me if I'm shooting with ANY weapon for somereason.
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if ((
newkeys KEY_FIRE) && !(oldkeys KEY_FIRE))
    {
        if(
GetPlayerWeapon(playerid) == 38 || || 18 || 35 || 36 || 37)
        {
            new 
string[128];
            
format(stringsizeof(string), "AdmCmd: %s was kicked by the server's anti-cheat, reason: Weapon hacks"GetName(playerid));
            
SendClientMessageToAll(COLOR_SYSTEMstring);
            
Kick(playerid);
        }
    }
    return 
1;




Re: anit cheat - SuperViper - 26.04.2012

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        new w = GetPlayerWeapon(playerid);
        if(w == 9 || w == 18 || (w > 34 && w < 39))
        {
            new string[128];
            format(string, sizeof(string), "AdmCmd: %s was kicked by the server's anti-cheat, reason: Weapon hacks", GetName(playerid));
            SendClientMessageToAll(COLOR_SYSTEM, string);
            Kick(playerid);
        }
    }
    return 1;
}



Re: anit cheat - Pinguinn - 26.04.2012

pawn Код:
GetPlayerWeapon(playerid) == 38 || GetPlayerWeapon(playerid) == 9 || GetPlayerWeapon(playerid) == 18 || GetPlayerWeapon(playerid) == 35 || GetPlayerWeapon(playerid) == 36 || GetPlayerWeapon(playerid) == 37
Edit: The guy above me has a better code and was faster.