SA-MP Forums Archive
command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: command (/showthread.php?tid=588024)



command - Jimmi - 04.09.2015

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


Re: command - Yashas - 05.09.2015

Код:
 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.


Re: command - Karan007 - 05.09.2015

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.


Re: command - Yashas - 05.09.2015

Ah, bug!

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

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



Re: command - Karan007 - 05.09.2015

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.


Re: command - jlalt - 05.09.2015

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



Re: command - saffierr - 05.09.2015

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