Server Time
#1

Hey everyone!

Is it possible to have the same time in the server thats in the real world? Also with a clock textdraw.
Reply
#2

Depends on the timezone of where your server is hosted. And yes, it is possible to create a text-draw for it.
Reply
#3

You could just enable the in-game clock and set its value.

pawn Код:
public OnGameModeInit() {
    // run UpdateTime every 1000ms
    // 1000ms = 1 second
    // repeating: true
    SetTimer("UpdateTime", 1000, true);
}

public OnPlayerConnect(playerid) {
    // Show the clock for the player
    TogglePlayerClock(playerid, true);

    return 1;
}

forward UpdateTime();
public UpdateTime() {
    new hour, minute;

    // gettime will save the values into the variables
    gettime(hour, minute);

    // loop all players
    for (new p = 0; p < MAX_PLAYERS; p++) {
        if (IsPlayerConnected(p)) {
            // set the in-game time and
            SetPlayerTime(p, hour, minute);
        }
    }
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)