SA-MP Forums Archive
Making a special team just for admins! - 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: Making a special team just for admins! (/showthread.php?tid=315918)



Making a special team just for admins! - Twisted_Insane - 04.02.2012

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


AW: Making a special team just for admins! - Drebin - 04.02.2012

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);
    }
}
??


Re: Making a special team just for admins! - Nonameman - 04.02.2012

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;
}



Re: Making a special team just for admins! - Universal - 04.02.2012

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
     }
}



AW: Making a special team just for admins! - Drebin - 04.02.2012

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


Re: Making a special team just for admins! - Twisted_Insane - 05.02.2012

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;
            }



Re: Making a special team just for admins! - geerdinho8 - 05.02.2012

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?)


Re: Making a special team just for admins! - Twisted_Insane - 05.02.2012

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


Re: Making a special team just for admins! - geerdinho8 - 05.02.2012

Post your playerrequestclass and requestspawn callbacks, both.


Re: Making a special team just for admins! - Twisted_Insane - 05.02.2012

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;
    }