Bzz335 Posted January 12, 2014 Share Posted January 12, 2014 local money={ [1]={math.random(150,400)}, [2]={math.random(400,600)}, [3]={math.random(600,800)}, [4]={math.random(800,1000)}, [5]={math.random(800,1000)}, [6]={math.random(800,1000)}, } function moneytest(player) givePlayerMoney ( player, money [ 6 ] ) end addCommandHandler("on",moneytest) Link to comment
DakiLLa Posted January 12, 2014 Share Posted January 12, 2014 You don't need to make table elements to be tables as well, since they do contain only one value. So it'd be better if you make your 'money' table look like: local money = { [ 1 ] = math.random( 150, 400 ), [ 2 ] = math.random( 400, 600 ), [ 3 ] = math.random( 600, 800 ), [ 4 ] = math.random( 800, 1000 ), [ 5 ] = math.random( 800, 1000 ), [ 6 ] = math.random( 800, 1000 ), } And it will work, since your function is retrieving the value of the 6th element in the table, which will contain some random number. 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