Show Dialog for all
#1

Well; I want a dialog to show to all players;

however when I ran this;

Stock;
pawn Код:
ShowDialogForAll(dialogid, dialogstyle, caption[], info[], button1[], button2[])
{
    new
      x
    ;
    do
    {
        if(IsPlayerConnected(x) && !IsPlayerNPC(x))
        {
            ShowPlayerDialog(x, dialogid, dialogstyle, caption, info, button1, button2);
        }
    }
    while((x != MAX_PLAYERS));
    return 1;
}
Command;
pawn Код:
CMD:annrestart(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 3)
        {
            new string[128];
            strcat(string, "There is going to be a restart\nPlease /q to save your stats before the restart");
            ShowDialogForAll(100, DIALOG_STYLE_MSGBOX, "Server Restarting Soon", string, "Close", "");
            return 1;
        }
        return 1;
    }
The dialog reopens after pressing close and just wont go away! Any Ideas? :3
Reply
#2

pawn Код:
CMD:annrestart(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 3)
        {
              for(new i=0; i < MAX_PLAYERS; i++)
              {
               new string[128];
               strcat(string, "There is going to be a restart\nPlease /q to save your stats before the restart");
               ShowPlayerDialog(i ,100, DIALOG_STYLE_MSGBOX, "Server Restarting Soon", string, "Close", "");
               }
               return 1;
        }
        return 1;
    }
Wouldn't that work ?
Reply
#3

Going to try that

Edit ::

pawn Код:
(1068) : error 035: argument type mismatch (argument 3)

1066:       new string[128];
1067:       strcat(string, "There is going to be a restart\nPlease /q to save your stats before the restart");
1068:       ShowDialogForAll(i ,100, DIALOG_STYLE_MSGBOX, "Server Restarting Soon", string, "Close", "");
1069:       return 1;
Reply
#4

Replace
pawn Код:
ShowDialogForAll
//Too
ShowPlayerDialog
Show me the line?
if not try this:

pawn Код:
CMD:annrestart(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 3)
        {
              for(new i=0; i < MAX_PLAYERS; i++)
              {
               new string[128];
               format(string, sizeof(string), "There is going to be a restart\nPlease /q to save your stats before the restart");
               ShowPlayerDialog(i ,100, DIALOG_STYLE_MSGBOX, "Server Restarting Soon", string, "Close", "");
               }
               return 1;
        }
        return 1;
    }
Reply
#5

Thanks! Worked. Repped.
Reply
#6

Quote:
Originally Posted by Infinity90
Посмотреть сообщение
pawn Код:
CMD:annrestart(playerid, params[])
    {
        if(PlayerInfo[playerid][pAdminLevel] >= 3)
        {
              for(new i=0; i < MAX_PLAYERS; i++)
              {
               new string[128];
               strcat(string, "There is going to be a restart\nPlease /q to save your stats before the restart");
               ShowPlayerDialog(i ,100, DIALOG_STYLE_MSGBOX, "Server Restarting Soon", string, "Close", "");
               }
               return 1;
        }
        return 1;
    }
Wouldn't that work ?
you have forgotten the if statement
pawn Код:
if(IsPlayerConnected(i)){
to optimize the for loop because you don't want to create this Dialog for Player who 're not online
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)