admin team?
#1

How can I make a Team only for admins? When he selects the class it tell him "Class only for admins"
Reply
#2

you have some admin system in your gm?
Reply
#3

luxadmin and rcon obviously
Reply
#4

pawn Code:
public OnPlayerRequestClass(playerid, classid)
    {
        if(classid == 1 && !IsPlayerAdmin(playerid)) // the class id
        {
            // code here
            return 0;
        }
        return 1;
    }
Reply
#5

Quote:
Originally Posted by Jows
View Post
pawn Code:
public OnPlayerRequestClass(playerid, classid)
    {
        if(classid == 1 && !IsPlayerAdmin(playerid)) // the class id
        {
            // code here
            return 0;
        }
        return 1;
    }
wont work
Reply
#6

You can use GetPlayerSkin

pawn Code:
public OnPlayerRequestSpawn(playerid)
    {
        if(GetPlayerSkin(playerid) == 100/* admin skin */ && !IsPlayerAdmin(playerid)) // the skin id
        {
            // code here
            return 0;
        }
        return 1;
    }
Reply
#7

Try this.
pawn Code:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerAdmin(playerid)
    {
        SetPlayerPos();
        // Other stuff here
    }
    else SendClientMessage(playerid,-1, "You have to be an administrator to use this class!");
    return 1;
}
Reply
#8

Windows32:

Your code won't work properly because you aren't checking skin IDs. Therefore anyone who isn't an admin will not be able to spawn.

oscar7610:

Why won't Jows' code work? What are the errors you are getting from it? Also take a look at the wiki page for the OnPlayerRequestClass callback. As it gives an example of restricting certain classids to RCON admins.
Reply
#9

Here is a easier way.

pawn Code:
new gTeam[MAX_PLAYERS];
Forward
pawn Code:
forward SetPlayerTeamFromClass(playerid, classid);

On Gamemode init add this

pawn Code:
AddPlayerClassEx(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
If not this
pawn Code:
AddPlayerClass(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

On the PlayerRequestSpawn put this

pawn Code:
public OnPlayerRequestSpawn(playerid)
{
    SetPlayerTeamFromClass(playerid, classid);
    return 1;
}
Easier and simple to make more class's

Then on the setupplayerteamclass put thispublic

pawn Code:
public SetPlayerTeamFromClass(playerid, classid)
{
    {
    if (classid == 100))
    {
        gTeam[playerid] = Admin;
        GameTextForPlayer(playerid, "Admin", 500, 5);
                SendClientMessage(playerid, /*Your color here example*/COLOR_RED, "This class is only for administrators");
        return 1;
    }
        return 1;
}
Reply
#10

Quote:
Originally Posted by Burridge
View Post
Windows32:

Your code won't work properly because you aren't checking skin IDs. Therefore anyone who isn't an admin will not be able to spawn.
Yeah sorry I know what you mean!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)