SA-MP Forums Archive
GetTickCount and command on health - 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: GetTickCount and command on health (/showthread.php?tid=292894)



GetTickCount and command on health - maxi459 - 25.10.2011

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.


Re: GetTickCount and command on health - MP2 - 26.10.2011

Try gettime instead (returns seconds not miliseconds).


Re: GetTickCount and command on health - 4Brothers - 26.10.2011

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

Reputation