SA-MP Forums Archive
show dialog on clicking "Spawn" - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: show dialog on clicking "Spawn" (/showthread.php?tid=224165)



show dialog on clicking "Spawn" - SonToku - 11.02.2011

i want when a player in class selection click spawn button i have the dialog but how to set it with "Spawn" button

i mean this^^to show dialog on clicking "spawn"


Re: show dialog on clicking "Spawn" - xRyder - 11.02.2011

You can use OnPlayerSpawn() callback together with some player variables and create that effect.


Re: show dialog on clicking "Spawn" - SonToku - 11.02.2011

now i mean its a dialog for selecting teams and teams are on different spawns so thatswhy i want just when click spawn it should show the dialog before spawning


Re: show dialog on clicking "Spawn" - xRyder - 11.02.2011

I didn't understand you really clearly but I don't think that's possible 'cause when you click 'spawn' it will spawn you right away.
I could be wrong.


Re: show dialog on clicking "Spawn" - BMUK - 11.02.2011

You can stop the player from spawning using a variable.

TeamSelected[MAX_PLAYERS];

Set it to 1 when they select a team


pawn Код:
public OnPlayerRequestSpawn(playerid)
{
    if(!TeamSelected[playerid])
    {
        // show the dialog
        return 0;
    }

    return 1;
}



Re: show dialog on clicking "Spawn" - Mean - 11.02.2011

Returning 0 in OnPlayerRequestSpawn will prevent the player from spawning! So, return 0, show a dialog, then use SpawnPlayer( playerid ); ( not sure if it'll actually spawn ), if not, use OnPlayerSpawn!


Re: show dialog on clicking "Spawn" - Sasino97 - 11.02.2011

Yes, that's the right thing to do.


Re: show dialog on clicking "Spawn" - SonToku - 11.02.2011

can u explain better? ;p will be appreciated


Re: show dialog on clicking "Spawn" - Sasino97 - 17.02.2011

pawn Код:
public OnPlayerRequestSpawn(playerid)
{
  if(/*The player isn't spawned the first time*/)
  {
    ShowPlayerDialog(bla bla bla);
    return 0;
  }
}



Re: show dialog on clicking "Spawn" - silvan - 19.02.2011

Try this.


Assuming that PlayerTeam[playerid]; is the teamId and also ID 0 is when he is in no team yet, and teams start from 1 onwards.

Код:
public OnPlayerRequestSpawn(playerid)
{
    if(PlayerTeam[playerid] == 0)
    {
        ShowPlayerDialog(......);
        return 0;
    }
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == /*Dialog ID that you put in ShowPlayerDialog*/)
    {
        if(response == 0)     // If a Player Choose first Button
        {
        }
        if(response == 1)    // If a Player Choose second Button   ( Correctly )
        {
             SpawnPlayer(playerid);
             SetPlayerSpawn(playerid, /* Cordinates where you want him to spawn */);
        }
    }
    return 1;
}
I guess this should work, thou its untested.