Preventing player from spawn
#1

how can i prevent player to spawn with a specified skin if he has selected value (for e.g 0 instead of 1) in some variable?
i mean, using OnPlayerRequestSpawn and returning 0 doesn't work for me, are there any other methods?
Reply
#2

If you are using class selection, you can use the OnPlayerRequestClass callback like the following:

pawn Код:
new bool: PlayerIsAdmin[MAX_PLAYERS] = false;

public OnPlayerRequestClass(playerid, classid)
{
       if(classid == 50 && !PlayerIsAdmin[playerid])
       {
               SendClientMessage(playerid, -1, "You are not an admin, you cannot use this class.");
               return 0;
       }

       return 1;
}
Reply
#3

Well, use OnPlayerRequestSpawn to check for that.
Reply
#4

PHP код:
public OnPlayerRequestClass(playeridclassid)
{
    
SetPVarInt(playerid"class"classid);
    return 
1;

PHP код:
public OnPlayerRequestSpawn(playerid)
{
    new class;
    class = 
GetPVarInt(playerid"class");
    if(class == 
217 && !IsPlayerAdmin(playerid)) // change to whatever class you want to make it for admins only. 
    
{
        
GameTextForPlayer(playerid"You can't use admin skins."30005);
        return 
0;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)