FraRyder Posted September 6, 2013 Share Posted September 6, 2013 Hi. I don't know how to set a restriction to the marker that opens my gate. I tried but none of my attemps works... Can someone help me, please? I want the gate will open only if a player in the marker is in the team "myTeam". local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) function opengatep() moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 ) end function closegatep() moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) end cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 255, 0) addEventHandler("onMarkerHit", cancello, opengatep) addEventHandler("onMarkerLeave", cancello, closegatep) excuse for my bad english Link to comment
Prat Posted September 6, 2013 Share Posted September 6, 2013 i believe there is no reason to stop it from working. Good luck local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) function opengatep() if not ( getPlayerTeam( thePlayer ) ) == false then if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 ) end end end function closegatep() if not ( getPlayerTeam( thePlayer ) ) == false then if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) end end end cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 255, 0) addEventHandler("onMarkerHit", cancello, opengatep) addEventHandler("onMarkerLeave", cancello, closegatep) Link to comment
FraRyder Posted September 7, 2013 Author Share Posted September 7, 2013 (edited) Thank you but the gate opens when any person passes through the marker... however i can use your script for other restrictions, thank you anyway! Edit: I am headless ._. I thought i was working with another gate. Excuse me... This gate doesn't open when i pass through the marker Edited September 7, 2013 by Guest Link to comment
TAPL Posted September 7, 2013 Share Posted September 7, 2013 This because thePlayer is not defined. Also you should have used getElementType to be sure that the hit element is player. Link to comment
FraRyder Posted September 7, 2013 Author Share Posted September 7, 2013 I tried... now the console doesn't says there are problem in the script, but the gate doesn't opens local gate = createObject(976,-1534.7,482,6.32, 0, 0, 0 ) function opengatep() if getElementType(source) == "player" then if not ( getPlayerTeam( thePlayer ) ) == false then if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then moveObject(gate, 2000, -1544,482,6.32, 0, 0, 0 ) end end end end function closegatep() if getElementType(source) == "player" then if not ( getPlayerTeam( thePlayer ) ) == false then if ( getTeamName( getPlayerTeam( thePlayer ) ) == "myTeam" ) then moveObject(gate, 2000, -1534.7,482,6.32, 0, 0, 0 ) end end end end cancello = createMarker ( -1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 150, 150) addEventHandler("onMarkerHit", cancello, opengatep) addEventHandler("onMarkerLeave", cancello, closegatep) Link to comment
TAPL Posted September 7, 2013 Share Posted September 7, 2013 You made it even worse than before lol. local gate = createObject(976, -1534.7, 482, 6.32, 0, 0, 0) function opengatep(thePlayer) if getElementType(thePlayer) == "player" then local team = getPlayerTeam(thePlayer) if team and getTeamName(team) == "myTeam" then moveObject(gate, 2000, -1544, 482, 6.32, 0, 0, 0) end end end function closegatep(thePlayer) if getElementType(thePlayer) == "player" then local team = getPlayerTeam(thePlayer) if team and getTeamName(team) == "myTeam" then moveObject(gate, 2000, -1534.7, 482, 6.32, 0, 0, 0) end end end cancello = createMarker(-1530, 482.2, 6.2 ,"cylinder", 13, 0, 0, 150, 150) addEventHandler("onMarkerHit", cancello, opengatep) addEventHandler("onMarkerLeave", cancello, closegatep) Link to comment
FraRyder Posted September 7, 2013 Author Share Posted September 7, 2013 ... I can't script well but with your help I am learning It works, thank you so much, bro 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