kuwalda Posted July 9, 2014 Share Posted July 9, 2014 Hi. Let`s say I want to welcome my server users in server every hour, but I want it to happen at exact time hours, like 9:00, 10:00, 11:00, 12:00 and so on.. Is this possible, because only things I can imagine is setting timer or use "onPlayerJoin" + "checkCurrentTime". By the way, in server I am using real time in server, so maybe that could somehow help? function resourceStart() local realtime = getRealTime() setTime(realtime.hour, realtime.minute) setMinuteDuration(60000) end addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), resourceStart) Link to comment
tosfera Posted July 9, 2014 Share Posted July 9, 2014 Easy way; set a timer for the remaining minutes/seconds from the time that the player joined until the first whole hour. After that set it each hour. Link to comment
MTA Team botder Posted July 10, 2014 MTA Team Share Posted July 10, 2014 addEventHandler("onResourceStart", resourceRoot, function () local now = getRealTime() setTimer(welcomeMessage, (3600 - (now.minute * 60) - now.second) * 1000, 1) end ) function welcomeMessage() setTimer(welcomeMessage, 3600 * 1000, 1) local players = getElementsByType("player") for _, player in ipairs(players) do outputChatBox("Welcome!", player, 0, 255, 0) end end Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now