Jump to content

Team marker restriction


FraRyder

Recommended Posts

Hi. I don't know how to set a restriction to the marker that opens my gate. I tried but none of my attemps works... Can someone help me, please? I want the gate will open only if a player in the marker is in the team "myTeam".

local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) 
  
function opengatep() 
    moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 )     
end 
  
function closegatep() 
    moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) 
end 
  
cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 255, 0) 
    
addEventHandler("onMarkerHit", cancello, opengatep) 
addEventHandler("onMarkerLeave", cancello, closegatep) 

excuse for my bad english :?

Link to comment

i believe there is no reason to stop it from working.

Good luck 8)

local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) 
  
function opengatep() 
    if not ( getPlayerTeam( thePlayer ) ) == false then 
    if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then 
    moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 )   
    end  
    end 
end 
  
function closegatep() 
    if not ( getPlayerTeam( thePlayer ) ) == false then 
    if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then 
    moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) 
    end 
    end 
end 
  
cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 255, 0) 
    
addEventHandler("onMarkerHit", cancello, opengatep) 
addEventHandler("onMarkerLeave", cancello, closegatep) 

Link to comment

Thank you but the gate opens when any person passes through the marker... however i can use your script for other restrictions, thank you anyway! :)

Edit: I am headless ._. I thought i was working with another gate. Excuse me... :|

This gate doesn't open when i pass through the marker

Edited by Guest
Link to comment

I tried... now the console doesn't says there are problem in the script, but the gate doesn't opens

local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) 
  
function opengatep() 
    if getElementType(source) == "player" then 
    if not ( getPlayerTeam( thePlayer ) ) == false then 
    if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then 
    moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 )   
    end  
    end 
end 
end 
  
function closegatep() 
    if getElementType(source) == "player" then 
    if not ( getPlayerTeam( thePlayer ) ) == false then 
    if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then 
    moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) 
    end 
    end 
end 
end 
  
cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 150, 150) 
    
addEventHandler("onMarkerHit", cancello, opengatep) 
addEventHandler("onMarkerLeave", cancello, closegatep) 

Link to comment

You made it even worse than before lol.

local gate = createObject(976, -1534.7, 482, 6.32, 0, 0, 0) 
  
function opengatep(thePlayer) 
    if getElementType(thePlayer) == "player" then 
        local team = getPlayerTeam(thePlayer) 
        if team and getTeamName(team) == "myTeam" then 
            moveObject(gate, 2000, -1544, 482, 6.32, 0, 0, 0)   
        end 
    end 
end 
  
function closegatep(thePlayer) 
    if getElementType(thePlayer) == "player" then 
        local team = getPlayerTeam(thePlayer) 
        if team and getTeamName(team) == "myTeam" then 
            moveObject(gate, 2000, -1534.7, 482, 6.32, 0, 0, 0) 
        end 
    end 
end 
  
cancello = createMarker(-1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 150, 150) 
    
addEventHandler("onMarkerHit", cancello, opengatep) 
addEventHandler("onMarkerLeave", cancello, closegatep) 

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