Jump to content

[APORTE]{Server} Guardar armas al morir (Optimizado)


Recommended Posts

Bastante util para los servidores freeroam xD

local data = {} 
  
function guardar () 
data[source] = {} 
    for ID=0, 12 do 
    local WEAP = getPedWeapon(source, ID) 
        if WEAP then 
            if WEAP >= 1 then 
            local AMMO = getPedTotalAmmo(source, ID) 
                if AMMO >= 1 then 
                data[source][ID] = {tonumber(WEAP), tonumber(AMMO)} 
                end 
            end 
        end 
    end 
end 
addEventHandler("onPlayerWasted", root, guardar) 
function cargar () 
    if data[source] ~= nil then 
        for ZK=0, 12 do 
            if data[source][ZK] ~= nil then 
            giveWeapon(source, data[source][ZK][1], data[source][ZK][2], false) 
            end 
        end 
    end 
end 
addEventHandler("onPlayerSpawn", root, cargar) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...