Failed Anti-Cheat. Take a look please!
#1

pawn Код:
public AntiCheat(playerid)
{
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && PlayerInfo[i][Admin] < 1 )
        {
            new string [128];
            new name[MAX_PLAYER_NAME];
            GetPlayerName(playerid, name, sizeof(name));
            format(string, sizeof(string), "**Auto Ban: %s hacked a Jetpack!**", name);
            SendClientMessageToAll(COLOUR_ALERT, string);
            PlayerInfo[i][Banned] = 1; //Temp ban so i can test it
            SaveUser(i); // Temp
            Kick(i); //Temp
        }
    }
    return 1;
}
I tested that by giving a player a Jetpack but it never worked. Anyone see the problem(s)?

EDIT: Also it loops every second if that helps you at all?
Reply
#2

No need to have the "playerid" param here.

Under OnGameModeInit:
pawn Код:
SetTimer("AntiCheat", 1000, true);
Somewhere below:
pawn Код:
forward AntiCheat();
public AntiCheat()
{
    for(new i = 0; i < MAX_PLAYERS; ++i) // I suggest foreach
    {
        if(IsPlayerConnected(i) && GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && Playerinfo[i][Admin] < 1)
        {
            // He was detected
        }
    }
}
Reply
#3

Thanks, I'll test it now and report back here.
Reply
#4

Hmm it didn't work. I /agiveweapon him a jetpack but nothing happens
Reply
#5

Quote:
Originally Posted by cloudysky
Посмотреть сообщение
Hmm it didn't work. I /agiveweapon him a jetpack but nothing happens
Did the 'guy' use the jetpack? or did he just stand there as you spawned 'him' the jetpack?

Edit:

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
pawn Код:
forward AntiCheat();
public AntiCheat()
{
    for(new i = 0; i < MAX_PLAYERS; ++i) // I suggest foreach
    {
        if(IsPlayerConnected(i) && GetPlayerSpecialAction(i) == SPECIAL_ACTION_USEJETPACK && Playerinfo[i][Admin] < 1)
        {
            // He was detected
        }
    }
}
Also did you add a Kick where Lethal put:
pawn Код:
// He was detected
Reply
#6

He used it and yes i put kick there
Reply
#7

pawn Код:
forward AntiCheat();
public AntiCheat()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && PlayerInfo[i][pAdmin] < 1)
        {
            new SpecialAction = GetPlayerSpecialAction(i);
            if (SpecialAction == SPECIAL_ACTION_USEJETPACK)
            {
                //Code Here
            }
        }
    }
}
Credits: Luk0r
Reply
#8

Also, are you sure your admin level is set to 0?
Reply
#9

Yes although just now I found out every time a player logs out they get R5 admin... I'll come back to this later, thanks for the responses
Reply
#10

sftdp,

Just to let you know it's that anti cheat making everyone R5. I really don't get it :L
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)