Anti cheat check
#1

Ok i have tried to make an anti speedhack and it works but i want it not to detect if the player is admin level 4 it should not detect the player if he/she is speed hacking but if there level is less than 4 it will detect and send the message to the online admins.

My coding:
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
        new 
speed GetVehicleSpeed(GetPlayerVehicleID(playerid), 0);
        if(
speed 270 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 519 && GetVehicleModel(GetPlayerVehicleID(playerid)) != 553 || speed 300)
        {
            if(!
IsPlayerAdmin(playerid) || pInfo[playerid][Admin] < 4)// if im not wrong this is saying if the player is not rcon or lower than level 4
            
{
                new 
string[128];
                
format(stringsizeof(string), "Player %s(ID:%i) might be using speed hacks (%d MPH)",         GetName(playerid),playeridspeed);
                new 
Float:XFloat:YFloat:Z;
                
GetPlayerPos(playeridXYZ);
                
RemovePlayerFromVehicle(playerid);
                
SetPlayerPos(playeridXYZ+5);
                
SendToAdmins(orangestring);
            }
        }
    } 
Reply
#2

Код:
if (a == true && b == true) {
    // This only gets excuted if BOTH a AND (&& = and) b are true
} 
if (a == true || b == true) {
    // This gets executed when either:
    // a == true (b can be true or false) OR (|| = or)
    // b == true (a can be true or false)
}
Reply
#3

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Код:
if (a == true && b == true) {
    // This only gets excuted if BOTH a AND (&& = and) b are true
} 
if (a == true || b == true) {
    // This gets executed when either:
    // a == true (b can be true or false) OR (|| = or)
    // b == true (a can be true or false)
}
I know that , but bro i think my coding is right cause this is saying if the player isn't rcon or the player level is below 4 then it should send the message to the admins.

PHP код:
 if(!IsPlayerAdmin(playerid) || pInfo[playerid][Admin] < 4
Reply
#4

Change it to &&.
Reply
#5

Quote:
Originally Posted by 1fret
Посмотреть сообщение
I know that , but bro i think my coding is right cause this is saying if the player isn't rcon or the player level is below 4 then it should send the message to the admins.

PHP код:
 if(!IsPlayerAdmin(playerid) || pInfo[playerid][Admin] < 4
if the player is not RCON admin so the message will be send because !IsPlayerAdmin(playerid) will be right. That's why Arthur said you need && instead of ||. The condition will be : if the player is not RCON admin AND he have less than 4 admin level.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)