-
Posts
6,058 -
Joined
-
Last visited
-
Days Won
208
IIYAMA's Achievements
Gangsta (45/54)
1.5k
Reputation
Single Status Update
-
WIKI
Yesterday I added my first wiki page. Which is not necessary something you call 'news'. But it was a lot of fun figuring out how the interface actually works. It is to be honest not very beginner friendly, even though there is a lot of documentation added. documentation
The page/function which I added to the useful functions list:
https://wiki.multitheftauto.com/wiki/CheckPassiveTimer
This useful function allows you to use passive timers in your conditions. For example you want to prevent players repeatedly using a command.
I named the function 'checkPassiveTimer', not sure if that is the best name for it, since it it does SET, CHECK and UPDATE, (+ Clean up cycle), depending on the situation. Checking is what you expect it actually does, so I picked that one.
addCommandHandler("candy", function (player) if checkPassiveTimer("candy timer", player, 5000) then outputChatBox("YES, EAT!", player) else outputChatBox("NO CANDY FOR YOU!", player) end end)
Does anybody have any suggestions/idea's/? Or more experience than me with the WIKI + suggestions or improvements for the format?
-
I also added the remaining wait time, which is the finish touch for this useful function. It is very awkward that you only notice `that it was missing something` after using it yourself.
addCommandHandler("candy", function () local status, remainingTime = checkPassiveTimer("candy timer 2", true, 5000) if status then outputChatBox("YES, EAT!") else outputChatBox("NO CANDY FOR YOU! You will have to wait " .. math.ceil(remainingTime / 1000) .. " seconds.") end end)
-