Jump to content

Ajuda com blips Team


Recommended Posts

playerBlips = { }
function oi ()
for index,value in ipairs(getElementsByType("player")) do
if( playerBlips [ value ] ) then
destroyElement( playerBlips[ value ] )
		playerBlips [ value ] = nil
end
	playerBlips[ value ] = createBlipAttachedTo ( value, 0,2,130,10,230)	
setElementVisibleTo(playerBlips[value],getRootElement( ),false)
 
if(getTeamName(getPlayerTeam(value)) == "Preto") then
for index1,value1 in ipairs(getElementsByType("player")) do
if(getTeamName(getPlayerTeam(value1)) == "Preto") then
setElementVisibleTo(playerBlips[value],value1,true)
end	
end
elseif(getTeamName(getPlayerTeam(value)) == "Colorido") then
for index1,value1 in ipairs(getElementsByType("player")) do
if(getTeamName(getPlayerTeam(value1)) == "Colorido") then
setElementVisibleTo(playerBlips[value],value1,true)
end	
end
elseif(getTeamName(getPlayerTeam(value)) == "ForaPvP") then
for index1,value1 in ipairs(getElementsByType("player")) do
if(getTeamName(getPlayerTeam(value1)) == "ForaPvP") then
setElementVisibleTo(playerBlips[value],value1,true)
end	
end
end
end	
end
addEventHandler("onElementModelChange",getRootElement(),oi)

O recurso funciona na seguinte forma: Os Blip só são visíveis para cada time. 

O team "ForaPvp" são os que morreram... daí o que acontece é que quando o jogador morre o blip do time que ele estava continua visível, exemplo: o time Preto.

Queria que quando o player morresse ele só conseguir ver o Blip dos cara que ta no team ForaPvP.

Edit: Server-Side

Edited by Ragnar
Link to comment
playerBlips = { }
function oi ()
	for index,value in ipairs(getElementsByType("player")) do
		if( playerBlips [ value ] ) then
			destroyElement( playerBlips[ value ] )
			playerBlips [ value ] = nil
		end
		playerBlips[ value ] = createBlipAttachedTo ( value, 0,2,130,10,230)
		setElementVisibleTo(playerBlips[value],getRootElement( ),false)
		
		if (getPlayerTeam(value)) then
			for _, p in ipairs(getPlayersInTeam(getPlayerTeam(value))) do
				setElementVisibleTo(playerBlips[value],p,true)
			end
		end
	end
end	
addEventHandler("onElementModelChange",getRootElement(),oi)

 

Edited by MaligNos
  • Thanks 1
Link to comment

Quando troco de skin pelo F1 ou pelo Pickup no mapa, ele seta o blip, mas quando morre o blip continua, ele não reconhece que skin foi alterada depois de morto.

Teria que ser função onClientRender só que pra server-side?

edit: Quando o Jogador sai do server, o blip continua lá também.

Edited by Ragnar
Link to comment
  • Moderators
function player_WastedOrQuit()
	if playerBlips[ source ] then
		destroyElement(playerBlips[ source ]) 
		playerBlips[source] = nil
	end
end 
addEventHandler("onPlayerQuit", root, player_WastedOrQuit)
addEventHandler("onPlayerWasted", root, player_WastedOrQuit)

 

  • Thanks 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...