12.06.2010, 06:49
GetTickcount when the player connects and save it
GetTickcount when the player disconnects and save it
(disconect time) - (Connect time) = time online
then just convert ticks into seconds
this is how i do it
GetTickcount when the player disconnects and save it
(disconect time) - (Connect time) = time online
then just convert ticks into seconds
pawn Код:
stock PlayerConnectTime(playerid) {
PlayerTime[playerid][tConnect] = GetTickCount();
}
stock PlayerDisconnectTime(playerid) {
PlayerTime[playerid][tDisconnect] = GetTickCount();
PlayerTime[playerid][tOnline] = floatdiv((PlayerTime[playerid][tDisconnect] - PlayerTime[playerid][tConnect]),6000);
PlayerTime[playerid][tTotal] += PlayerTime[playerid][tOnline];
}