Server Time
#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


Messages In This Thread
Server Time - by Hade. - 11.09.2013, 09:31
Re: Server Time - by Eyce - 11.09.2013, 10:07
Re: Server Time - by Slice - 11.09.2013, 10:42

Forum Jump:


Users browsing this thread: 5 Guest(s)