SA-MP Forums Archive
Show dialog for all - 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 for all (/showthread.php?tid=397195)



Show dialog for all - Angel.Why - 03.12.2012

Hi sa-mp.com. I got a problem when I try to show a dialog for all players:
Код:
if(strcmp(cmd, "/event", true) == 0)
	{
	    ShowPlayerDialog(playerid, 6987, DIALOG_STYLE_LIST, "Ce fel de event vrei?", "1:Deagle\n2:LCS\n3:CTvsTT\n4:Race\n5:Altul", "OK", "Renunta");
	    return 1;
	}
Код:
if(dialogid == 6987)
        {
            for(new i=0;i<MAX_PLAYERS;i++)
            {
            	if(response)
            	{
                	if(listitem == 0)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Deagle. "#COL_WHITE"Participi?",sendername);
                        ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?",string, "DA", "NU");
                    }
                	if(listitem == 1)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"LCS. "#COL_WHITE"Participi?",sendername);
                	    ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                	if(listitem == 2)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"CTvsTT. "#COL_WHITE"Participi?",sendername);
                	    ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                	if(listitem == 3)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Race. "#COL_WHITE"Participi?",sendername);
                	    ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                 	if(listitem == 4)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Necunoscut. "#COL_WHITE"Participi?",sendername);
                	    ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                }
                return 1;
           }
        }
But it shows the dialog only for player with id 0
Where is the problem?
I have one more problem.
Код:
if(dialogid == 6988)
        {
            if(response)
            {
          -->>How do I get the position of the admin who started the event<<-----?      
                SetPlayerPos(playerid, Float:XX, Float:YY, Float:ZZ);
            }
            else
            {
                return 1;
            }
            return 1;
        }
Thanks in advance


Re: Show dialog for all - DaRk_RaiN - 03.12.2012

Well this is how to get the pos of the admin:

PHP код:
if(dialogid == 6988)
        {
            if(
response)
            {
            new 
Floatx;
            new 
Float:y;
            new 
Float:z;
                
GetPlayerPos(playeridFloatxFloat:yFloat:z);//the x, y, z represent the currenet pos of the player/admin
            
}
            else
            {
                return 
1;
            }
            return 
1;
        } 



Re: Show dialog for all - Konstantinos - 03.12.2012

pawn Код:
// NOTE; You should reset the variable which stores the Admin's coordinates

// Global variable
new
    Float: Event_Pos[ 3 ]
;

// OnPlayerCommandText
    if(strcmp(cmd, "/event", true) == 0)
    {
        if( IsPlayerAdmin( playerid )
        {
            GetPlayerPos( playerid, Event_Pos[ 0 ], Event_Pos[ 1 ], Event_Pos[ 2 ] );
            for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6987, DIALOG_STYLE_LIST, "Ce fel de event vrei?", "1:Deagle\n2:LCS\n3:CTvsTT\n4:Race\n5:Altul", "OK", "Renunta");
        }
        return 1;
    }

// OnDialogResponse
    if(dialogid == 6987)
    {
        if(response)
        {
            if(listitem == 0)
            {
                format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Deagle. "#COL_WHITE"Participi?",sendername);
                ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?",string, "DA", "NU");
            }
            if(listitem == 1)
            {
                format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"LCS. "#COL_WHITE"Participi?",sendername);
                ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
            }
            if(listitem == 2)
            {
                format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"CTvsTT. "#COL_WHITE"Participi?",sendername);
                ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
            }
            if(listitem == 3)
            {
                format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Race. "#COL_WHITE"Participi?",sendername);
                ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
            }
            if(listitem == 4)
            {
                format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Necunoscut. "#COL_WHITE"Participi?",sendername);
                ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
            }
        }
        return 1;
    }
    if(dialogid == 6988)
    {
        if(response) return SetPlayerPos(playerid, Event_Pos[ 0 ], Event_Pos[ 1 ], Event_Pos[ 2 ]);
    }
    return 1; // Change to 0 if it's filterscript
}



Re: Show dialog for all - Angel.Why - 03.12.2012

Well thanks man but i need to show for all only the dialog with id 6988 not 6987


Re: Show dialog for all - Konstantinos - 03.12.2012

Oh, misunderstood. Try what you did, but make the for loop before the
pawn Код:
// --
    if(dialogid == 6987)
    {
        // code
    }



Re: Show dialog for all - Angel.Why - 03.12.2012

I did something like that
Код:
if(dialogid == 6987)
        {
            	if(response)
            	{
                	if(listitem == 0)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Deagle. "#COL_WHITE"Participi?",sendername);
                        for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?",string, "DA", "NU");
                    }
                	if(listitem == 1)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"LCS. "#COL_WHITE"Participi?",sendername);
                	    for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                	if(listitem == 2)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"CTvsTT. "#COL_WHITE"Participi?",sendername);
                	    for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                	if(listitem == 3)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Race. "#COL_WHITE"Participi?",sendername);
                	    for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                 	if(listitem == 4)
                	{
                	    format(string, sizeof(string),""#COL_WHITE"Adminul "#COL_RED"%s, "#COL_WHITE"organizeaza un event "#COL_GREEN"Necunoscut. "#COL_WHITE"Participi?",sendername);
                	    for( new i = 0; i < MAX_PLAYERS; i++ ) ShowPlayerDialog(i, 6988, DIALOG_STYLE_MSGBOX,"Doresti sa participi?", string, "DA", "NU");
                	}
                }
        }
        if(dialogid == 6988)
    	{
        	if(response) return SetPlayerPos(playerid, Event_Pos[ 0 ], Event_Pos[ 1 ], Event_Pos[ 2 ]);
    	}
And the command:
Код:
if(strcmp(cmd, "/event", true) == 0)
    {
        if( IsPlayerAdmin( playerid )
        {
            GetPlayerPos( playerid, Event_Pos[ 0 ], Event_Pos[ 1 ], Event_Pos[ 2 ] );
            ShowPlayerDialog(playerid, 6987, DIALOG_STYLE_LIST, "Ce fel de event vrei?", "1:Deagle\n2:LCS\n3:CTvsTT\n4:Race\n5:Altul", "OK", "Renunta");
        }
        return 1;
    }
Is that right?


Re: Show dialog for all - Konstantinos - 03.12.2012

I'm not sure if it will work for all, you can only be sure by testing it.
Yes, the event command is correct, it gets the coordinates of the Admin and set them on dialogid 6988.


Re: Show dialog for all - Angel.Why - 03.12.2012

Now i'm testing it..i'll tell you in 10 mins


Re: Show dialog for all - NeroX98 - 03.12.2012

Try like this... I'm not sure but try it and tell me

Код:
	if(strcmp(cmd, "/event", true) == 0)
	{
		for(new i=0;i<MAX_PLAYERS;i++)
            	{
			ShowPlayerDialog(i, 6987, DIALOG_STYLE_LIST, "Ce fel de event vrei?", "1:Deagle\n2:LCS\n3:CTvsTT\n4:Race\n5:Altul", "OK", "Renunta");
			return 1;
		}
	}



Re: Show dialog for all - Angel.Why - 03.12.2012

It work's man thanks a lot!