OnPlayerSpawn
#1

So my problem is that i want when the player only joins when he spawns he will get the class selection once and after he dies he is still the same class untill he types the command /reclass but every time i spawn i get the class selection dialog that i have made how to prevent it coming every time i spawn

here is my dialog code
pawn Код:
ShowPlayerDialog(playerid,DIALOG_SKILL,DIALOG_STYLE_LIST,"Select your skill","Assault - Free\nSniper - 150 score\nEngineer - 300 score\nPilot - 550 score\nGunner - 700 score","Ok","");
Reply
#2

Just create a variable.
For example:
pawn Код:
new IsSpawnedFirstTime[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    IsSpawnedFirstTime[playerid] = 0;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    if(IsSpawnedFirstTime[playerid] == 0)
    {
        IsSpawnedFirstTime[playerid] = 1;
        ShowPlayerDialog(playerid,DIALOG_SKILL,DIALOG_STYLE_LIST,"Select your skill","Assault - Free\nSniper - 150 score\nEngineer - 300 score\nPilot - 550 score\nGunner - 700 score","Ok","");
    }
    return 1;
}
Reply
#3

Thanks it worked +1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)