-- by Solidsnake14.
local playerWeapons = { }
addEventHandler ( "onPlayerWasted", root,
function ( )
if ( not playerWeapons [ source ] ) then
playerWeapons [ source ] = { }
end
for slot = 0, 12 do
local weapon = getPedWeapon ( source, slot )
if ( weapon > 0 ) then
local ammo = getPedTotalAmmo ( source, slot )
if ( ammo > 0 ) then
playerWeapons [ source ] [ weapon ] = ammo
end
end
end
end
)
addEventHandler ( "onPlayerSpawn", root,
function ( )
if ( playerWeapons [ source ] ) then
for weapon, ammo in pairs ( playerWeapons [ source ] ) do
giveWeapon ( source, tonumber ( weapon ), tonumber ( ammo ) )
end
end
playerWeapons [ source ] = nil
end
)