Jump to content

Gate on team


SkullBreaker

Recommended Posts

Hi all, i am a beginner so my script doesn't work :|

i want to open (and close) a gate on a team onMarkerHit so this is what i got:

  
local ingang1 = createObject ( 980, 1602.099609375, -1613.099609375, 15.300000190735, 0, 0, 0 ) 
local ingangmarker = createMarker(-1907.9000244141, 1613.1999511719, 13.5, "cylinder", 5, 0, 0, 0, 0) 
local teams = {["Police"] = true} 
  
function moveGate1 ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and getPlayerTeam ( hitElement ) and teams[getTeamName(getPlayerTeam ( hitElement ))] then 
        moveObject ( ingang1, 3000, 1602.099609375, -1613.1999511719, 15.300000190735 )  
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 
  
function moveGate1Back ( leaveElement, matchingDimension ) 
    if getElementType ( leaveElement ) =="player" and getPlayerTeam ( leaveElement ) and teams [getTeamName(getPlayerTeam ( leaveElement ))] then 
    MoveObject (ingang1, 3000, 1602.099609375, -1613.099609375, 15.300000190735 ) 
    end 
end 
addEventHandler ("onMarkerLeave", ingangmarker, moveGate1Back) 
  

Pls help me!!! :fadein:

Link to comment

This Should Work

  
ingang1 = createObject ( 980, 1588, -1637, 14, 0, 0, 0 ) 
ingangmarker = createMarker (1588, -1635, 12, "cylinder",2) 
teams = getTeamFromName("Police") 
  
function moveGate1 ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and ( getPlayerTeam ( hitElement ) == teams ) then 
        moveObject ( ingang1, 3000,1598, -1637, 14 ) 
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 
  
function moveGate1Back ( leaveElement, matchingDimension ) 
    if getElementType ( leaveElement ) =="player" and ( getPlayerTeam ( leaveElement )== teams ) then 
        moveObject ( ingang1, 3000, 1588, -1637, 14 ) 
    end 
end 
addEventHandler ("onMarkerLeave", ingangmarker, moveGate1Back) 
  
  

Link to comment

Your only problem so far is the "MoveObject" function with has with upper case "M", and second if I'm right, your gate and your marker aren't in the same position, and you're trying to move the gate just a little, so maybe that's why you don't see it.

local ingang1 = createObject ( 980, 1602.099609375, -1613.099609375, 15.300000190735, 0, 0, 0 ) 
local ingangmarker = createMarker(-1907.9000244141, 1613.1999511719, 13.5, "cylinder", 5, 0, 0, 0, 0) 
local teams = {["Police"] = true} 
  
function moveGate1 ( hitElement, matchingDimension ) 
    if getElementType ( hitElement ) == "player" and getPlayerTeam ( hitElement ) and teams[getTeamName(getPlayerTeam ( hitElement ))] then 
        moveObject ( ingang1, 3000, 1602.099609375, -1613.1999511719, 15.300000190735 ) 
    end 
end 
addEventHandler("onMarkerHit", ingangmarker, moveGate1) 
  
function moveGate1Back ( leaveElement, matchingDimension ) 
    if getElementType ( leaveElement ) =="player" and getPlayerTeam ( leaveElement ) and teams [getTeamName(getPlayerTeam ( leaveElement ))] then 
        moveObject (ingang1, 3000, 1602.099609375, -1613.099609375, 15.300000190735 ) 
    end 
end 
addEventHandler ("onMarkerLeave", ingangmarker, moveGate1Back) 

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