I want to execute anti-cheat for admins
#1

Hello guys, I have this command and it's like a god mode that increases your health and armour to 9999, but the problem is that I got an anti-cheat that if your armour exceeds 96, you get automatically banned, but I don't want this to occur with administrators, so how can I make it to execute admins, so it doesn't ban admins. Here is the command
pawn Код:
CMD:3310(playerid, params[])
{
    if(pInfo[playerid][pAdminLevel] >= 6)
    {
        if(GetPVarType(playerid, "p3310Mode"))
        {
            DeletePVar(playerid, "p3310Mode");
            SetPlayerHealth(playerid, 100.0);
            SetPlayerArmour(playerid, 100.0);
            SendClientMessage(playerid, COL_3310GREEN, "Indestructible Nokia 3310 Mode Disabled");
        }
        else
        {
            SetPlayerHealth(playerid, 9999.9);
            SetPlayerArmour(playerid, 9999.9);
            SetPVarInt(playerid, "p3310Mode", 1);
            SendClientMessage(playerid, COL_3310RED, "Indestructible Nokia 3310 Mode Enabled");
        }
    }   else {
             PlayerPlaySound(playerid,1054,0.0,0.0,0.0),
             SendClientMessage(playerid,-1,""chat" Unknown command, try /help or /cmds");
    }return 1;
}
and here is the anti-cheat thingy for the armour hacking
pawn Код:
function OnServerUpdate()
{
    foreach(Player, i)
    {
        if(GetPlayerMoney(i) >= 1) return ResetPlayerMoney(i);
        SetPlayerScore(i,pInfo[i][pXP]);
        UpdateXPTextdraw(i);

        if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Jetpack";
            BanPlayer(i,reason3,Admin);
        }

        new Float:armor;
        GetPlayerArmour(i,armor);
        if(armor >= 96)
        {
            new Admin[24] = "Anti-cheat";
            new reason3[128] = "Armour Hack (Exceeded over 96f)";
            BanPlayer(i,reason3,Admin);
        }
Thank you in advance.
Reply
#2

pawn Код:
function OnServerUpdate()
{
    foreach(Player, i)
    {
        if(pInfo[i][pAdminLevel] < 6)
        {
            if(GetPlayerMoney(i) >= 1) return ResetPlayerMoney(i);
            SetPlayerScore(i,pInfo[i][pXP]);
            UpdateXPTextdraw(i);

            if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
            {
                new Admin[24] = "Anti-cheat";
                new reason3[128] = "Jetpack";
                BanPlayer(i,reason3,Admin);
            }

            new Float:armor;
            GetPlayerArmour(i,armor);
            if(armor >= 96)
            {
                new Admin[24] = "Anti-cheat";
                new reason3[128] = "Armour Hack (Exceeded over 96f)";
                BanPlayer(i,reason3,Admin);
            }
Reply
#3

PHP код:
if(armor >= 96 &&  PlayerInfo][ pAdmin ] == 0// Check your ADmin variable
            
{
                new 
Admin[24] = "Anti-cheat";
                new 
reason3[128] = "Armour Hack (Exceeded over 96f)";
                
BanPlayer(i,reason3,Admin);
            } 
Reply
#4

Doesn't work guys, but thanks for the replies.

EDIT: Yusei's code works, but now if a normal player (not an admin) tried to armour hack ? would the anti-cheat catch him and ban him or not ?
Reply
#5

How can it not work man? IIn my way simply the anticheat system doesn't make the jetpack-armour check for admins. It skips the admin player.
Reply
#6

pawn Код:
function OnServerUpdate()
{
    foreach(Player, i)
    {
        if(pInfo[i][pAdminLevel] >= 1) return 0;
        {
            if(GetPlayerMoney(i) >= 1) return ResetPlayerMoney(i);
            SetPlayerScore(i,pInfo[i][pXP]);
            UpdateXPTextdraw(i);

            if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK)
            {
                new Admin[24] = "Anti-cheat";
                new reason3[128] = "Jetpack";
                BanPlayer(i,reason3,Admin);
            }

            new Float:armor;
            GetPlayerArmour(i,armor);
            if(armor >= 96)
            {
                new Admin[24] = "Anti-cheat";
                new reason3[128] = "Armour Hack (Exceeded over 96f)";
                BanPlayer(i,reason3,Admin);
            }
Reply
#7

@Onfroi, if a player then tried to armour hack, will he get banned (if he isn't an admin) ? Same thing for Yusei's code. Thank you.
Reply
#8

Quote:
Originally Posted by Red_Dragon.
Посмотреть сообщение
@Onfroi, if a player then tried to armour hack, will he get banned (if he isn't an admin) ? Same thing for Yusei's code. Thank you.
If a player is level admin 1 or higher it will return 0, meaning it won't ban him.
Reply
#9

Quote:

would the anti-cheat catch him and ban him or not

Yeah Sure
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)