Time stamp
#5

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Basically when you type the function gettime(); without callbacks you will get the current unix timestamp you add 2 hours to the current time then if the player types this command again you'll have to see if it has passed 7200 MS (2 hours) yet or not.
pawn Код:
new jTime[MAX_PLAYERS]; //
CMD:examplecmd(playerid,params[])
{
new timestamp = gettime();
if(timestamp > jTime[playerid])
{
jTime[playerid] = gettime()+3600*2; // 1hour: 3600 ms
printf(" Typed /examplecmd. gettime stored in jTime ");
}
else
{
new hoursleft = (jTime[playerid]-timestamp)/3600; // 1 hour is 3600 MS as I've stated above, therefore dividing jTime[playerid]-timestamp will result into the hours left.
printf("Current time: %i | 2 Hours Added: %i | Hours left for you to type this command again %i.",timestamp,jTime[playerid],hoursleft);
}
}
This not work good.
Reply


Messages In This Thread
Time stamp - by bigboy81 - 12.01.2015, 02:06
Re: Time stamp - by DaniceMcHarley - 12.01.2015, 07:47
Re: Time stamp - by bigboy81 - 12.01.2015, 09:06
Re: Time stamp - by HazardouS - 12.01.2015, 09:18
Re: Time stamp - by bigboy81 - 12.01.2015, 10:26
Re: Time stamp - by bigboy81 - 12.01.2015, 22:32
Re: Time stamp - by bigboy81 - 13.01.2015, 12:11
Re: Time stamp - by bigboy81 - 13.01.2015, 15:50

Forum Jump:


Users browsing this thread: 1 Guest(s)