Jump to content

ayuda


~P0W3R~

Recommended Posts

intenta con esto :P dime si no te funciona es que no estoy seguro que si es tonumber o tostring :P

  
addEventHandler("onPlayerWasted", getRootElement(),  
function() 
getSkin = getElementModel( source ) 
getArmas = getPedWeapon( source ) 
getAmmo = getPedTotalAmmo( source ) 
end 
) 
  
addEventHandler("onPlayerSpawn", getRootElement(),  
function() 
setElementModel( source, tonumber(getSkin) ) 
giveWeapon( source, tonumber(getArmas), tonumber(getAmmo) ) 
end 
)  

Link to comment
intenta con esto :P dime si no te funciona es que no estoy seguro que si es tonumber o tostring :P
  
addEventHandler("onPlayerWasted", getRootElement(),  
function() 
getSkin = getElementModel( source ) 
getArmas = getPedWeapon( source ) 
getAmmo = getPedTotalAmmo( source ) 
end 
) 
  
addEventHandler("onPlayerSpawn", getRootElement(),  
function() 
setElementModel( source, tonumber(getSkin) ) 
giveWeapon( source, tonumber(getArmas), tonumber(getAmmo) ) 
end 
)  

Eso no tiene sentido, son variables globales en un script server side, ademas, solo estas obteniendo un arma.

local tempData = { } 
  
addEventHandler ( "onPlayerWasted", getRootElement(), 
    function ( ) 
        tempData [ source ] = 
            { 
                weapons = getWeaponsTable ( source ), 
                skin = getElementModel ( source ) 
            } 
    end 
) 
  
addEventHandler ( "onPlayerSpawn", getRootElement(), 
    function ( ) 
        if ( tempData [ source ] ) then 
            setElementModel ( source, tempData [ source ].skin ) 
            for weapon, ammo in pairs ( tempData [ source ].weapons ) do 
                giveWeapon ( source, weapon, ammo, true ) 
            end 
        end 
    end 
) 
  
function getWeaponsTable ( thePlayer ) 
    local weapons = { } 
    local hasAnyWeapon = false 
    for slot = 0, 12 do 
        local weapon = getPedWeapon ( thePlayer, slot ) 
        if ( weapon > 0 ) then 
            local ammo = getPedTotalAmmo ( thePlayer, slot ) 
            if ( ammo > 0 ) then 
                weapons [ weapon ] = ammo 
                hasAnyWeapon = true 
            end 
        end 
    end 
    if ( hasAnyWeapon ) then 
        return weapons 
    end 
end 

Link to comment
  • Recently Browsing   0 members

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