GetTickCount
#1

Hey! Can someone please show me some example of using this function? I want to create command which will be usable after one minute and you will be able to see time remaining using /time. One user showed me a example yesterday but my thread is deleated, so I cant see it -_-
Reply
#2

I wrote a small version for you using gettime. This works in seconds not miliseconds.

pawn Код:
new gCmdTime[MAX_PLAYERS];

COMMAND:lolol(playerid, params[])
{
    if( (gettime()-gCmdTime[playerid]) > 60 )//check if 60 secs have passed
    {
        //do stuff...
        gCmdTime[playerid] = gettime();
    }
    else
    {
        //60 secs has not passed since last /lolol command was entered
    }
    return 1;
}
If you want to get the time passed.
pawn Код:
(gettime()-gCmdTime[playerid])
PS, gettime is a lot safer to use that GetTickCount.

EDIT: EG, if you use GetTickCount like this for your commands - it will break when your server has been up for 24 days without restart. And its the machine that the samp server runs on that bugs so restarting your samp server wont fix it.
Reply
#3

thank you so much Iggy you helped me alot!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)