Jump to content

'visibleto' problem


Tete omar

Recommended Posts

Posted

Hi , i've tried to make a blip visible to some team , and it's not working , here's the code

local playersInTeam=getPlayersInTeam(team) 
for i,v in ipairs(playersInTeam) do 
    blips[player]=createBlipAttachedTo(player,19,2,255,0,0,0,99999.0,v) 
end 

blips is a table and player is the (hitElement) of a timer in 'onColShapeHit' , i passed 'hitElement' to the timer, and team is defined as a team , but my problem is , when that blip is being to appear , it appears to all players , not just the players whose is into the 'team' , and if no player is in 'team' then the blip won't appears , any idea how to make that blip appears to the players whose is into the 'specific' team ?

Posted
local playersInTeam = getPlayersInTeam ( team ) 
blips [ player ] = createBlipAttachedTo ( player, 19, 2, 255, 0, 0, 0, 99999.0 ) 
setElementVisibleTo ( blips [ player ], root, false ) 
for _, player_ in ipairs ( playersInTeam ) do 
   setElementVisibleTo ( blips [ player ], player_, true ) 
end 

Try it.

Posted

Thanks , i tried to do the same with triggering to client , but didn't work

Here's the code

local daTeam=getPlayersInTeam(armyTeam) 
for i, v in ipairs(daTeam) do 
    triggerClientEvent(v,"alert!",v) 
end 

Posted

This is when element tree is very useful. When player joins a team set their parent as the team. Then you can use team element as visibleTo parameter and only players in that team will see the blips.

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