Jump to content

Ayuda con jugadores en una dimension |AYUDA|


ProNigth

Recommended Posts

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
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

este funciono pero solo quiero que los de la dimension 10 vean ese dxDrawText ya que lo ven todos de las demas dimensiones. 

  1. function dxDrawPlayers()
  2. local players = 0
  3. for k, player in ipairs(getElementsByType("player")) do
  4. local d = getElementDimension(player)
  5. local t = getPlayerTeam(player)
  6. if d == 10 and t and getTeamName(t) == "Vips" then
  7. players = players + 1
  8. end
  9. end
  10. dxDrawText("Jugadores : "..players, ........)
  11. end
  12. addEventHandler("onClientRender", root, dxDrawPlayers)
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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