OrbTanT Posted July 20, 2014 Share Posted July 20, 2014 I would like to create a table, of the type that the player after that die, give spawn with one of those pack, more I am not able to create this table. pack weapon = { ( 24, 26, 31), -- weapons IDS = Desert Eagle, Sawn Off, M4 ( 24, 27, 31), -- weapons IDS = Desert Eagle, Combat Shotgun, M4 ( 24, 26, 28, 31) -- weapons IDS = Desert Eagle, Sawn Off, Uzi, M4 } Link to comment
Et-win Posted July 20, 2014 Share Posted July 20, 2014 table = { {M4, MP5, etc} } You now can loop through them too. Link to comment
OrbTanT Posted July 20, 2014 Author Share Posted July 20, 2014 I would like to use the math.radom , to be aleatorio the pack, when der the respawn, I don't understand much of math.random Link to comment
Et-win Posted July 20, 2014 Share Posted July 20, 2014 table = { {1, 2 ,3}, {4, 5, 6} } local gRandom = math.random(#table) for placeNumber, weaponData in ipairs(table[gRandom]) do giveWeapon(player, weaponData, ammo, current) end I hope you try to understand the code Link to comment
OrbTanT Posted July 20, 2014 Author Share Posted July 20, 2014 I tried to make the script work in this way, most had no results, shows the giveweapon bad argument 1. table = { {24, 26 ,31}, {24, 27, 31} } function weapon() local gRandom = math.random(#table) for placeNumber, weaponData in ipairs(table[gRandom]) do giveWeapon(player, weaponData, ammo, current) end end addEventHandler("onPlayerWasted", getRootElement(), weapon) Link to comment
Et-win Posted July 20, 2014 Share Posted July 20, 2014 Change 'player' to 'source'. EDIT: +I would use onPlayerSpawn, otherwise it won't work. Link to comment
OrbTanT Posted July 20, 2014 Author Share Posted July 20, 2014 Thank you, now it is working, i it had tested using "source", more I think because of onPlayerWasted was not working. one more thing, How can I set the amount of ammunition of weapons in this script? Link to comment
Et-win Posted July 20, 2014 Share Posted July 20, 2014 giveWeapon Click on it and read the wiki. I already clearly said it in the code where to put it all. Link to comment
OrbTanT Posted July 20, 2014 Author Share Posted July 20, 2014 I had forgotten this part of "giveWeapon" '-' thanks for the help 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