Get how far the timer is?
#1

Hi SA-MP,

Is there any possibility to get how far the timer is?
Like, when someone types /stats, he sees how long it takes till he receives his paycheck?

Thanks
Reply
#2

yes.... its possible, search.

https://sampwiki.blast.hk/wiki/GetTickCount
https://sampwiki.blast.hk/wiki/SetTimer
Reply
#3

ow, sry
Thanks for helping
Reply
#4

you can do something like this:

pawn Код:
new Time[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/timetogetpay", true))
    {
        new str[40]
        format(str, 40, "Time to get your pay: %i seconds", (Time[playerid]-GetTickCount())/1000);
        SendClientMessage(playerid, -1, str);
        return 1;
    }
    return 0;
}

forward MyTimer(playerid);
public MyTimer(playerid)
{
    //Supose the timer interval to be 10000ms
    Time[playerid] = GetTickCount()+10000;
    //do something here
}
Reply
#5

Quote:
Originally Posted by the_chaoz
Посмотреть сообщение
you can do something like this:

pawn Код:
new Time[MAX_PLAYERS];

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/timetogetpay", true))
    {
        new str[40]
        format(str, 40, "Time to get your pay: %i seconds", (Time[playerid]-GetTickCount())/1000);
        SendClientMessage(playerid, -1, str);
        return 1;
    }
    return 0;
}

forward MyTimer(playerid);
public MyTimer(playerid)
{
    //Supose the timer interval to be 10000ms
    Time[playerid] = GetTickCount()+10000;
    //do something here
}
Yeah, thanks, i think i will use this one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)