SA-MP Forums Archive
OnPlayerSpawn - 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: OnPlayerSpawn (/showthread.php?tid=492683)



OnPlayerSpawn - DarkLored - 04.02.2014

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","");



Re: OnPlayerSpawn - Jacapo - 04.02.2014

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



Re: OnPlayerSpawn - DarkLored - 04.02.2014

Thanks it worked +1