02.08.2013, 07:08
Hi, so I found this on my script, could be useful for you.
First you got this:
Now when you want to see the total game time(example, in /stats), use the following:
Let's load it OnPlayerConnect:
I hope this is what you need!
Oh, also you need to save the time OnplayerDisconnect.
First you got this:
pawn Код:
enum pInfo
{
TotalTime,
hours,
mins,
secs,
ConnectTime
};
new PlayerInfo[MAX_PLAYERS][pInfo];
// now this
TotalGameTime(playerid, &h=0, &m=0, &s=0)
{
PlayerInfo[playerid][TotalTime] = ( (gettime() - PlayerInfo[playerid][ConnectTime]) + (PlayerInfo[playerid][hours]*60*60) + (PlayerInfo[playerid][mins]*60) + (PlayerInfo[playerid][secs]) );
h = floatround(PlayerInfo[playerid][TotalTime] / 3600, floatround_floor);
m = floatround(PlayerInfo[playerid][TotalTime] / 60, floatround_floor) % 60;
s = floatround(PlayerInfo[playerid][TotalTime] % 60, floatround_floor);
return PlayerInfo[playerid][TotalTime];
}
pawn Код:
TotalGameTime(playerid, h, m, s);
//now to preview it:
format(string, sizeof(string), "Total Time: %d hours %d minutes %d seconds", h, m, s);
SendClientMessage(playerid, -1, string);
pawn Код:
PlayerInfo[playerid][ConnectTime] = gettime();
Oh, also you need to save the time OnplayerDisconnect.