[Help]SetTimerEx in Dialog - 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: [Help]SetTimerEx in Dialog (
/showthread.php?tid=446904)
[Help]SetTimerEx in Dialog -
ReshiramZekrom - 27.06.2013
Hi guys, i'm doing a timer with a dialog but, when i put the seconds in the dialog, it closes immediately and server says that i've selected 51 seconds when i've put 3..
Код:
if(dialogid == 352)
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "*** Hai annullato la domanda!");
}
else
{
new stringa [40];
if (!IsNumeric2(inputtext[0])) return SendClientMessage(playerid,COLOR_RED,"*** Devi inserire un numero!"), ShowPlayerDialog(playerid, 352, DIALOG_STYLE_INPUT, "{FF0000}Timer OX", "{4F4F4F}Imposta il tempo in secondi qui!", "Conferma", "Annulla");
format(stringa, sizeof(stringa), "*** Hai impostato il timer a %d secondi!", inputtext[0]);
SetTimerEx("timereventox", inputtext[0]*1000, false, "i", playerid);
SendClientMessage(playerid, COLOR_RED, stringa);
SendClientMessage(playerid, COLOR_RED, "*** Hai posto una domanda per l'evento OX!");
if(eventoox[playerid] == 1)
{
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
}
}
return 1;
}
Re: [Help]SetTimerEx in Dialog -
Jefff - 27.06.2013
You must use strval(inputtext)
Re: [Help]SetTimerEx in Dialog -
ReshiramZekrom - 27.06.2013
Working

Thanks
If someone want to see how i do, i've posted the correct script.
pawn Код:
if(dialogid == 352)
{
if(!response)
{
SendClientMessage(playerid, COLOR_RED, "*** Hai annullato la domanda!");
}
else
{
new stringa [50];
new timer = strval(inputtext);
if (!IsNumeric2(inputtext[0])) return SendClientMessage(playerid,COLOR_RED,"*** Devi inserire un numero!"), ShowPlayerDialog(playerid, 352, DIALOG_STYLE_INPUT, "{FF0000}Timer OX", "{4F4F4F}Imposta il tempo in secondi qui!", "Conferma", "Annulla");
format(stringa, sizeof(stringa), "*** Hai impostato il timer a %d secondi!", timer);
SetTimerEx("timereventox", timer*1000, false, "i", playerid);
SendClientMessage(playerid, COLOR_RED, stringa);
SendClientMessage(playerid, COLOR_RED, "*** Hai posto una domanda per l'evento OX!");
if(eventoox[playerid] == 1)
{
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
SendClientMessageToAll(-1, str);
}
}
return 1;
}