kuwalda Posted July 9, 2014 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)
tosfera Posted July 9, 2014 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. If you want to contact me directly concerning Advanced-Gaming, please contact me at [email protected]
MTA Team botder Posted July 10, 2014 MTA Team 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 GitHub: Debug Console • MTA-Discord Relay Scripting: How to draw a line chart with DirectX functions? • Doppler Effect in MTA • Get the client's FPS • Customizable Blur Shader
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