threevictor Posted January 30, 2017 Share Posted January 30, 2017 Hello guys, I have this problem in this script was for him to open the door only for gangs, but it is opening for any player and is giving this one on the console as you can see below if you can help me thanks! CODE! gate = createObject(971, 1543.400390625, -1628.2001953125, 15.89999961853, 0, 0, 90) x,y,z = getElementPosition (gate) zona = createColCircle ( x,y, 7, 7 ) function open() playerTeam = getPlayerTeam ( source ) Clann = getTeamFromName ("BOPE") if (playerTeam) == Clann then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) function close() moveObject(gate, 2000, 1543.400390625, -1628.2001953125, 15.89999961853 ) end addEventHandler ( "onColShapeLeave", zona, close ) Link to comment
ViRuZGamiing Posted January 30, 2017 Share Posted January 30, 2017 use hitElement not source, source is the colshape that's hit Link to comment
threevictor Posted January 31, 2017 Author Share Posted January 31, 2017 57 minutes ago, ViRuZGamiing said: use hitElement not source, source is the colshape that's hit The error is present in the console and continues to open to player outside the team Link to comment
Hoffmann Posted January 31, 2017 Share Posted January 31, 2017 (edited) function open() playerTeam = getPlayerTeam ( hitElement ) Clann = getTeamFromName ("BOPE") if (playerTeam) == Clann then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) Here you compare team element "playerTeam" with string "Clann". Try this: function open() playerTeam = getPlayerTeam ( source ) playerTeamName = getTeamName(playerTeam) Clann = getTeamFromName ("BOPE") if (playerTeamName == Clann) then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) Edited January 31, 2017 by NeverUnbeatable Link to comment
!#NssoR_) Posted January 31, 2017 Share Posted January 31, 2017 (edited) Try this and make sure that you're in the BOPE team. gate = createObject(971, 1543.400390625, -1628.2001953125, 15.89999961853, 0, 0, 90) x,y,z = getElementPosition (gate) zona = createColCircle ( x,y, 7, 7 ) function open(element) local playerTeam = getPlayerTeam ( element ) if ( playerTeam and playerTeam == getTeamFromName ("BOPE") ) then if ( eventName == 'onColShapeHit' ) then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) elseif ( eventName == 'onColShapeLeave' ) then moveObject(gate, 2000, 1543.400390625, -1628.2001953125, 15.89999961853 ) end end end addEventHandler ( "onColShapeHit", zona, open ) addEventHandler ( "onColShapeLeave", zona, open ) Edited January 31, 2017 by !#NssoR_) 1 Link to comment
Hoffmann Posted January 31, 2017 Share Posted January 31, 2017 58 minutes ago, NeverUnbeatable said: function open() playerTeam = getPlayerTeam ( hitElement ) Clann = getTeamFromName ("BOPE") if (playerTeam) == Clann then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) Here you compare team element "playerTeam" with string "Clann". Try this: function open() playerTeam = getPlayerTeam ( source ) playerTeamName = getTeamName(playerTeam) Clann = getTeamFromName ("BOPE") if (playerTeamName == Clann) then moveObject(gate, 2000, 1543.4000244141, -1619.0999755859, 15.89999961853 ) end end addEventHandler ( "onColShapeHit", zona, open ) Didn't see. He gets team element from name. Sry. Link to comment
threevictor Posted January 31, 2017 Author Share Posted January 31, 2017 Thank you guys, may God give you all the best. TOPIC CLOSED! 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