GetTickCount and command on health
#1

Why the countdown begins to count from zero and reaches a given number and not the other way around? I want to countdown began between 120 seconds and ended at 0 Will be 0 when the command is to be unlocked.

This is my code:

Код:
CMD:zycie(playerid, params[])
{
    new Tick = GetTickCount();
    if(Tick - GetPVarInt(playerid, "Zycie") < 120 * 1000)
    {
        new string[128];
    	format(string, sizeof string, "{FFFFFF}Zycie mozesz kupic dopiero za {EA0000}%d{FFFFFF}.sek!", (Tick - GetPVarInt(playerid, "Zycie"))/1000);
        ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "{EA0000}Czekaj..",string,"Zamknij","");
        return 1;
    }
    SetPlayerHealth(playerid,100.0);
    SetPVarInt(playerid, "Zycie", Tick);
    return 1;
}
what is wrong?

Help.


Sorry for my english.
Reply
#2

Try gettime instead (returns seconds not miliseconds).
Reply
#3

Quote:
Originally Posted by MP2
Посмотреть сообщение
Try gettime instead (returns seconds not miliseconds).
Exactly..

Reputation
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)