Jump to content
  • 0

Time updating again and again


bogdan.trial

Question

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]

signature.php?bg=000000&text=FFFFFF&border=a0a0a0&ip=176.31.142.87&port=7777&bg_image=
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

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.