Admin status check - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin status check (
/showthread.php?tid=178689)
Admin status check -
Typhome - 23.09.2010
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!
Re: Admin status check -
DeathOnaStick - 23.09.2010
pawn Код:
if(IsPlayerAdmin(playerid,level))
is exactly the same as
pawn Код:
if(PlayerInfo[playerid][pAdmin]>=level)
The rest you can figure out by yourself.
Re: Admin status check -
DarkPower - 23.09.2010
or,
pawn Код:
if(GetPVarInt(playerid,"AdminLevel") >= level )
Re: Admin status check -
Typhome - 23.09.2010
pawn Код:
forward IsAdmin(playerid);
public IsAdmin(playerid)
{
if(PlayerInfo[playerid][pAdmin] >= 1 && PlayerInfo[playerid][pAdmin] <= 3)
{
return 1;
}
return 0;
}
or what? :S
Re: Admin status check -
DeathOnaStick - 23.09.2010
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.
AW: Re: Admin status check -
Nero_3D - 23.09.2010
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)
Re: Admin status check -
Typhome - 23.09.2010
// ahh , nevermind,
Re: Admin status check -
DeathOnaStick - 23.09.2010
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.