Jump to content

The function will work properly?


rE5vK8bu

Recommended Posts

  
--table 
weaponInfo = { 
    {name = "M4",id = 31,slot = 5,ammo = "M4 Mag",mag_size = 30,damage = 5000,model = 356,new_model = 1241,is_sniper = false}, 
    {name = "Sniper",id = 34,slot = 6,ammo = "Sniper Mag",mag_size = 10,damage = 5000,model = 358,new_model = 1252,is_sniper = 1252}, 
} 
  
--function 
function getWeaponInfo(item) 
    for _,v in ipairs(weaponInfo)do 
        if item == v.name then 
            return v.name,v.id,v.slot,v.ammo,v.mag_size,v.damage,v.model,v.new_model,v.is_sniper 
        end 
    end 
end 
  

The function will work if I use the script that way in a function? in disarray?

local name,slot,mag_size,ammo = getWeaponInfo(currentweapon) 

Link to comment

What is currentweapon?

If it's the name, why are you returning the name?

You use return v.name (1), v.id (2), v.slot (3), v.ammo (4), v.mag_size (5) ...

But you use:

local name (1), slot (3), mag_size (5), ammo (4) 

The order is totally wrong.

Link to comment

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...