MTA Team 0xCiBeR Posted May 27, 2013 MTA Team Share Posted May 27, 2013 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
Castillo Posted May 27, 2013 Share Posted May 27, 2013 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
MTA Team 0xCiBeR Posted May 27, 2013 Author MTA Team Share Posted May 27, 2013 POrque el -1 en el string solid? Link to comment
Castillo Posted May 27, 2013 Share Posted May 27, 2013 Vi que en tu script tenias: "rango1" y "rango2" como comandos y en el script ponias 0 y 1, asi que supuse que necesitaba ser -1. Link to comment
MTA Team 0xCiBeR Posted May 27, 2013 Author MTA Team Share Posted May 27, 2013 Ah nono, igual gracias jeje Link to comment
MTA Team 0xCiBeR Posted May 27, 2013 Author MTA Team Share Posted May 27, 2013 Y para hacer que solo tenga que meter una parte de el nombre? Link to comment
MTA Team 0xCiBeR Posted May 29, 2013 Author MTA Team Share Posted May 29, 2013 No funciona solid.. Link to comment
Recommended Posts