~Sr.Victor Posted August 1, 2020 Share Posted August 1, 2020 (edited) Hello, I have a script for making weapons. However, if the person has no money, he can manufacture it anyway. I want that if the person has no money a warning appears in the chat function progressodeagle(thePlayer) if isElementWithinMarker (thePlayer, deagle2) 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) end end addCommandHandler("fabricar", progressodeagle) Edited August 1, 2020 by ~Sr.Victor Link to comment
Moderators Patrick Posted August 1, 2020 Moderators Share Posted August 1, 2020 (edited) You can get player's money with getPlayerMoney. And this is just a simple IF statement: 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 outputChatBox("You don't have enough money! ($2500)", thePlayer) end end end addCommandHandler("fabricar", progressodeagle) Edited August 1, 2020 by Patrick 1 Link to comment
~Sr.Victor Posted August 1, 2020 Author Share Posted August 1, 2020 It worked, thank you very much! Can you put a delay to give the command? Link to comment
Moderators Patrick Posted August 2, 2020 Moderators Share Posted August 2, 2020 11 hours ago, ~Sr.Victor said: Can you put a delay to give the command? You have to use setTimer Link to comment
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