function getPedWeapons(ped)
ammoPlayer={}
playerWeapons = {}
for i=2,9 do
local amo=getPedAmmoInClip ( source,i)
if amo and amo ~= 0 then
table.insert(ammoPlayer,amo)
setAccountData( getPlayerAccount ( source ),"ammo",amo)
end
end
for i=2,9 do
local wep = getPedWeapon(source,i)
if wep and wep ~= 0 then
table.insert(playerWeapons,wep)
setAccountData( getPlayerAccount ( source ),"weapons",wep)
end
else
return false
end
return playerWeapons
end
addEventHandler("onPlayerQuit",root,getPedWeapons)
addEventHandler("onPlayerWasted",root,getPedWeapons)
function poi()
wapon=getAccountData( getPlayerAccount ( source ),"weapons")
aimo=getAccountData( getPlayerAccount ( source ),"ammo")
for i,wapon in ipairs(playerWeapons) do
giveWeapon ( source, wapon,aimo)
end
end
addEventHandler("onPlayerLogin",root,poi)
addEventHandler("onPlayerSpawn",root,poi)
i just give up, can anyone help me in this code, the problem is with the ammo