Jump to content

help-me getPlayerTeam


LucasBaker

Recommended Posts

Hello , I would like the marker to appear only for the team but who is this giving an error that I am unable to resolve the following code :

lixo1 = createMarker(1516.41675, -1847.13733, 13.54688, 'cylinder', 2, 255, 0, 0, 150) 
  
function aLixeiro (source) 
    outputChatBox("Você pegou o lixo na casa!", source, 255, 0, 0) 
    givePlayerMoney ( source, 50 ) 
    setElementPosition( lixo1, 0, 0, 0 ) 
    setTimer(function() 
        setElementPosition( lixo1, 1516.41675, -1847.13733, 13.54688 ) 
    end,2000,1) 
end 
addEventHandler( "onMarkerHit", lixo1, aLixeiro )  
  
function onStart(source) 
if getTeamName(getPlayerTeam(source)) == "Lixeiros" then 
        local playerTeam = getPlayerTeam ( source ) 
    local blip = createBlipAttachedTo( lixo1, 51, 2, 255, 0, 0, 255, 255, 255 ) 
    setElementVisibleTo ( lixo1, playerTeam, true ) 
    setElementVisibleTo ( blip, playerTeam, true ) 
    setElementVisibleTo ( lixo1, root, false ) 
    setElementVisibleTo ( blip, root, false ) 
   end 
end 
addEventHandler( "onMarkerHit", getRootElement(), onStart ) 

Link to comment
Just think about it. If you first set it visible to one player and then false for root. That player is children of root so it will not show. Set it first false to root then true for player. Same for blip
   setElementVisibleTo ( lixo1, playerTeam, true ) 
    setElementVisibleTo ( blip, playerTeam, true ) 
    setElementVisibleTo ( lixo1, root, false ) 
    setElementVisibleTo ( blip, root, false ) 

like this ?

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