28.12.2011, 19:29
Hello, i have on my server an save times on players, everything works ok until i leave the game and i join back, it executes the function again and starts to count again and it counts from 2 sec to 4 , etc.
I've try with TimeKill but didn't work.
I've try with TimeKill but didn't work.
Код:
OnPlayerSpawn(playerid)
{
SetTimerEx("GameTime",1000,1,"i",playerid);
return 1;
}
forward GameTime(playerid);
public GameTime(playerid) {
PlayerInfo[playerid][pSeconds]++; // When GameTime is being called, seconds are updated +1
if(PlayerInfo[playerid][pSeconds] == 60) { // If the total seconds = 60
PlayerInfo[playerid][pMinutes]++; // + 1 minute
PlayerInfo[playerid][pSeconds] = 0; // reset seconds to 0
}
if(PlayerInfo[playerid][pMinutes] == 60) { // If the total minutes = 60
PlayerInfo[playerid][pHours]++; // + 1 hour
PlayerInfo[playerid][pMinutes] = 0; // reset minutes to 0
PlayerInfo[playerid][pSeconds] = 0; // reset minutes to 0
}
return 1;
}

