Spawn player
#1

This is my snippet
pawn Код:
format ( string , sizeof ( string ) , ""W"Welcome back, "Y"%s"W"! \n \n "Y"•"W" Your hours: "Y"%d \n "Y"•"W" Your minutes: "Y"%d \n "Y"•"W" Your seconds: "Y"%d \n \n "W"For more, please view "Y"/stats"W"! \n To see all the server commands, please write "Y"/cmds"W"!"
             , pName ( playerid ) , P_DATA [ playerid ] [ Hours ] , P_DATA [ playerid ] [ Minutes ] , P_DATA [ playerid ] [ Seconds ] ) ;
            SPD ( playerid , 6 , DIALOG_STYLE_MSGBOX , ""Y"L"W"o"Y"g"W"i"Y"n" , string , "O.K" , "" ) ;
And i want that if player presses the "O.K" button
it should instantly Spawn the player
I've tried with OnDialogResponse but it ended up in bunch of errors
So can you tell me the correct code and way?
Reply
#2

Here's what we'll do.
As I saw from your code, your dialog ID is 6.
Let's go to OnDialogResponse callback.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 6) // checking if the dialog id is 6
    {
        if(response) // if he presses the first button, in this case it's the "OK" button, you can use if(!response) for the second button
        {  
            SpawnPlayer(playerid); // spawning the player here
            SendClientMessage(playerid, -1, "You have been spawned!") // just a little message to tell him he's been spawned, just remove it if u want to
        }
    }
    return 1;
}
This wasn't so hard, was it?
Hope this helped!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)