#Silvery' Posted May 3, 2014 Posted May 3, 2014 ¿ alguna forma para obtener cuantos jugadores mato y cuantas murio ? es para hacer un dxscoreboard , Saludos ! Gracias anticipado .
alex17 Posted May 3, 2014 Posted May 3, 2014 prueva con esto aver si te sirve D: server.lua addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) if killer then local account = getPlayerAccount ( killer ) if killer ~= source then setAccountData( account,"totalkillsdeaths.Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData( killer, "Kills", tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"totalkillsdeaths.Deaths",tonumber( getAccountData(accountSource,"totalkillsdeaths.Deaths") or 0 ) +1 ) setElementData( source, "Deaths", tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) local account = getPlayerAccount ( source ) if not getAccountData( account,"totalkillsdeaths.Kills" ) and not getAccountData( account,"totalkillsdeaths.Deaths" ) then setAccountData( account,"totalkillsdeaths.Kills",0 ) setAccountData( account,"totalkillsdeaths.Deaths",0 ) end setElementData( source,"Deaths",tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) setElementData( source,"Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) ) end ) addEventHandler( "onResourceStart",resourceRoot, function( ) outputDebugString( "add Total Kills to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "Kills",root,2, 0.07 ) ) ) outputDebugString( "add Total Deaths to scoreboard Return: "..tostring( call( getResourceFromName("Scoreboard"), "addScoreboardColumn", "Deaths",root,3, 0.09 ) ) ) end )
#Silvery' Posted May 3, 2014 Author Posted May 3, 2014 ¿ alguna forma para obtener cuantos jugadores mato y cuantas murio ? es para hacer un dxscoreboard , Saludos ! Gracias anticipado . no use todas las funciones que usan el scoreboard que te viene petrerminado , hice uno desde 0 , solo con getPlayerName , getPlayerPing etc... no me sirvio pero gracias igualmente dxText , dxRec y todo eso ya sabes...
alex17 Posted May 3, 2014 Posted May 3, 2014 mmm usted tiene su propio scoreboard desde cero si posteas tu codigo tal ves podria ayudarte
#Silvery' Posted May 3, 2014 Author Posted May 3, 2014 esto es una parte donde agrego todas las columnas con dxDrawText , pensaba que podria hacer un getPlayerKills y un getPlayersDeaths , pero que lastima hubiera estado bueno eso... dxDrawText(getPlayerName(player), nombre, posX+posY*20) dxDrawText(getPlayerTeam(player) and getTeamName(getPlayerTeam(player)) or "None", team, posX+posY*20) dxDrawText(getPlayerMoney(player), dinero, posX+posY*20) dxDrawText(getPlayerPing(player), ping, posX+posY*20)
alex17 Posted May 3, 2014 Posted May 3, 2014 puedes utlizar el codigo que te di addEventHandler ( "onPlayerWasted", root, function( totalAmmo, killer, killerWeapon, bodypart, stealth ) if killer then local account = getPlayerAccount ( killer ) if killer ~= source then setAccountData( account,"totalkillsdeaths.Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) +1 ) setElementData( killer, "Kills", tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) ) ) end else local accountSource = getPlayerAccount ( source ) setAccountData( accountSource,"totalkillsdeaths.Deaths",tonumber( getAccountData(accountSource,"totalkillsdeaths.Deaths") or 0 ) +1 ) setElementData( source, "Deaths", tonumber( getAccountData( accountSource,"totalkillsdeaths.Deaths" ) ) ) end end ) addEventHandler( "onPlayerLogin",root, function( thePreviousAccount, theCurrentAccount, autoLogin ) local account = getPlayerAccount ( source ) if not getAccountData( account,"totalkillsdeaths.Kills" ) and not getAccountData( account,"totalkillsdeaths.Deaths" ) then setAccountData( account,"totalkillsdeaths.Kills",0 ) setAccountData( account,"totalkillsdeaths.Deaths",0 ) end setElementData( source,"Deaths",tonumber( getAccountData( account,"totalkillsdeaths.Deaths" ) or 0 ) ) setElementData( source,"Kills",tonumber( getAccountData( account,"totalkillsdeaths.Kills" ) or 0 ) ) end ) y para añadirlo a tu escoreboard puedes utilizar esto como ejemplo dxDrawText(getElementData(player, "Kills"), Kills, posX+posY*20) dxDrawText(getElementData(player, "Deaths"), Deaths, posX+posY*20)
#Silvery' Posted May 3, 2014 Author Posted May 3, 2014 gracias alex ^^ , otra duda como hago para obtener el color de los jugadores
Jacobob14 Posted May 3, 2014 Posted May 3, 2014 a qe te refieres con el color de los jugadores al nametag ? local r, g, b = getPlayerNametagColor ( player )
#Silvery' Posted May 3, 2014 Author Posted May 3, 2014 dxDrawText(getPlayerName(player), Nombre, posX+posY*20) lo tengo haci ¿como lo podria de poner ?
Tomas Posted May 3, 2014 Posted May 3, 2014 [/lua]lo tengo haci ¿como lo podria de poner ? local r, g, b = getPlayerNametagColor ( player ) dxDrawText(getPlayerName(player), Nombre, posX+posY*20, tocolor ( r, g, b, 255 ))
alex17 Posted May 3, 2014 Posted May 3, 2014 añado por si no quieres que se vea el color hexadecimal D: local r, g, b = getPlayerNametagColor ( player ) dxDrawText(getPlayerName(player), Nombre, posX+posY*20, tocolor ( r, g, b, 255), false,false,false,true)
Tomas Posted May 3, 2014 Posted May 3, 2014 y en que parte defines el color del texto ? No es extremamente obligatorio definir el color en DX. Es un Argumento Secundario
#Silvery' Posted May 4, 2014 Author Posted May 4, 2014 Gracias a todos ya funciono. OFFTopic: aca con tomi pal foro x3
alex17 Posted May 4, 2014 Posted May 4, 2014 no hay problema que bueno que hayas solucionado tus problemas D: PD: lol no tiene cabeza tu skin en la foto e_e
Tomas Posted May 4, 2014 Posted May 4, 2014 Gracias a todos ya funciono.OFFTopic: aca con tomi pal foro x3 De nada y pos, que secsi soy
Recommended Posts