23.04.2012, 19:01
How can I make a Team only for admins? When he selects the class it tell him "Class only for admins"
public OnPlayerRequestClass(playerid, classid)
{
if(classid == 1 && !IsPlayerAdmin(playerid)) // the class id
{
// code here
return 0;
}
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
if(GetPlayerSkin(playerid) == 100/* admin skin */ && !IsPlayerAdmin(playerid)) // the skin id
{
// code here
return 0;
}
return 1;
}
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;
}
new gTeam[MAX_PLAYERS];
forward SetPlayerTeamFromClass(playerid, classid);
AddPlayerClassEx(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
AddPlayerClass(1,100,0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
public OnPlayerRequestSpawn(playerid)
{
SetPlayerTeamFromClass(playerid, classid);
return 1;
}
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;
}