Admin status check
#1

How do i make func, like RCON (IsPlayerAdmin.. etc):

OnPlayerCommandText:

Код:
..
if(IsAdmin(playerid))
{
 // if yes
 Yes you are admin!
}
else
{
 // if no
 You are not admin!
}
...
PlayerInfo[playerid][pAdmin] must be more than 0 level (like 1-3 levels, not 0)

Код:
forward IsAdmin(playerid);

public IsAdmin(playerid)
{
...??
}
Thanks!
Reply
#2

pawn Код:
if(IsPlayerAdmin(playerid,level))
is exactly the same as
pawn Код:
if(PlayerInfo[playerid][pAdmin]>=level)
The rest you can figure out by yourself.
Reply
#3

or,
pawn Код:
if(GetPVarInt(playerid,"AdminLevel") >= level )
Reply
#4

pawn Код:
forward IsAdmin(playerid);

public IsAdmin(playerid)
{
    if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 3)
    {
        return 1;
    }
    return 0;
}
or what? :S
Reply
#5

Quote:
Originally Posted by DarkPower
Посмотреть сообщение
or,
pawn Код:
if(GetPVarInt(playerid,"AdminLevel") >= level )
He means PVars. But you don't use PVars at the moment, so forget about that idea. You might replace the 2 dimensional array with PVars later on, when you have better experience with scripting. Just go on the way i told you and you will do fine for the beginning.
Reply
#6

Quote:
Originally Posted by Typhome
Посмотреть сообщение
pawn Код:
forward IsAdmin(playerid);

public IsAdmin(playerid)
{
    if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 3)
    {
        return 1;
    }
    return 0;
}
or what? :S
Would be a solution but I prefer a macro

pawn Код:
#define IsAdmin(%0) PlayerInfo[%0][pAdmin]
that would check if PlayerInfo[playerid][pAdmin] would be logically true (means != 0)
Reply
#7

// ahh , nevermind,
Reply
#8

Quote:
Originally Posted by Typhome
Посмотреть сообщение
I want same that function like IsPlayerAdmin(playerid), but this is for RCON, and i want it for PlayerInfo[playerid][pAdmin]..
Then create a function with another name. Call it something like IsPlayerAdminEx(playerid, level), or something like that. The rest you are able to do by yourself i guess.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)