Jump to content

setPedStat


Plate

Recommended Posts

Hola necesito una ayuda con este script

me dice bad Argument @ setPedStat

addEventHandler("onPlayerWasted", root, 
    function() 
        local weapons = convertWeaponsToJSON(source) 
        setElementData(source,"tempWeapons",weapons) 
        local s69 = getPedStat(source, 69) 
        local s70 = getPedStat(source, 70) 
        local s71 = getPedStat(source, 71) 
        local s72 = getPedStat(source, 72) 
        local s73 = getPedStat(source, 73) 
        local s74 = getPedStat(source, 74) 
        local s75 = getPedStat(source, 75) 
        local s76 = getPedStat(source, 76) 
        local s77 = getPedStat(source, 77) 
        local s78 = getPedStat(source, 78) 
    end 
) 
  
addEventHandler("onPlayerSpawn", root, 
    function () 
        local weapons = getElementData(source,"tempWeapons") 
        if (weapons) then 
            giveWeaponsFromJSON(source, weapons) 
            setPedStat(source, 69, s69) 
            setPedStat(source, 70, s70) 
            setPedStat(source, 71, s71) 
            setPedStat(source, 72, s72) 
            setPedStat(source, 73, s73) 
            setPedStat(source, 74, s74) 
            setPedStat(source, 75, s75) 
            setPedStat(source, 76, s76) 
            setPedStat(source, 77, s77) 
            setPedStat(source, 78, s78) 
        end 
    end 
) 
  
function convertWeaponsToJSON(player) 
    local weaponSlots = 12 
    local weaponsTable = {} 
    for slot=1, weaponSlots do 
        local weapon = getPedWeapon( source, slot ) 
        local ammo = getPedTotalAmmo( source, slot ) 
        if (weapon > 0 and ammo > 0) then 
            weaponsTable[weapon] = ammo 
        end 
    end 
    return toJSON(weaponsTable) 
end 
  
function giveWeaponsFromJSON(player, weapons) 
    if (weapons and weapons ~= "") then 
        for weapon, ammo in pairs(fromJSON(weapons)) do 
            if (weapon and ammo) then 
                giveWeapon(player, tonumber(weapon), tonumber(ammo)) 
            end 
        end 
    end 

Link to comment

creo que tiene toda la razon el unico error que le veo yo es que le falta un "end" en essa funcion que dice... revisalo

    addEventHandler("onPlayerWasted", root, 
        function() 
            local weapons = convertWeaponsToJSON(source) 
            setElementData(source,"tempWeapons",weapons) 
            local s69 = getPedStat(source, 69) 
            local s70 = getPedStat(source, 70) 
            local s71 = getPedStat(source, 71) 
            local s72 = getPedStat(source, 72) 
            local s73 = getPedStat(source, 73) 
            local s74 = getPedStat(source, 74) 
            local s75 = getPedStat(source, 75) 
            local s76 = getPedStat(source, 76) 
            local s77 = getPedStat(source, 77) 
            local s78 = getPedStat(source, 78) 
        end 
    ) 
      
    addEventHandler("onPlayerSpawn", root, 
        function () 
            local weapons = getElementData(source,"tempWeapons") 
            if (weapons) then 
                giveWeaponsFromJSON(source, weapons) 
                setPedStat(source, 69, s69) 
                setPedStat(source, 70, s70) 
                setPedStat(source, 71, s71) 
                setPedStat(source, 72, s72) 
                setPedStat(source, 73, s73) 
                setPedStat(source, 74, s74) 
                setPedStat(source, 75, s75) 
                setPedStat(source, 76, s76) 
                setPedStat(source, 77, s77) 
                setPedStat(source, 78, s78) 
            end 
        end 
    ) 
      
    function convertWeaponsToJSON(player) 
        local weaponSlots = 12 
        local weaponsTable = {} 
        for slot=1, weaponSlots do 
            local weapon = getPedWeapon( source, slot ) 
            local ammo = getPedTotalAmmo( source, slot ) 
            if (weapon > 0 and ammo > 0) then 
                weaponsTable[weapon] = ammo 
            end 
        end 
        return toJSON(weaponsTable) 
    end 
      
    function giveWeaponsFromJSON(player, weapons) 
        if (weapons and weapons ~= "") then 
            for weapon, ammo in pairs(fromJSON(weapons)) do 
                if (weapon and ammo) then 
                    giveWeapon(player, tonumber(weapon), tonumber(ammo)) 
                end -- para el if 
            end  -- para el for 
        end   --  para el if     
    end  -- para la function 

Link to comment
  • Recently Browsing   0 members

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