~Sr.Victor Posted August 3, 2020 Posted August 3, 2020 I don't know how to do it, I wanted to put a time of 10 seconds to type the command again and also the command can only be given with the ACL function progressodeagle(thePlayer) if isElementWithinMarker(thePlayer, deagle2) then local currentMoney = getPlayerMoney(thePlayer) if currentMoney >= 2500 then takePlayerMoney(thePlayer, 2500) giveWeapon(thePlayer, 24, 2) setPedFrozen(thePlayer, true) setPedAnimation(thePlayer, "ped", "bomber", 16000, true, false, false, false) setTimer(setPedFrozen, 16000, 1, thePlayer, false) setTimer(giveWeapon,16000, 1, thePlayer, 24, 450) else exports.hy_info:showBoxS(thePlayer, "#00FFFFVocê não possui dinheiro para fabricar esta arma!", "error") end end end addCommandHandler("fabricar", progressodeagle)
Moderators IIYAMA Posted August 3, 2020 Moderators Posted August 3, 2020 (edited) On 03/08/2020 at 02:45, ~Sr.Victor said: I wanted to put a time of 10 seconds to type the command again local nextCommandTime = {} -- function () local key = getPlayerSerial(player) -- serial based -- or local key = player -- element based local timeNow = getTickCount() if timeNow > (nextCommandTime[key] or 0) then nextCommandTime[key] = timeNow + 10000 else -- You will have to wait! end -- end By comparing current operating time with a fixed operating time + future offset, can be used to limit executions. ACL Manually: - Shut down the server (important) Disable commands in ACL: (add to the group: <acl name="Default">) <right name="command.fabricar" access="false" /> Enable commands in ACL: (add to the group you want to have access to this command) <right name="command.fabricar" access="true" /> - Save file - Start the server Or use admin panel to add those rights. @~Sr.Victor Edited August 4, 2020 by IIYAMA 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
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