How to delay a dialog? -
Tass007 - 08.06.2013
I have two dialog scripts that show up at the same time so you only get to see one and i was wondering how can i add a timer to one of them here are the different scripts
pawn Код:
new stringa[500];
if(dialogid == DIALOGCLAN)
{
if(response)
{
if(!strlen(inputtext))
{
new nome[24];
GetPlayerName(playerid, nome, 24);
format(stringa, sizeof stringa, "{FF4444}Error:{FFFFFF} Insert a password.\n\n{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Account:", stringa, "Confirm", "Exit");
return 0;
}
if(!strcmp(inputtext, PASSWORDCLAN, false))
{
new nome[24];
GetPlayerName(playerid, nome, 24);
format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has confirmed to be part of the clan.", nome);
SendClientMessageToAll(BLU_CHIARO, stringa);
SendClientMessage(playerid, BLU_CHIARO, "You have confirmed to be part of the clan!");
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
return 1;
}
else
{
new nome[24];
GetPlayerName(playerid, nome, 24);
format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
SendClientMessageToAll(BLU_CHIARO, stringa);
SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
Kick(playerid);
}
}
else if(!response)
{
new nome[24];
GetPlayerName(playerid, nome, 24);
SendClientMessage(playerid, ROSA, "*** {FFFFFF}You have been kicked. Reason: {FF66FF}Failed login attempt in the clan{FFFFFF}.");
format(stringa, sizeof(stringa), "** {FFFFFF}%s{00BFFF} has been kicked from the Server. [Reason: {FFFFFF}Failed login attempt in the clan{00BFFF}]", nome);
SendClientMessageToAll(BLU_CHIARO, stringa);
Kick(playerid);
PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
}
}
}
pawn Код:
if(!strcmp(tmp,tmp2,true)) {
GameTextForPlayer(playerid,"~r~Before you can play, you must login!",4000,3);
ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"~~~~~~Login Password~~~~~~", " ", "OK", "Quit");
format(string,sizeof(string),"Welcome back, %s. Please login or you will be disconnected in 60 seconds!",PlayerName);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
SendClientMessage(playerid, COLOR_BRIGHTRED, "-----------------------------------------------------------------------------------------------------------------------");
PlayerInfo[playerid][LoggedIn] = 0;}}
Re: How to delay a dialog? -
Facerafter - 08.06.2013
You can create a public and put de showplayerdialog in thr public en use a timer to activate the public. You can create a timer doing the following:
pawn Код:
Forward showseconddialog();
Public showseconddialog()
{
Showplayerdialog
}
// the timer
SetTimer(showseconddialog, 5000, false);
//SetTimer(public name, time in ms 5000 = 5 sec, false/true defines wether the timer needs to be repeated
Or if you want to show it when you click ok/spawn or whatever. You can use
And if you don't want to let them show up both you need to edit the dialog idea.
Sorry for the font size, my phone is screwing it up.
Re: How to delay a dialog? -
Tass007 - 08.06.2013
So if i do
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new stringa[500];
new nome[24];
GetPlayerName(playerid, nome, 24);
if(strfind(nome, TAGCLAN, true) == 0)
{
format(stringa, sizeof(stringa), "{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Clan", stringa, "Confirm", "Exit");
}
else
{
SendClientMessage(playerid, BLU_CHIARO, "Welcome!");
}
return 1;
}
Would i add SetTimer in there?
Re: How to delay a dialog? -
Facerafter - 09.06.2013
Check my post agian. I updated it.
Also i dont understand what you are trying to do/i dont see where the second dialog comes up.
Btw. I dont think its possible to show 2 dialogs at the same time. (Correct me if im wrong)
EDIT: i now see it. Theres no need to set a timer. Use the showplayerdialog of the clan password AFTER hes logged in so after
pawn Код:
PlayerInfo[playerid][LoggedIn] = 1;
Re: How to delay a dialog? -
Tass007 - 09.06.2013
Yeh i know, because sometimes i'll get one or the other and it's really annoying.
pawn Код:
Forward showseconddialog();
Public showseconddialog()
{
ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Clan", stringa, "Confirm", "Exit");
}
return 1:}
public OnPlayerRequestSpawn(playerid)
{
new stringa[500];
new nome[24];
SetTimer(showseconddialog, 5000, false);
GetPlayerName(playerid, nome, 24);
if(strfind(nome, TAGCLAN, true) == 0)
{
format(stringa, sizeof(stringa), "{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Clan", stringa, "Confirm", "Exit");
}
else
{
SendClientMessage(playerid, BLU_CHIARO, "Welcome!");
}
return 1;
}
Would this be right?
Re: How to delay a dialog? -
Facerafter - 09.06.2013
Ehm, i think so. You will need to test out yourself normally i would have done it myself but im on my phone so. But also check my previous post agian. I updated it.
EDIT: you will need to format the dialog in the public agian.
Re: How to delay a dialog? -
Tass007 - 09.06.2013
Oh okay, but the clan password is set for public onplayerrequestspawn.
Would it look like this or is it wrong?
pawn Код:
public OnPlayerRequestSpawn(playerid)
{
new stringa[500];
new nome[24];
PlayerInfo[playerid][pLoggedIn] = 1;//added this
GetPlayerName(playerid, nome, 24);
if(strfind(nome, TAGCLAN, true) == 0)
{
format(stringa, sizeof(stringa), "{FFFFFF}Welcome {FF4444}%s{FFFFFF}!\nYou must confirm the clan password {FF4444}%s{FFFFFF}.\n{FFFFFF}Enter the clan password and confirm.", nome);
ShowPlayerDialog(playerid, DIALOGCLAN, DIALOG_STYLE_INPUT, "{33AA33}Clan", stringa, "Confirm", "Exit");
}
else
{
SendClientMessage(playerid, BLU_CHIARO, "Welcome!");
}
return 1;
}
Or would i have to put it in the ondialogresponse public?
Re: How to delay a dialog? -
Facerafter - 09.06.2013
You can remove what you just added. But yes. If you are forcing players to fill in the clan password. Than its better to do it ondialpgresponse, at the END of the login dialog. If you understand what i mean.
Re: How to delay a dialog? -
Tass007 - 09.06.2013
So you mean like add PlayerInfo[playerid][pLoggedIn] = 1; to the ondialogresponse of the clan password, and then i also add it at the end of the login dialog?? I'm lost now :PP
Re: How to delay a dialog? -
Facerafter - 09.06.2013
Nono. Forget the ploggedin shit.
Use showplayerdialog of the clan password. At the end of the login dialog. (In the ondialogresponse public)