SA-MP Forums Archive
Show dialog after clicking "Spawn" button - 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: Show dialog after clicking "Spawn" button (/showthread.php?tid=611974)



Show dialog after clicking "Spawn" button - kampuman - 13.07.2016

Hi Guys I need a little hand here.

I have a register dialog showing while a player is choosing a class, now I want to move the register dialog only after clicking the Spawn button so that the register dialog wont block the character selection.


Thanks!


Re: Show dialog after clicking "Spawn" button - SilentSoul - 13.07.2016

https://sampwiki.blast.hk/wiki/OnPlayerRequestSpawn

Move your register codes here


Re: Show dialog after clicking "Spawn" button - kampuman - 13.07.2016

Thanks but after clicking the Spawn button it spawned me together with Register Dialog. I only want the dialog in the OnPlayerRequestSpawn.

I want to to be like these:

-If Player pressed the Spawn button then it will show the Register Dialog (without spawning yet)
-Then after Player successfully registered the dialog will disappear then now Player can press the spawn button



Code:
public OnPlayerRequestSpawn(playerid)
{
	classSelection[playerid] = 0;
 	ShowRegisterScreen(playerid); <<-- Register Dialog
	return 1;
}



Re: Show dialog after clicking "Spawn" button - SilentSoul - 13.07.2016

I guess thats what you wanted? ""now I want to move the register dialog only after clicking the Spawn button"",, Explain more if I am wrong.


Re: Show dialog after clicking "Spawn" button - kampuman - 13.07.2016

Yes mate sorry I was actually editing my post. Please kindly read it once again thank you!


Re: Show dialog after clicking "Spawn" button - SilentSoul - 13.07.2016

Try this:
pawn Code:
new
        bool:IsPlayerLoggedIn[ MAX_PLAYERS ] ;

public OnPlayerConnect(playerid)
{
    IsPlayerLoggedIn[ playerid ] = false;
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerLoggedIn[ playerid ] == false)
    {
        TogglePlayerSpectating(playerid, true);
        ShowPlayerDialog( playerid , 1 , DIALOG_STYLE_INPUT, "Test", "test", "ok", "cancel" );//show your register dialog
    }
    return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case 1: { TogglePlayerSpectating(playerid, false); }// change that to your dialog id you've in your script
    }
    return 1;
}



Re: Show dialog after clicking "Spawn" button - kampuman - 13.07.2016

thanks mate! +rep ill try to manage and fix it


Re: Show dialog after clicking "Spawn" button - Napst34 - 13.07.2016

Use the OnPlayerRequestSpawn


Re: Show dialog after clicking "Spawn" button - kampuman - 13.07.2016

Quote:
Originally Posted by Napst34
View Post
Use the OnPlayerRequestSpawn
No mate nice try but that wasn't it.