Jump to content

Get ped/player weapons and return a table with them


Recommended Posts

function getPlayerWeapons(player) 
local weaponsTable = {} 
    for index=0, 13 do 
        local weapon = getPedWeapon(player,index) 
        local ammo = getPedTotalAmmo(player,index) 
        if ammo > 0 then 
            table.insert(weaponsTable, {weapon, ammo}) 
        end 
    end 
return weaponsTable 
end 

Should return a table of weapons (weapon model, ammo).

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