Greenie0101 Posted August 12, 2012 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Tete omar Posted August 12, 2012 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 )
Greenie0101 Posted August 12, 2012 Author 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Guest Guest4401 Posted August 12, 2012 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.
Greenie0101 Posted August 12, 2012 Author 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Guest Guest4401 Posted August 12, 2012 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 )
albers14 Posted August 12, 2012 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 )
Greenie0101 Posted August 12, 2012 Author 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Vision Posted August 12, 2012 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 )
Greenie0101 Posted August 12, 2012 Author 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
Greenie0101 Posted August 12, 2012 Author 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 New CMG 2.0 Screenshot! http://img560.imageshack.us/img560/4269/cmg2screen.png CMG 2.0 Trailer! Learn to script from simple video tutorials completely free! Click here for forum page Was the scripter for CMG server! Leaving CMG: 100%
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