addEventHandler('onPlayerQuit', root,
function ()
if not (isGuestAccount (getPlayerAccount (source))) then
local weapons = toJSON (getPedWeapons(source))
setAccountData(getPlayerAccount(source),'weapons',weapons)
end
end)
addEventHandler('onPlayerLogin', root,
function ()
if not (isGuestAccount (getPlayerAccount (source))) then
local weapons = getAccountData(getPlayerAccount(source),'weapons')
for i,v in pairs (fromJSON(weapons)) do
giveWeapon(source,i,v,true)
end
end)
weaponS = {[22] = 69,[23] = 70,[24] = 71,[25] = 72,[26] = 73,[27] = 74,[28] = 75,
[29] = 76,[30] = 77,[31] = 78,[34] = 79
}
-- Gets all player weapons
function getPedWeapons(ped)
local weapons = {}
for slot=1, 12 do
local weapon = getPedWeapon(ped, slot)
local ammo = getPedTotalAmmo(ped, slot)
if (weapon > 0) and (ammo > 0) then
weapons[weapon] = ammo
end
end
return weapons
end