ProNigth Posted October 23, 2017 Share Posted October 23, 2017 Hola , primero que nada les contare lo que necesito, quiero que si me pueden ayudar hacer un script que me diga los jugadores que están dentro de un team en una dimension. quiero que me lo diga en outputChatBox. Por favor ayúdenme Link to comment
Rose Posted October 23, 2017 Share Posted October 23, 2017 (edited) ¿Quieres que al escribir, por ejemplo, /playersdim aparezca un outputChatBox con el nombre de los jugadores que están en un team y en otra dimensión? Edited October 23, 2017 by Rose Link to comment
ProNigth Posted October 23, 2017 Author Share Posted October 23, 2017 No No quiero que que salga en un text osea DrawText "1 jugador en la dimension" , pero que marque los jugadores que estan en la dimension 10 y en el team Vips Link to comment
alex17" Posted October 24, 2017 Share Posted October 24, 2017 1 hour ago, ProNigth said: No No quiero que que salga en un text osea DrawText "1 jugador en la dimension" , pero que marque los jugadores que estan en la dimension 10 y en el team Vips function dxDrawPlayers() local players = 0 for k, player in ipairs(getElementsByType("player")) do local d = getElementDimension(player) local t = getPlayerTeam(player) if d == 10 and t and getTeamName(t) == "Vips" then players = players + 1 end end dxDrawText("Jugadores : "..players, ........) end addEventHandler("onClientRender", root, dxDrawPlayers) Link to comment
MaurO^ Posted October 24, 2017 Share Posted October 24, 2017 5 hours ago, ProNigth said: no funciona Completa la función DxDrawText en el ejemplo que te dio alex y te funcionara. Link to comment
Arsilex Posted October 25, 2017 Share Posted October 25, 2017 function generateTeamsArray() local toDraw = {} for index, player in pairs(getElementsByType("player")) do local pTeam = getTeamName(getPlayerTeam(player)) or "Regular" local pDimenstion = getElementDimension(player) if toDraw[pDimenstion] then toDraw[pDimenstion][pTeam] = toDraw[pDimenstion][pTeam] and toDraw[pDimenstion][pTeam] + 1 or 1 else toDraw[pDimenstion] = {} toDraw[pDimenstion][pTeam] = toDraw[pDimenstion][pTeam] and toDraw[pDimenstion][pTeam] + 1 or 1 end end return toDraw end function drawDimensions() local arrayToDraw = generateTeamsArray() for index, dimension in pairs(arrayToDraw) do dxDrawText("Dimension:".. index, 10, 250, 100, 32, tocolor(150, 150, 150, 255), 1, "default-bold") for teamName, playersCount in pairs(dimension) do dxDrawText(teamName .. ": "..playersCount, 20, 250, 100, 32, tocolor(150, 150, 150, 255), 1, "default-bold") end end end Me aburría en clase así que hice esto.. no lo eh probado así que no se si funciona pero básicamente debería de dibujar algo como: Dimension: 1 VIP: 5 REGULAR: 1 Dimension: 2 VIP: 1 REGULAR: 2 Link to comment
ProNigth Posted November 1, 2017 Author Share Posted November 1, 2017 este funciono pero solo quiero que los de la dimension 10 vean ese dxDrawText ya que lo ven todos de las demas dimensiones. function dxDrawPlayers() local players = 0 for k, player in ipairs(getElementsByType("player")) do local d = getElementDimension(player) local t = getPlayerTeam(player) if d == 10 and t and getTeamName(t) == "Vips" then players = players + 1 end end dxDrawText("Jugadores : "..players, ........) end addEventHandler("onClientRender", root, dxDrawPlayers) Link to comment
Rose Posted November 1, 2017 Share Posted November 1, 2017 Mueve el dxDrawText abajo del players = players + 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now