30.11.2018, 23:53
So, i got this command, the admin write and make a event automatically, and i puted a timer and GameTextForPlayer to do a countdown, but, the GameText show in game a countdown for up, it shows: -1, -2, -3, -4, -5 rather than 5, 4, 3, 2, 1, Besides that, the GameText dont hide after event begins, someone know why?
Command that create the event:
Fowards:
there are other things throughout the code, however they are irrelevant to this, the error is in the count I think.
Command that create the event:
PHP код:
ACMD:criarevento[1](playerid, params[])
{
inserttime = params[0]/1000;
if(sscanf(params, "i", params[0]))
return Msg(playerid, NovoA, "[ > ] Uso correto: /evento [tempo] (1000 = 1 Segundo)");
SetTimer("IniciarEvento", params[0], false);
timer = SetTimer("Countdownregressive", 1000, true);
return 1;
}
PHP код:
forward IniciarEvento();
public IniciarEvento()
{
KillTimer(timer);
inserttime = 0;
}
PHP код:
forward Countdownregressive();
public Countdownregressive()
{
inserttime--;
new string[240];
format(string, sizeof(string), "~y~O Evento sera iniciado em: ~g~%d~n~~y~Guarde seus ITENS!", inserttime);
for(new i = 0; i < MAX_PLAYERS; i++)
return GameTextForPlayer(i, string, 1000, 5);
}