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



Spawn player - SsHady - 09.10.2013

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?


Re: Spawn player - JimmyCh - 09.10.2013

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!