- 0
Time updating again and again
-
Recently Browsing 0 members
- No registered users viewing this page.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.
Question
bogdan.trial
Salut, eu vreau ca pe serveru meu sa imi arate timpul conectat al unui user, totul este ok pana acuma da cand un user iese din joc si intra inapoi sau daca dau restart la server se mai executa functia odata si baga cate 2 secunde , daca iese si intra inapoi mai baga o secunda in plus si tot asa.
Am incercat cu KillTime da nu a mers.
La public OnPlayerSpawn(playerid) am
[pawn]SetTimerEx("GameTime",1000,1,"i",playerid);[/pawn]
Si jos de tot am:
[pawn]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;
}[/pawn]
1 answer to this question
Recommended Posts