Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
448 B
2
Indexable
Never

--save beim 'onPlayerQuit' event handler
function getPlayerWeapons( p )
    local weps={}
    for i=1,12 do
        weps[i]={getPedWeapon( p, i ),getPedTotalAmmo( p, i )}
    end
    return toJSON(weps)
end



--load beim 'playerConnecting' event handler
local weaponTable = fromJSON(d.weapons)
for i=1,12 do
    local row = weaponTable[i]
    if tonumber(row[2]) > 0 then
        giveWeapon( plr, row[1], row[2] )
    end
end