Command doesn't show the dialog
#1

When i type it.... nothing.
Код:
if (strcmp(cmdtext, "/richlist") == 0)
	{
	        new sendername[MAX_PLAYER_NAME], string[128];
        	for(new i = 0; i<MAX_PLAYERS; i++)
         	{
                	if(GetPlayerMoney(i) >= 25000000)
                	{
                	GetPlayerName(i, sendername, sizeof(sendername));
                	format(string, sizeof(string), "%s Cash: %d\n", sendername, GetPlayerMoney(i));
                	ShowPlayerDialog(playerid, 5197, DIALOG_STYLE_MSGBOX, "Rich Players", string, "Close" "");
                	}
 			}
   	return 1;
   	}
Thanks.
Reply
#2

Add this on top of gamemode
#define DIALOG_RICHLIST 3133

then OnPlayerCommandText
Код:
if (strcmp(cmdtext, "/richlist") == 0)
	{
	        new sendername[MAX_PLAYER_NAME], string[128];
        	for(new i = 0; i<MAX_PLAYERS; i++)
         	{
                	if(GetPlayerMoney(i) >= 25000000)
                	{
                	GetPlayerName(i, sendername, sizeof(sendername));
                	format(string, sizeof(string), "%s Cash: %d\n", sendername, GetPlayerMoney(i));
                	ShowPlayerDialog(playerid, DIALOG_RICHLIST, DIALOG_STYLE_MSGBOX, "Rich Players", string, "Close" "");
                	}
 			}
   	return 1;
   	}
Give it a Try
Reply
#3

Still doesn't work.
Reply
#4

You forgot the , between the "Close" and the ""
Here's how it needs to be
ShowPlayerDialog(playerid, 5197, DIALOG_STYLE_MSGBOX, "Rich Players", string, "Close", "");
Reply
#5

oohh.. Yea
Thanks : )
AND:

This is the right code:
Код:
if (strcmp(cmdtext, "/richlist") == 0)
	{
 		new sendername[MAX_PLAYER_NAME], string[128];
  		for(new i = 0; i<MAX_PLAYERS; i++)
   		{
    	if(GetPlayerMoney(i) >= 25000000)
    	{
    	GetPlayerName(i, sendername, sizeof(sendername));
    	format(string, sizeof(string), "%s Cash: %d\n", sendername, GetPlayerMoney(i));
    	}
		}
		ShowPlayerDialog(playerid, 3133, DIALOG_STYLE_MSGBOX, "Rich Players", string, "Close", "");
   	return 1;
   	}
The dialog must be outsite from the "for" looping !
Reply
#6

If you need any more help feel free to ask
Reply
#7

pawn Код:
if (strcmp(cmdtext, "/richlist") == 0)
{
    new sendername[MAX_PLAYER_NAME], string[128];
    for(new i = 0; i<MAX_PLAYERS; i++)
    {
        if(GetPlayerMoney(i) >= 25000000)
        {
            GetPlayerName(i, sendername, sizeof(sendername));
            format(string, sizeof(string), "%s Cash: %d\n", sendername, GetPlayerMoney(i));
            ShowPlayerDialog(playerid, DIALOG_RICHLIST, DIALOG_STYLE_MSGBOX, "Rich Players", string, "Close","");
        }
    }
    return 1;
}
Reply
#8

Btw, use easyDialog to make creating dialogs easier!
Reply
#9

Thanks again : )
Reply
#10

I need some help. I want to make the cash value with Float, but i don't know how?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)