[Pedido] Cronometro
#3

Simples cara, vк o link do amigo acima, logo pense como montar...
pawn Код:
new timerContagem[MAX_PLAYERS]; //define uma variбvel em primeiro lugar para salvar o id do timer
new varContagem[MAX_PLAYERS]; //variбvel para a contagem regressiva
forward Regressivo(playerid); //define a callback

//Agora a criaзгo do callback
public Regressivo(playerid)
{
    new str[50];
    varContagem[playerid]--;
    format(str, sizeof(str), "Tempo restante %d", varContagem[playerid]);
    SendClientMessage(playerid, -1, str);
    if(varContagem[playerid] < 1)
    {
        KillTimer(timerContagem);
        varContagem[playerid] = 0;
        SendClientMessage(playerid, -1, "Timer terminado");
    }
    return 1;
}

//E por fim sua aplicaзгo
CMD:iniciar(playerid, params[])
{
    if(sscanf(params, "d", temp)) return SendClientMessage(playerid, "Uso: /iniciar [tempo]");
    varContagem[playerid] = temp;
    timerContagem[playerid] = SetTimerEx("Regressivo", 1000, true, "i", playerid);
    return 1;
}
Reply


Messages In This Thread
Cronometro - by AssasinoLM - 09.10.2014, 17:43
Re: Cronometro - by Marlon307 - 09.10.2014, 19:42
Re: Cronometro - by Bruno13 - 09.10.2014, 21:52
Re: Cronometro - by DarkBr - 27.03.2017, 01:04
Re: Cronometro - by Swinte - 27.03.2017, 01:07
Re: Cronometro - by GabrielMT - 27.03.2017, 02:21

Forum Jump:


Users browsing this thread: 1 Guest(s)