LucasBaker Posted October 22, 2014 Posted October 22, 2014 Hello because SetTimer not working? is to stop the animation after 2 seconds dMarker = createMarker(2251.50732, 2489.24927, 10.99080, 'cylinder', 2.0, 255, 0, 0, 150) function cDrogas(source) if isElementWithinMarker(source, dMarker) then outputChatBox("[sERVER] Você usou drogas ", source) setPedAnimation ( source, "CRACK", "Bbalt_Idle_02") setElementHealth ( source, getElementHealth(source) - 1 ) setPedArmor ( source, getPedArmor(source)+4 ) setTimer ( function() setPedAnimation(source) outputChatBox("[sERVER] Efeito das drogas passou", source) end, 5000, 1 ) else outputChatBox("[sERVER] Você não está no marker", source) end end addCommandHandler("usardrogas", cDrogas)
Moderators IIYAMA Posted October 22, 2014 Moderators Posted October 22, 2014 setPedAnimation(source,false) 2 seconds is 2000 ms not 5000 ms. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
LucasBaker Posted October 22, 2014 Author Posted October 22, 2014 setPedAnimation(source,false) 2 seconds is 2000 ms not 5000 ms. the animation is not going to enter / usardrogas
LucasBaker Posted October 22, 2014 Author Posted October 22, 2014 You need to pass the source into the timer. animation not to setTimer ( function(source) setPedAnimation( source, false) outputChatBox("[sERVER] Efeito das drogas passou", source) end, 2000, 1 )
Saml1er Posted October 22, 2014 Posted October 22, 2014 setTimer ( function(source) setPedAnimation( source, false) outputChatBox("[sERVER] Efeito das drogas passou", source) end, 2000, 1 ,source )
LucasBaker Posted October 23, 2014 Author Posted October 23, 2014 setTimer ( function(source) setPedAnimation( source, false) outputChatBox("[sERVER] Efeito das drogas passou", source) end, 2000, 1 ,source ) worked ...
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