03.11.2014, 00:10
most simple/efficient/reliable/less memory usage connected time check
NetStats_GetConnectedTime(playerid);
returns the players connected time for the session in milli seconds 1000ms/sec
EX:
(this is just an example and i havent tested it yet but you can use my stock BTW)
NetStats_GetConnectedTime(playerid);
returns the players connected time for the session in milli seconds 1000ms/sec
EX:
(this is just an example and i havent tested it yet but you can use my stock BTW)
pawn Код:
enum PLAYER_ENUM{ // change this to your own enum
pMinutes,
pPlayingHours,
pMilliseconds, // add this one to your player enum
...
}
CMD:mytime(playerid,params[])
{
new Float:hours,Float:minutes,Float:seconds,msg[128];
MyTimeInHMS(playerid,hours,minutes,seconds);
format(msg,sizeof(msg),"Your connected time Hour:%0.f Minutes:%0.f Seconds:%0.f",hours,minutes,seconds);
return 1;
}
stock MyTimeInHMS(playerid,&Float:hours,&Float:minutes,&Float:seconds)
{
new Float:milliseconds=NetStats_GetConnectedTime(playerid)+playerVariables[playerid][pMilliseconds];
hours=milliseconds/3600000;
milliseconds%=36000000;
minutes=milliseconds/60000;
milliseconds%=60000;
seconds=milliseconds/1000;
}