itHyperoX Posted July 11, 2017 Share Posted July 11, 2017 (edited) Hi. I want to make a script, when player type /double "Amount", it take the player money, with math.random, when number numbers under 50 = give back the double money to player, if numbers above 50 = then just take the player money. Anybody can help me please what should i use for this? Thanks! Edited July 11, 2017 by TheMOG Link to comment
pa3ck Posted July 11, 2017 Share Posted July 11, 2017 addCommandHandler("double", function(p, cmd, money) if tonumber(money) then local mny = tonumber(money) local rnd = math.random(1, 100) if rnd <= 50 then takePlayerMoney(p, mny) else givePlayerMoney(p, mny) end end end) As simple as that, you probably over-complicated it. Link to comment
itHyperoX Posted July 11, 2017 Author Share Posted July 11, 2017 (edited) hmm. I want check the player money, and the money is positive addCommandHandler("double", function(p, cmd, money) if tonumber(money) then local mny = tonumber(money) local rnd = math.random(1, 100) if mny <= 0 then outputChatBox("Bigger than 0",p) elseif exports["core"]:getMoney(p) >= mny then -- 8 if rnd <= 50 then exports["core"]:takeMoney(p, mny) else exports["core"]:giveMoney(p, mny) end end end end ) attemt to comapre number with nil Edited July 11, 2017 by TheMOG 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