Show dialog after clicking "Spawn" button
#1

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

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

Move your register codes here
Reply
#3

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

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

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

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

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

Use the OnPlayerRequestSpawn
Reply
#9

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


Forum Jump:


Users browsing this thread: 2 Guest(s)