Show dialog for all
#1

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

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

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

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

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

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?
Reply
#7

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

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

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

It work's man thanks a lot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)