show dialog on clicking "Spawn"
#1

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"
Reply
#2

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

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
Reply
#4

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.
Reply
#5

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;
}
Reply
#6

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!
Reply
#7

Yes, that's the right thing to do.
Reply
#8

can u explain better? ;p will be appreciated
Reply
#9

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

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)