Jump to content

Help with locking gates/markers to TEAM


squar

Recommended Posts

Posted
local pMarker = createMarker ( -1770.5, 984.9, 21.6, 10 ) 
local pGate = createObject ( 980, -1770.60, 985, 25.1, 0, 0, 90 ) 
setMarkerSize ( pMarker, 10.0 ) 
setElementVisibleTo ( pMarker, getRootElement (), false ) 
  
function markerManager() 
        local team = getPlayerTeam ( thePlayer ) 
        if getTeamName(team) == "Admin" then 
            moveObject ( pGate, 980, -1770.60, 996, 25.1, 0, 0, 0 ) 
        else 
            moveObject( pGate, 980, -1770.60, 985, 25.1, 0, 0, 0 )    
    end             
end 
addEventHandler( 'onMarkerHit', pMarker, markerManager ) 
addEventHandler( 'onMarkerLeave', pMarker, markerManager ) 

Im using getPlayerTeam. I tried without it, and the gate opened and closed like it should. When i tried to add team lock, it doesnt work. Anyone sees the problem?

Posted

There is no "thePlayer" variable.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
local pMarker = createMarker ( -1770.5, 984.9, 21.6, 10 ) 
local pGate = createObject ( 980, -1770.60, 985, 25.1, 0, 0, 90 ) 
setMarkerSize ( pMarker, 10.0 ) 
setElementVisibleTo ( pMarker, getRootElement (), false ) 
  
function markerManager(thePlayer) 
        local theTeam = getPlayerTeam ( thePlayer ) 
        if getTeamName(theTeam) == "Admin" then 
            moveObject ( pGate, 980, -1770.60, 996, 25.1, 0, 0, 0 ) 
        else 
            moveObject( pGate, 980, -1770.60, 985, 25.1, 0, 0, 0 )   
    end             
end 
addEventHandler( 'onMarkerHit', pMarker, markerManager ) 
addEventHandler( 'onMarkerLeave', pMarker, markerManager ) 

n-560x95_E60303_FFFFFF_030303_FF0303.png
Posted

Thank you guys, for helping and that short reply time. I just had to connect onMarkerLeave a little bit different, but it worked perfectly!

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