Jump to content

Table Weapon


OrbTanT

Recommended Posts

Posted

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 
} 

Posted
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 :)

Posted

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) 

Posted

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?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...