Jump to content

need a hand with gate script


Greenie0101

Recommended Posts

im trying to make a script where if someone on the LV team enters a colrectangle the gate door opens

LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == LV then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

no idea what im doing wrong

Link to comment

try this

LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
     
    function LVgate() 
        local LVTeam = getPlayerTeam( source ) 
            if LVTeam == LV then 
                moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
            end 
    end 
addEventHandler("onColShapeHit", LVsensor, LVgate ) 

Link to comment
try this
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
     
    function LVgate() 
        local LVTeam = getPlayerTeam( source ) 
            if LVTeam == LV then 
                moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
            end 
    end 
addEventHandler("onColShapeHit", LVsensor, LVgate ) 

badPlayerPointer @ getPlayerTeam

Link to comment
Guest Guest4401
im trying to make a script where if someone on the LV team enters a colrectangle the gate door opens
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == LV then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

no idea what im doing wrong

Is LV (in line 6) a team element? I don't see it defined anywhere.

Link to comment
im trying to make a script where if someone on the LV team enters a colrectangle the gate door opens
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == LV then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

no idea what im doing wrong

Is LV (in line 6) a team element? I don't see it defined anywhere.

its part of a gamemode with a team called LV

Link to comment
Guest Guest4401
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == getTeamFromName("LV") then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

Link to comment
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == getTeamFromName("LV") then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
 if theColShape == LVsensor then    
    if getElementType(source) == "player" then -- To avoid bugs, you aren't able to get a teamname from a vehicle. 
    local LVTeam = getPlayerTeam(source) 
    if ( LVTeam ) then -- Checks if player have a team 
    if LVTeam == getTeamFromName('LV') then -- Check if teamname is LV 
         
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

Link to comment
im trying to make a script where if someone on the LV team enters a colrectangle the gate door opens
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgate(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == LV then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgate ) 

no idea what im doing wrong

Is LV (in line 6) a team element? I don't see it defined anywhere.

this one works thanks mate however im having one small issue.

LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgateOpen(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == getTeamFromName("LV") then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2787, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgateOpen ) 
  
function LVgateClose(theColShape) 
    if theColShape == LVsensor then 
        if getPlayerTeam(source) == getTeamFromName("LV") then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2769.1999511719, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2777.1000976563, 11.5) 
        end 
    end 
end 
addEventHandler( "onElementColShapeLeave", getRootElement(), LVgateClose ) 

that is the script now but the gate opens for all teams, not just the LV one

Link to comment

Did you try albers14's code?

LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgateOpen(theColShape) 
 if theColShape == LVsensor then 
    if getElementType(source) == "player" then 
    local LVTeam = getPlayerTeam(source) 
    if ( LVTeam ) then 
    if LVTeam == getTeamFromName('LV') then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2787, 11.5) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgateOpen ) 
  
function LVgateClose(theColShape) 
    if theColShape == LVsensor then 
        if getElementType(source) == "player" then 
        local LVTeam = getPlayerTeam(source) 
            if ( LVTeam ) then 
                if LVTeam == getTeamFromName('LV') then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2769.1999511719, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2777.1000976563, 11.5) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onElementColShapeLeave", getRootElement(), LVgateClose ) 

Link to comment
Did you try albers14's code?
LVgateL = createObject ( 986, 2497.3999023438, 2769.1999511719, 11.5, 0, 0, 90 ) 
LVgateR = createObject ( 985, 2497.3999023438, 2777.1000976563, 11.5, 0, 0, 90 ) 
LVsensor = createColRectangle(2471.5, 2763.2, 50, 20) 
function LVgateOpen(theColShape) 
 if theColShape == LVsensor then 
    if getElementType(source) == "player" then 
    local LVTeam = getPlayerTeam(source) 
    if ( LVTeam ) then 
    if LVTeam == getTeamFromName('LV') then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2760, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2787, 11.5) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onElementColShapeHit", getRootElement(), LVgateOpen ) 
  
function LVgateClose(theColShape) 
    if theColShape == LVsensor then 
        if getElementType(source) == "player" then 
        local LVTeam = getPlayerTeam(source) 
            if ( LVTeam ) then 
                if LVTeam == getTeamFromName('LV') then 
            moveObject(LVgateL, 2000, 2497.3999023438, 2769.1999511719, 11.5) 
            moveObject(LVgateR, 2000, 2497.3999023438, 2777.1000976563, 11.5) 
                end 
            end 
        end 
    end 
end 
addEventHandler( "onElementColShapeLeave", getRootElement(), LVgateClose ) 

yes it didn't work. The only wrong thing is that it opens for all teams not just LV

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