Greenie0101 Posted August 12, 2012 Share Posted August 12, 2012 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
Tete omar Posted August 12, 2012 Share Posted August 12, 2012 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
Greenie0101 Posted August 12, 2012 Author Share Posted August 12, 2012 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
Tete omar Posted August 12, 2012 Share Posted August 12, 2012 Did you try the player argument yet ? Link to comment
Guest Guest4401 Posted August 12, 2012 Share Posted August 12, 2012 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
Tete omar Posted August 12, 2012 Share Posted August 12, 2012 Yeah i was wondering too Link to comment
Greenie0101 Posted August 12, 2012 Author Share Posted August 12, 2012 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 Posted August 12, 2012 Share Posted August 12, 2012 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
albers14 Posted August 12, 2012 Share Posted August 12, 2012 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
Greenie0101 Posted August 12, 2012 Author Share Posted August 12, 2012 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
Vision Posted August 12, 2012 Share Posted August 12, 2012 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
Greenie0101 Posted August 12, 2012 Author Share Posted August 12, 2012 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
Vision Posted August 12, 2012 Share Posted August 12, 2012 Here works fine, it opens only for LV team Link to comment
Greenie0101 Posted August 12, 2012 Author Share Posted August 12, 2012 my bad, the team was actually called Las Venturas and thats why it wouldn't open. got it working tho. Thanks for all you're help! I'll make a video tutorial on how to make a gate soon for people who dont want to go through this process Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now