CowTurbo Posted March 2, 2011 Share Posted March 2, 2011 how to get player all weapons what he got ? Link to comment
Dre-+- Posted March 2, 2011 Share Posted March 2, 2011 how to get player all weapons what he got ? getPedWeapon(player,slot) For all weapons: function giveAllPedWeaposn(player) local playerWeapons = {} for sl = 0,12 do local weap = getPedWeapon(player,sl) if weap == 0 then else table.insert(playerWeapons,weap) end end return playerWeapons end Its function returns all ped weapons in table Link to comment
Arran Posted March 2, 2011 Share Posted March 2, 2011 This is how deathpickups does it: local droppedWeapons = {} local weaponSlots = {0,1,2,3,4,5,6,7,8,9,10,11,12} for i, slot in ipairs(weaponSlots) do local ammo = getPedTotalAmmo ( localPlayer, slot ) if ( getPedWeapon ( localPlayer, slot ) ~= 0 ) then local weapon = getPedWeapon ( localPlayer, slot ) local ammo = getPedTotalAmmo ( localPlayer, slot ) table.insert(droppedWeapons, {weapon, ammo}) end end Even better now: local droppedWeapons = {} for slot=0, 12 do local ammo = getPedTotalAmmo(source, slot) if (getPedWeapon(source, slot) ~= 0) then local weapon = getPedWeapon(source, slot) local ammo = getPedTotalAmmo(source, slot) table.insert(droppedWeapons, {weapon, ammo}) end end 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