yukitokun1996 Posted October 10, 2016 Posted October 10, 2016 i need a function settimer , so that for new day i mean : function resetDailyQuest(thePlayer) setElementData(thePlayer,"dailyquest", 0) end -- i need settimer for it reset on new day my english is bad , thanks
Walid Posted October 10, 2016 Posted October 10, 2016 (edited) setTimer(lowerWarningLevel, 86400000, 1, thePlayer) 1 Day = 86400000 Milliseconds Edited October 10, 2016 by Walid 1
yukitokun1996 Posted October 11, 2016 Author Posted October 11, 2016 13 hours ago, Walid said: setTimer(lowerWarningLevel, 86400000, 1, thePlayer) 1 Day = 86400000 Milliseconds does it start my function in 00:00 AM ?
iPrestege Posted October 11, 2016 Posted October 11, 2016 You want to make it with player real time? or ingame time?
yukitokun1996 Posted October 11, 2016 Author Posted October 11, 2016 26 minutes ago, FaHaD said: You want to make it with player real time? or ingame time? ingame time
iPrestege Posted October 11, 2016 Posted October 11, 2016 Then u can use this function : getTime So what are you trying to do if the time is 00:00 ?
yukitokun1996 Posted October 11, 2016 Author Posted October 11, 2016 1 minute ago, FaHaD said: Then u can use this function : getTime So what are you trying to do if the time is 00:00 ? i want start my function : function resetDailyQuest(thePlayer) setElementData(thePlayer,"dailyquest", 0) end on 0:00 , i need a full example , can you help me ?
iPrestege Posted October 11, 2016 Posted October 11, 2016 Here's an simple example : function aDailyUpdate ( ) -- Create function local aHour,aMinute = getTime ( ) -- get ingame time if ( aHour == 00 and aMinute == 00 ) then -- check if the time is 00:00 removeEventHandler ( 'onClientRender',root,aDailyUpdate ) -- remove the function handler aCall ( ) -- call the function we need outputChatBox ( 'Time now is 00:00' ) -- make a chat box note setTimer ( function ( ) addEventHandler ( 'onClientRender',root,aDailyUpdate ) -- we add the event again so make an update daily end,5000,1 ) end end addEventHandler ( 'onClientRender',root,aDailyUpdate ) -- add the function handler function aCall ( ) -- called function outputChatBox ( 'Hello world!' )-- chat box message end It's a client side code. 1
yukitokun1996 Posted October 11, 2016 Author Posted October 11, 2016 1 minute ago, FaHaD said: Here's an simple example : function aDailyUpdate ( ) -- Create function local aHour,aMinute = getTime ( ) -- get ingame time if ( aHour == 00 and aMinute == 00 ) then -- check if the time is 00:00 removeEventHandler ( 'onClientRender',root,aDailyUpdate ) -- remove the function handler aCall ( ) -- call the function we need outputChatBox ( 'Time now is 00:00' ) -- make a chat box note setTimer ( function ( ) addEventHandler ( 'onClientRender',root,aDailyUpdate ) -- we add the event again so make an update daily end,5000,1 ) end end addEventHandler ( 'onClientRender',root,aDailyUpdate ) -- add the function handler function aCall ( ) -- called function outputChatBox ( 'Hello world!' )-- chat box message end It's a client side code. thanks very munch <3
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