opnaiC Posted May 6, 2016 Share Posted May 6, 2016 Hello, how I can change the script that a LSPD team member can open the gate and not the "(player)" ? Was trying myself but it wasnt working hope you can help me )) teampolice = createTeam ( "LSPD", 0, 0, 255 ) LSPDgateMoving = false LSPDgateMoved = false LSPDGate1 = createObject ( 971, 1589.0352783203, -1638.1243896484, 15.08652305603, 0, 0, 180 ) LSPDGate2 = createObject ( 2930, 1582.5673828125, -1637.8597412109, 15.019668579102, 0, 0, 90 ) function mv_func ( player ) if (player) then if getDistanceBetweenPoints3D ( 1589.0352783203, -1638.1243896484, 15.08652305603, getElementPosition ( player ) ) < 17 then if LSPDgateMoved == false then moveObject ( LSPDGate1, 3000, 1597.0734863281, -1638.0965576172, 15.08652305603 ) moveObject ( LSPDGate2, 1500, 1580.8779296875, -1637.8725585938, 15.019668579102 ) LSPDgateMoved = true else moveObject ( LSPDGate1, 3000, 1589.0352783203, -1638.0965576172, 15.08652305603 ) moveObject ( LSPDGate2, 1500, 1582.5673828125, -1637.8597412109, 15.019668579102 ) LSPDgateMoved = false end end end end addCommandHandler ( "gate", mv_func ) Link to comment
Dimos7 Posted May 6, 2016 Share Posted May 6, 2016 teampolice = createTeam ( "LSPD", 0, 0, 255 ) LSPDgateMoving = false LSPDgateMoved = false LSPDGate1 = createObject ( 971, 1589.0352783203, -1638.1243896484, 15.08652305603, 0, 0, 180 ) LSPDGate2 = createObject ( 2930, 1582.5673828125, -1637.8597412109, 15.019668579102, 0, 0, 90 ) function mv_func ( player ) local team = getPlayerTeam(player) if (getTeamName(team)== "LSPD")) then if getDistanceBetweenPoints3D ( 1589.0352783203, -1638.1243896484, 15.08652305603, getElementPosition ( player ) ) < 17 then if LSPDgateMoved == false then moveObject ( LSPDGate1, 3000, 1597.0734863281, -1638.0965576172, 15.08652305603 ) moveObject ( LSPDGate2, 1500, 1580.8779296875, -1637.8725585938, 15.019668579102 ) LSPDgateMoved = true else moveObject ( LSPDGate1, 3000, 1589.0352783203, -1638.0965576172, 15.08652305603 ) moveObject ( LSPDGate2, 1500, 1582.5673828125, -1637.8597412109, 15.019668579102 ) LSPDgateMoved = false end end end end addCommandHandler ( "gate", mv_func ) Link to comment
opnaiC Posted May 7, 2016 Author Share Posted May 7, 2016 Something is wrong in the code cause the gates disappeard.. Link to comment
opnaiC Posted May 7, 2016 Author Share Posted May 7, 2016 Thank you found the problem you wrote "if (getTeamName(team)== "LSPD")) then", but it should be "if (getTeamName(team)== "LSPD") then" now its working .. 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