command
#3

PHP код:
CMD:setadmin(playerid, params[])
{
        static
                
userid,
            
level;
 
        if(!
IsPlayerAdmin(playerid))
            return 
SendErrorMessage(playerid, "Nu ai permisiunea pentru a folosi aceasta comanda.");
 
        if (
sscanf(params, "ud", userid, level))
                return 
SendSyntaxMessage(playerid, "/setadmin [playerid/name] [level]");
 
        if (
userid == INVALID_PLAYER_ID)
            return 
SendErrorMessage(playerid, "Ai specificat un player invalid!");
 
        if (
level < 0 || level > 6)
            return 
SendErrorMessage(playerid, "Invalid admin level. Levels range from 0 to 6.");
 
        if (
level > PlayerData[userid][pAdmin])
        {
            
SendAdminAction(playerid, "L-ai promovat pe %s la Admin Level (%d).", ReturnName(userid, 0), level);
            
SendAdminAction(userid, "%s te-a promovat la Admin Level (%d).", ReturnName(playerid, 0), level);
        }
        else
        {
            
SendAdminAction(playerid, "L-ai demis pe %s la Admin Level (%d).", ReturnName(userid, 0), level);
            
SendAdminAction(userid, "%s te-a demis la Admin Level (%d).", ReturnName(playerid, 0), level);
        }
        
PlayerData[userid][pAdmin] = level;
        
Log_Write("logs/admin_log.txt", "[%s] %s has set %s's admin level to %d.", ReturnDate(), ReturnName(playerid, 0), ReturnName(userid, 0), level);
 
        return 
1;
} 
Use this one!


EXPLANATIONS:-

PHP код:
if (PlayerData[playerid][pAdmin] < 6)
            return 
SendErrorMessage(playerid, "Nu ai permisiunea pentru a folosi aceasta comanda."); 
This code ^ will check if he is already ADMIN but this:-

PHP код:
  if(!IsPlayerAdmin(playerid))
            return 
SendErrorMessage(playerid, "Nu ai permisiunea pentru a folosi aceasta comanda."); 
will check if he's RCON ADMIN.
Reply


Messages In This Thread
command - by Jimmi - 04.09.2015, 22:06
Re: command - by Yashas - 05.09.2015, 07:23
Re: command - by Karan007 - 05.09.2015, 07:28
Re: command - by Yashas - 05.09.2015, 07:31
Re: command - by Karan007 - 05.09.2015, 07:33
Re: command - by jlalt - 05.09.2015, 07:53
Re: command - by saffierr - 05.09.2015, 11:02

Forum Jump:


Users browsing this thread: