Jump to content

Criar blip específico


Recommended Posts

local blip = {}

function createPlayerBlip(player)
	if not player or not isElement(player) or getElementType(player) ~= "player" then 
		return false 
	end
	
	local playerTeam = getPlayerTeam(player)
	blip[player] = createBlipAttachedTo(player, 0, 2, 255, 255, 255, 255)
end

Olá,  queria saber uma forma eficiente de criar/mostrar o blip somente entre jogadores do team

Link to comment
10 hours ago, MaligNos said:

setElementVisibleTo(blip[player], root, false)
for _, teamMember in ipairs (getPlayersInTeam(playerTeam)) do
	setElementVisibleTo(blip[player], teamMember, true)
end

 

function createPlayerBlip(player)
	if not player or not isElement(player) or getElementType(player) ~= "player" then 
		return false 
	end
	
	local playerTeam = getPlayerTeam(player)
	if playerTeam then
		if not blip[player] then
			blip[player] = createBlipAttachedTo(player, 0, 2, 255, 255, 255, 255)
			setElementVisibleTo(blip[player], root, false)
			for _, teamMember in ipairs (getPlayersInTeam(playerTeam)) do
				setElementVisibleTo(blip[player], teamMember, true)
			end
		end
	end
end

Tentei deste jeito e não funcionou, estou criando o blip no evento onResourceStart e onPlayerLogin

Link to comment
42 minutes ago, MainSCR said:

function createPlayerBlip(player)
	if not player or not isElement(player) or getElementType(player) ~= "player" then 
		return false 
	end
	
	local playerTeam = getPlayerTeam(player)
	if playerTeam then
		if not blip[player] then
			blip[player] = createBlipAttachedTo(player, 0, 2, 255, 255, 255, 255)
			setElementVisibleTo(blip[player], root, false)
			for _, teamMember in ipairs (getPlayersInTeam(playerTeam)) do
				setElementVisibleTo(blip[player], teamMember, true)
			end
		end
	end
end

Tentei deste jeito e não funcionou, estou criando o blip no evento onResourceStart e onPlayerLogin

@MaligNos desculpe, funcionou sim, eu que estava testando com o freeroam ligado .-.

Muito obrigado pela ajuda.

  • Like 1
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...