Jump to content

Open gates for more teams


Gtagasje

Recommended Posts

I have made a script ( with help ) of gates, which will open if you are on the team AirForce.

But now I wan't it to open for the teams AirForce and Army.

Can somebody help me please? this is what I have: (P.S. it's only open gate, not the move back)

  
local ingang1 = createObject ( 980, -1907.9000244141, 2172.8999023438, 3.2000000476837, 0, 0, 0 ) 
  
function moveGate1 ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and  getPlayerTeam ( hitElement ) ==getTeamFromName( "AirForce") then 
        moveObject ( ingang1, 3000, -1907.9000244141, 2172.8999023438, 9 ) 
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 
  

Ps, ingang1 means entrace1

Link to comment

You don't have a marker from onMarkerHit event.

  
local ingang1 = createObject(980, -1907.9000244141, 2172.8999023438, 3.2000000476837, 0, 0, 0) 
local ingangmarker = createMarker(-1907.9000244141, 2172.8999023438, 3.2000000476837, "cylinder", 5, 0, 0, 0, 0) 
  
function moveGate1(hitElement, matchingDimension) 
    local airForce = getPlayerTeam(hitElement) == getTeamFromName("AirForce") 
    local army = getPlayerTeam(hitElement) == getTeamFromName("Army") 
     
    if getElementType(hitElement) == "player" then 
        if airForce or army then 
            moveObject(ingang1, 3000, -1907.9000244141, 2172.8999023438, 9) 
        end 
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 
  

Edited by Guest
Link to comment

That was not his question, I guess this is a part of his script.

local ingang1 = createObject ( 980, -1907.9000244141, 2172.8999023438, 3.2000000476837, 0, 0, 0 ) 
local teams = {["AirForce"] = true, ["Army"] = true}  
  
function moveGate1 ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and getPlayerTeam ( hitElement ) and teams[getTeamName(getPlayerTeam ( hitElement ))] then 
        moveObject ( ingang1, 3000, -1907.9000244141, 2172.8999023438, 9 ) 
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 

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