Day started
#9

https://sampwiki.blast.hk/wiki/Gettime

pawn Код:
#define HOURS_TO_SECONDS(%0) (%0 * 3600) // hour to seconds convertor

new serverTimestamp;
new serverUpdateTimer;

public OnGameModeInit() {
    serverTimestamp = gettime(); // when your server starts, store the timestamp into your global variable

    serverUpdateTimer = SetTimer("OnServerUpdate", 1000, true); // a timer which will iterate every 1 second
}

forward OnServerUpdate();
public OnServerUpdate() {
    new currentTimestamp = gettime(); // get the current timestamp

    if (serverTimestamp - currentTimestamp >= HOURS_TO_SECONDS(1)) { // 1 hour has passed in your server

        // do your code here

        // reset our variable so we keep track for next hour pass
        currentTimestamp = serverTimestamp;
    }
}
Reply


Messages In This Thread
Day started - by Cezar98 - 11.11.2018, 05:24
Re: Day started - by v1k1nG - 11.11.2018, 12:19
Re: Day started - by IdonTmiss - 11.11.2018, 12:24
Re: Day started - by DIRTYBYT3 - 11.11.2018, 12:28
Re: Day started - by Cezar98 - 11.11.2018, 15:09
Re: Day started - by RogueDrifter - 11.11.2018, 15:35
Re: Day started - by Cezar98 - 11.11.2018, 15:39
Re: Day started - by ItsRobinson - 12.11.2018, 18:57
Re: Day started - by Gammix - 12.11.2018, 22:29

Forum Jump:


Users browsing this thread: 1 Guest(s)