SA-MP Forums Archive
[Duda] Timer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: [Duda] Timer (/showthread.php?tid=406503)



[Duda] Timer - RodriiK - 10.01.2013

Bueno, necesito saber como hacer que en 50 segundos (ejemplo), ocurra tal cosa. їHay una funciуn para hacerlo?


Respuesta: [Duda] Timer - adri1 - 10.01.2013

Sн, con SetTimer o SetTimerEx

Ejemplo:
pawn Код:
forward Test();
 
public OnGameModeInit()
{
    SetTimer("Test", 1000, false);// 1000 equivale a 1 segundo, ponerlo en milisegundos.
}
 
public Test()
{
    SendClientMessageToAll(-1, "HOLA");
    return 1;
}
Y SetTimerEx, cuando hay que indicar parametros ejemplo:

pawn Код:
forward Test(playerid);
 
public OnPlayerConnect(playerid)
{
    SetTimerEx("Test", 1000, false, "i", playerid);// 1000 equivale a 1 segundo, ponerlo en milisegundos.
}
 
public Test(playerid)
{
    SendClientMessageForPlayer(playerid, -1, "HOLA");
    return 1;
}
50 segundos son 50000 milisegundos..

Te recomienda echar un vistazo a la SA-MP Wiki:
SetTimer: https://sampwiki.blast.hk/wiki/SetTimer
SetTimerEx: https://sampwiki.blast.hk/wiki/SetTimerEx


Respuesta: [Duda] Timer - TiNcH010 - 10.01.2013

Te faltу aсadir que "false" significa que no se repite el Timer, en cambio con "true" se repetirнa siempre hasta matarlo a dicho Timer.


Re: [Duda] Timer - RodriiK - 10.01.2013

Код:
public Test()
{
    SendClientMessageToAll(-1, "HOLA");
    return 1;
}
Ese mensaje se envia cuando se inicia el timer o cuando termina?


Respuesta: Re: [Duda] Timer - adri1 - 10.01.2013

Quote:
Originally Posted by RodriiK
Посмотреть сообщение
Код:
public Test()
{
    SendClientMessageToAll(-1, "HOLA");
    return 1;
}
Ese mensaje se envia cuando se inicia el timer o cuando termina?
Cuando termina...


Re: Respuesta: Re: [Duda] Timer - RodriiK - 10.01.2013

Quote:
Originally Posted by adri1
Посмотреть сообщение
Cuando termina...
Gracias :P