06.01.2017, 12:19
Hi guys, how to use GetTime i use mysql how can i make system saves player time played in server since he registered?
// Forwards
forward PlayerTimer(playerid);
// Some variables
new ConnectedTimer[MAX_PLAYERS],
Seconds[MAX_PLAYERS], Minutes[MAX_PLAYERS],
Hours[MAX_PLAYERS];
// OnPlayerConnect
ConnectedTimer[playerid] = SetTimerEx("PlayerTimer", 1000, 1, "i", playerid);
// OnPlayerDisconnect
KillTimer(ConnectedTimer[playerid]);
// Somewhere in your script
public PlayerTimer(playerid) {
Seconds[playerid]++
if(Seconds[playerid] == 60) {
Seconds[playerid] = 0;
Minutes[playerid]++;
if(Minutes[playerid] == 60) {
Minutes[playerid] = 0;
Hours[playerid]++
}
}
}
PHP код:
|
NetStats_GetConnectedTime(playerid)