hey help me
#1

tell me how admins cannot attack admins with admin powers? let me show you an admin command
PHP код:
COMMAND:hog(playeridparams[])
{
    new 
TargetIDstring[256];
    if (
PlayerInfo[playerid][pAdminlevel] > 0)
    {
    if(
sscanf(params"u"TargetID))
    {
    
SendClientMessage(playeridCOLOR_ERROR"USAGE: /hog (Name/ID)");
    return 
1;
    }
    if(!
IsPlayerConnected(TargetID) || TargetID == INVALID_PLAYER_ID)
    {
    
SendClientMessage(playeridCOLOR_ERROR"That Player Is Not Connected.");
    return 
1;
    }
    if(
IsPlayerNPC(TargetID))
    {
    
SendClientMessage(playerid,COLOR_ERROR,"You Cannot Kill a BOT With Hand Of God.");
    return 
1;
    }
    if(
PlayerInfo[TargetID][pSpawned] == 0)
    {
    
SendClientMessage(playerid,COLOR_ERROR,"Player Is Not Spawned");
    return 
1;
    }
    
PlayerInfo[TargetID][pCustomDeath] = WEAPON_GOD;
    
SetPlayerHealth(TargetID0);
    
SetPlayerScore(playerid,GetPlayerScore(playerid) - 1);
    
SendDeathMessage(INVALID_PLAYER_IDTargetID40);
    
format(stringsizeof(string), "%s (%i) Died By The Hand Of God.",PlayerInfo[TargetID][pName],TargetID);
    
SendClientMessageToAll(COLOR_DEATHstring);
    
SendGameText(TargetID,"~r~Struck Down By The Hand Of God");
    new 
Float:xFloat:yFloat:z;
    
GetPlayerPos(TargetIDxyz);
    
PlayerPlaySound(TargetID1159xyz);
    }
    else
    {
    
SendClientMessage(playeridCOLOR_ERROR"Unknown Command! Type /cmds For Available Commands.");
    }
    return 
1;

Reply
#2

With a simple logic; if targetid has an admin level, stop them from using the command.

Код:
if (PlayerInfo[TargetID][pAdminLevel] != 0) 
      return SendClientMessage(playerid, -1, "You cannot use this command on an admin.");
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)