Bzz335 Posted January 11, 2014 Posted January 11, 2014 Hi guys.I have table with amount. 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)}, } addEventHandler ("onPlayerDamage", getRootElement(), function(attacker, weapon, bodypart, loss) givePlayerMoney(attacker,!?)-- Here's need value from string in table money [1]. end thanks. Police job script progress: 100% Courier job script progress::7%
Castillo Posted January 11, 2014 Posted January 11, 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 ), } addEventHandler ( "onPlayerDamage", getRootElement(), function ( attacker, weapon, bodypart, loss ) givePlayerMoney ( attacker, money [ math.random ( #money ) ] ) end ) That's what you wanted? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Bzz335 Posted January 11, 2014 Author Posted January 11, 2014 No. See.for 1 situation he must get math.random(150,400)[1] in another math.random(400,600)[2]. But thanks,Castillo. Police job script progress: 100% Courier job script progress::7%
Castillo Posted January 11, 2014 Posted January 11, 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 ), } addEventHandler ( "onPlayerDamage", getRootElement(), function ( attacker, weapon, bodypart, loss ) givePlayerMoney ( attacker, money [ 1 ] ) end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TAPL Posted January 11, 2014 Posted January 11, 2014 The table will not be updated, you should move the table inside the function.
Bzz335 Posted January 12, 2014 Author Posted January 12, 2014 Thanks,Castillo! Police job script progress: 100% Courier job script progress::7%
Castillo Posted January 12, 2014 Posted January 12, 2014 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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