Jump to content

UNa ayuda con imagenes


0xCiBeR

Recommended Posts

  • MTA Team

Bueno necesito ayuda con mi sistema de medallitas en el score..Hasta ahora tengo esto:

exports.scoreboard:addScoreboardColumn('Rango',getRootElement(),1,10,'Rango') 
addCommandHandler ( "rango1", 
function (player) 
setElementData ( player, "Rango", "" ) 
setElementData ( player, "Rango", ":PDz_ranks/rangos/0.png" ) 
end 
) 
  
addCommandHandler ( "rango2", 
function (player) 
setElementData ( player, "Rango", "" ) 
setElementData ( player, "Rango", ":PDz_ranks/rangos/1.png" ) 
end 
) 
  
addCommandHandler ( "rangopdz", 
function (player) 
setElementData ( player, "Rango", "" ) 
setElementData ( player, "Rango", ":PDz_ranks/rangos/202.png" ) 
end 
) 
  
--Guardado de medallas 
  
function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
           local rangos = getElementData(source,"Rango") 
            setAccountData ( playeraccount, "Rango", rangos ) 
      end 
end 
  
function onPlayerLogin ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            local rangos = getAccountData ( playeraccount, "Rango" ) 
            if ( rangos ) then 
            setElementData ( source, "Rango", rangos ) 
            end 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerLogout", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) 

Como armo para que con 1 solo comando como ser: /medalla (nombre del player) (numero de la medalla)

Le setee la medalla..Imagino que con tablas pero como?

Link to comment
exports.scoreboard:addScoreboardColumn('Rango',getRootElement(),1,10,'Rango') 
  
addCommandHandler ( "rango", 
    function ( player, _, who, rank ) 
        local playerWho = getPlayerFromName ( who ) 
        if ( playerWho ) then 
            local rank = tonumber ( rank ) 
            if ( rank ) then 
                setElementData ( playerWho, "Rango", ":PDz_ranks/rangos/".. tostring ( rank - 1 ) ..".png" ) 
            end 
        end 
    end 
) 
  
addCommandHandler ( "rangopdz", 
    function ( player ) 
        setElementData ( player, "Rango", "" ) 
        setElementData ( player, "Rango", ":PDz_ranks/rangos/202.png" ) 
    end 
) 
  
--Guardado de medallas  
function onPlayerQuit ( ) 
    local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) then 
        local rangos = getElementData(source,"Rango") 
        setAccountData ( playeraccount, "Rango", rangos ) 
    end 
end 
  
function onPlayerLogin ( ) 
    local playeraccount = getPlayerAccount ( source ) 
    if ( playeraccount ) then 
        local rangos = getAccountData ( playeraccount, "Rango" ) 
        if ( rangos ) then 
            setElementData ( source, "Rango", rangos ) 
        end 
    end 
end 
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerLogout", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) 

Link to comment
  • Recently Browsing   0 members

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