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=404085)



Show Dialog for all - StuartD - 01.01.2013

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


Re: Show Dialog for all - Infinity90 - 01.01.2013

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 ?


Re: Show Dialog for all - StuartD - 01.01.2013

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;



Re: Show Dialog for all - Infinity90 - 01.01.2013

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;
    }



Re: Show Dialog for all - StuartD - 01.01.2013

Thanks! Worked. Repped.


AW: Re: Show Dialog for all - IPrototypeI - 01.01.2013

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