command
#1

Not going to give you the admin even if I logged with rcon say all are not authorized ...
http://pastebin.com/HvHMqZwJ
Reply
#2

Код:
 if (PlayerData[playerid][pAdmin] < 6)


8.            return SendErrorMessage(playerid, "Nu ai permisiunea pentru a folosi aceasta comanda.");
The code by design doesn't allow RCON admins to use the command.

PlayerData[playerid][pAdmin] is your variable which stores the admin level. Unless you set that variable to 6 when a player logs in through RCON he/she won't be able to use the command.

Use IsPlayerAdmin to check if a player is an admin.
Reply
#3

PHP код:
CMD:setadmin(playeridparams[])
{
        static
                
userid,
            
level;
 
        if(!
IsPlayerAdmin(playerid))
            return 
SendErrorMessage(playerid"Nu ai permisiunea pentru a folosi aceasta comanda.");
 
        if (
sscanf(params"ud"useridlevel))
                return 
SendSyntaxMessage(playerid"/setadmin [playerid/name] [level]");
 
        if (
userid == INVALID_PLAYER_ID)
            return 
SendErrorMessage(playerid"Ai specificat un player invalid!");
 
        if (
level || 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(userid0), level);
            
SendAdminAction(userid"%s te-a promovat la Admin Level (%d)."ReturnName(playerid0), level);
        }
        else
        {
            
SendAdminAction(playerid"L-ai demis pe %s la Admin Level (%d)."ReturnName(userid0), level);
            
SendAdminAction(userid"%s te-a demis la Admin Level (%d)."ReturnName(playerid0), level);
        }
        
PlayerData[userid][pAdmin] = level;
        
Log_Write("logs/admin_log.txt""[%s] %s has set %s's admin level to %d."ReturnDate(), ReturnName(playerid0), ReturnName(userid0), 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
#4

Ah, bug!

Shouldn't this
Код:
if(!IsPlayerAdmin(playerid))
be

Код:
if(!IsPlayerAdmin(playerid) && PlayerData[playerid][pAdmin] < 6)
Reply
#5

Nope, it should be only this:-

PHP код:
if(!IsPlayerAdmin(playerid)) 
Because your code [this]:-

if(!IsPlayerAdmin(playerid) && PlayerData[playerid][pAdmin] < 6)

will check if he's rcon admin AND admin.
Reply
#6

lel
PHP код:
if(PlayerData[playerid][pAdmin] < || !IsPlayerAdmin(playerid)) { 
Reply
#7

but
PHP код:
if(!IsPlayerAdmin(playerid)) 
Is just for RCON, and who says he wants it for RCON only?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)