SA-MP Forums Archive
IsPlayerAdmin [HELP]!!!! - 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: IsPlayerAdmin [HELP]!!!! (/showthread.php?tid=326641)



IsPlayerAdmin [HELP]!!!! - [PDS]DarioKeic - 18.03.2012

Hello,
Im scripting a adminhq for my server. But i want ONLY regular administrators allowed not only RCON.
This is what i have. Only work if im logged in as RCON. But i want it to work with regular admins.
p.s- Im using LuxAdmin

This is my code.
Код:
if(strcmp(cmdtext,"/adminhq",true)==0)
{
if(!IsPlayerAdmin(playerid)) return 1;
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-1201.8862,-1000.5042,128.9680);
GameTextForPlayer(playerid,"~g~Admin ~r~House ~p~!!!",4000,6);
new string[256], pname[MAX_PLAYER_NAME];
return 1;
}



Re: IsPlayerAdmin [HELP]!!!! - Alvord - 18.03.2012

If players are to create accounts for your server,

add something like this into your enum:

pawn Код:
PlayerInfo[playerid][pAdmin]
this would determine whether the player is an admin or not.

then on your admin HQ, add this:

pawn Код:
if(PlayerInfo[playerid][pAdmin] > 0)
{
    SetPlayerInterior(playerid,0);
    SetPlayerPos(playerid,-1201.8862,-1000.5042,128.9680);
    GameTextForPlayer(playerid,"~g~Admin ~r~House ~p~!!!",4000,6);
    new string[256], pname[MAX_PLAYER_NAME];
    return 1;
}



Re: IsPlayerAdmin [HELP]!!!! - [PDS]DarioKeic - 18.03.2012

Where do i put "PlayerInfo"?
Do i just plug
if(PlayerInfo[playerid][pAdmin] > 0)
{
SetPlayerInterior(playerid,0);
SetPlayerPos(playerid,-1201.8862,-1000.5042,128.9680);
GameTextForPlayer(playerid,"~g~Admin ~r~House ~p~!!!",4000,6);
new string[256], pname[MAX_PLAYER_NAME];
return 1;
}



?


Re: IsPlayerAdmin [HELP]!!!! - Reklez - 18.03.2012

Alvord you are wrong

it would be something like this

pawn Код:
if(PlayerInfo[playerid][pAdmin] > 1)
DarioKelc make a enum something like

pawn Код:
enum pInfo
{
     pAdmin,
};
new PlayerInfo[MAX_PLAYERS][pInfo];
that should work

EDIT:

if you want to add a message if player is not administrator you will just do like this

pawn Код:
if(PlayerInfo[playerid][pAdmin] > 1)
{
      //codes
}
else return SendClientMessage(playerid, COLOR_ERROR, "You are not Administrator!");



Re: IsPlayerAdmin [HELP]!!!! - [PDS]DarioKeic - 18.03.2012

Im sorry, Im am VERY noob at this.

Where do i plug the enum?
and playerinfo?


?


Re: IsPlayerAdmin [HELP]!!!! - Reklez - 18.03.2012

put the enum after the #include <a_samp> or after the other #includes

then do Alvord said.


Re: IsPlayerAdmin [HELP]!!!! - RoleplayEditor - 18.03.2012

At the top before OnGamemodeinit.


Re: IsPlayerAdmin [HELP]!!!! - Skribblez - 18.03.2012

Quote:
Originally Posted by Reklez
Посмотреть сообщение
Alvord you are wrong
How is he wrong? Most scripts that uses an administration system have their admin rank start from 1. Regular players would stay as 0 for that matter. Even if that's not the case, there's nothing wrong with what he posted.