SA-MP Forums Archive
Help with dialogresponse - 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: Help with dialogresponse (/showthread.php?tid=623842)



Help with dialogresponse - wallen - 06.12.2016

I scripted a dialog, i did everything but when i connect to the server and click on "Spawn" (dialog button) the player does not spawn correct that's what i occurred:
Код HTML:
http://i.imgur.com/JhZhutM.png
thats what the dialog looks like on a screenshot:

Код HTML:
http://i.imgur.com/Pb5gWTZ.jpg
This is the dialog:

Код:
	case DIALOG_SWITCH_TEAM_WELCOME:
		{
			if ( serverData[ cw_enabled ] )
		    {
				new ent[ 256 ];

		        switch ( serverData[ cw_state ] )
		        {
					case 0: format( ent, sizeof( ent ), "{"ATT_TCOLOR"}» %s (Attackers)\n{"DEF_TCOLOR"}» %s (Defenders)\n{"REF_TCOLOR"}» "REF_NAME"\n{C3C3C3}» SUB %s (Attackers)\n{C3C3C3}» SUB %s (Defenders)", clanWar[ 0 ][ team_name ], clanWar[ 1 ][ team_name ], clanWar[ 0 ][ team_name ], clanWar[ 1 ][ team_name ] );
					case 1: format( ent, sizeof( ent ), "{"DEF_TCOLOR"}» %s (Defenders)\n{"ATT_TCOLOR"}» %s (Attackers)\n{"REF_TCOLOR"}» "REF_NAME"\n{C3C3C3}» SUB %s (Defenders)\n{C3C3C3}» SUB %s (Attackers)", clanWar[ 0 ][ team_name ], clanWar[ 1 ][ team_name ], clanWar[ 0 ][ team_name ], clanWar[ 1 ][ team_name ] );
				}

				ShowPlayerDialog( playerid, DIALOG_SWITCH_TEAM_WELCOME, DIALOG_STYLE_LIST, "[EvO]EvOlutioN: Select a Team", ent, "Spawn", "" );
			}
			else
				ShowPlayerDialog( playerid, DIALOG_SWITCH_TEAM_WELCOME, DIALOG_STYLE_LIST, "[EvO]EvOlutioN: Select a Team", "{"ATT_TCOLOR"}» Attackers\n{"DEF_TCOLOR"}» Defenders\n{"REF_TCOLOR"}» "REF_NAME"\n{999999}» Sub Attackers\n{999999}» Sub Defenders", "Spawn", "" );
		}
And thats OnDialogResponse

Код:
case DIALOG_SWITCH_TEAM_WELCOME:
		{
			switch ( listitem )
			{
			    case 0..2:
			    {
	   				playerData[ playerid ][ P_TEAM ] = listitem;
					playerData[ playerid ][ P_SUB  ] = false;
					SetPlayerColor( playerid, teamColor( listitem, 0 ) );
					spawnLobby( playerid );
					SpawnPlayer( playerid );
				}
	            case 3..4:
	            {
					playerData[ playerid ][ P_TEAM ] = listitem - 3;
					playerData[ playerid ][ P_SUB  ] = true;
					SetPlayerColor( playerid, SUB_COLOR );
					spawnLobby( playerid );
					SpawnPlayer( playerid );
			    }
			}
		}
And of course when i do a simply command like /pm it shows that im not spawned D:


Re: Help with dialogresponse - wallen - 06.12.2016

help plox D:


Re: Help with dialogresponse - wallen - 06.12.2016

im stuck here for like 3 hours omg


Re: Help with dialogresponse - TheRohlikar - 06.12.2016

"case DIALOG_SWITCH_TEAM_WELCOME:"

you have same DIALOG_DEFINE on 2 dialogs ?


Re: Help with dialogresponse - wallen - 06.12.2016

I have two equal dialog with different id:
Код:
#define DIALOG_SWITCH_TEAM 1035
#define DIALOG_SWITCH_TEAM_WELCOME 4025
first dialog will appear if i type /switch (to change class) but the second one will appear onplayerrequestclass instead of class selection.

Код:
public OnPlayerRequestClass( playerid, classid )
{
	TogglePlayerSpectating(playerid, true); // disabling '' SPAWN '' button
        showDialog( playerid, DIALOG_SWITCH_TEAM_WELCOME ); // showing switch menu instead of class selection
        return true;
}



Re: Help with dialogresponse - TheRohlikar - 06.12.2016

What happens when you click on first and on third item ?


Re: Help with dialogresponse - wallen - 06.12.2016

you will spawn as attacker, and as spectator.

Thats the original code of cmd /switch

http://pastebin.com/VnyfU0Yy just to make you understand