Making a special team just for admins!
#1

Hey all!

I made an extra team, which should be only available for the admins! How should I script now, that only Level >=3 admins can join this team?

Code from OnPlayerRequestClass:

pawn Code:
case 27 .. 31: {
                SetPlayerPos(playerid, 1220.1063,-1410.3185,13.1395);
                SetPlayerFacingAngle(playerid, 354.7488);
                SetPlayerCameraPos(playerid, 1220.2598,-1407.5026,13.1717);
                SetPlayerCameraLookAt(playerid, 1220.1063,-1410.3185,13.1395);
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~h~~h~~p~Loco ~g~Syndicato", 3000, 3);
            }
Who knows a clever answer will get a rep
Reply
#2

pawn Code:
case 27 .. 31:
{
    if(VariableYouStorePlayerLevelIn >= 3)
    {
        SetPlayerPos(playerid, 1220.1063,-1410.3185,13.1395);
        SetPlayerFacingAngle(playerid, 354.7488);
        SetPlayerCameraPos(playerid, 1220.2598,-1407.5026,13.1717);
        SetPlayerCameraLookAt(playerid, 1220.1063,-1410.3185,13.1395);
        GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~h~~h~~p~Loco ~g~Syndicato", 3000, 3);
    }
}
??
Reply
#3

Return 0 after the condition that checks the admin level, it will prevent players from spawning.

pawn Code:
case 27 .. 31: {
     if (adminlevel >= 3)
     {
          SetPlayerPos(playerid, 1220.1063,-1410.3185,13.1395);
          SetPlayerFacingAngle(playerid, 354.7488);
          SetPlayerCameraPos(playerid, 1220.2598,-1407.5026,13.1717);
          SetPlayerCameraLookAt(playerid, 1220.1063,-1410.3185,13.1395);
          GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~h~~h~~p~Loco ~g~Syndicato", 3000, 3);
     }
     else
     {
          SendClientMessage(playerid, 0xFFFFFFFF, "You can't choose this class, it's only for lvl3 admins!");
          return 0;
     }
     break;
}
Reply
#4

pawn Code:
// in the OnPlayerRequestClass
SetPVarInt(playerid, "classID", classid);

// in the OnPlayerRequestSpawn
switch(GetPVarInt(playerid, "classID"))
{
     case 27 .. 31
     {
          if(!IsPlayerAdmin(playerid))
               return SendClientMessage(playerid, -1, "This class is for admins only.");

          // Do the rest of the code here
     }
}
Reply
#5

IsPlayerAdmin(playerid) only checks if the player is an RCON admin, but he doesn't want that.
Reply
#6

Well, little problem! When I join the serevr as admin, everything is OKAY and I can pick the class!
But, when I join as normal player without level, the buttons ">> or <<" don't even allow me to pick that class!
I want that also normal players can see it, but just when they'll press "Spawn", the message would appear...

Here my code again:

pawn Code:
case 27 .. 31: {
           
            if(PlayerInfo[playerid][pAdmin] >= 3)
            {
                SetPlayerPos(playerid, 1220.1063,-1410.3185,13.1395);
                SetPlayerFacingAngle(playerid, 354.7488);
                SetPlayerCameraPos(playerid, 1220.2598,-1407.5026,13.1717);
                SetPlayerCameraLookAt(playerid, 1220.1063,-1410.3185,13.1395);
                GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~h~~h~~p~Loco ~g~Syndicato", 3000, 3);
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You have to be an admin to choose that class, please pick another one!");
                return 0;
            }
Reply
#7

Do you it under requestclass, you have to do it under requestspawn.
(I mean, now you can't even see the class because you are no admin, but if you do it under requestspawn, you can see it as no-admin, but you can't spawn with it, you get it?)
Reply
#8

I know what you mean, but I don't know how to put them under this callback...
Reply
#9

Post your playerrequestclass and requestspawn callbacks, both.
Reply
#10

PHP Code:
case 27 .. 31: {
            
            if(
PlayerInfo[playerid][pAdmin] >= 3)
            {
                
SetPlayerPos(playerid1220.1063,-1410.3185,13.1395);
                
SetPlayerFacingAngle(playerid354.7488);
                
SetPlayerCameraPos(playerid1220.2598,-1407.5026,13.1717);
                
SetPlayerCameraLookAt(playerid1220.1063,-1410.3185,13.1395);
                
GameTextForPlayer(playerid"~n~~n~~n~~n~~n~~n~~n~~n~~n~~h~~h~~p~Loco ~g~Syndicato"30003);
            }
            else
            {
                
SendClientMessage(playeridCOLOR_RED"You have to be an admin to choose that class, please pick another one!");
                return 
0;
            } 
PHP Code:
    public OnPlayerRequestSpawn(playerid)
    {
        return 
1;
    } 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)