Jokeℝ1472771893 Posted July 26, 2012 Posted July 26, 2012 how to make gates openned by ACL group? i create one but it's oppenned by team
TAPL Posted July 26, 2012 Posted July 26, 2012 https://wiki.multitheftauto.com/wiki/IsObjectInACLGroup
Jokeℝ1472771893 Posted July 26, 2012 Author Posted July 26, 2012 this is my gates now how to make it openned by acl group members? local gate = createObject(980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180) local marker = createMarker(1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255) function moveGate(hitPlayer, matchingDimension) if hasObjectPermissionTo(hitPlayer, "function.kickPlayer") then moveObject(gate, 2000, 1118, -1541.0999755859, 16.10000038147) setTimer(moveBack, 2000, 1) end end addEventHandler("onMarkerHit", marker, moveGate) function moveBack() moveObject(gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147) end
Castillo Posted July 26, 2012 Posted July 26, 2012 local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) function moveGate ( hitPlayer, matchingDimension ) if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) setTimer ( moveBack, 2000, 1 ) end end addEventHandler ( "onMarkerHit", marker, moveGate ) function moveBack ( ) moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) end
albers14 Posted July 26, 2012 Posted July 26, 2012 It gonna bugs if you use a vehicle to enter as the hitElement is an vehicle now, not player. This will work, added getElementType. local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) function moveGate ( hitPlayer, matchingDimension ) if getElementType(hitPlayer) =="player" and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) setTimer ( moveBack, 2000, 1 ) end end addEventHandler ( "onMarkerHit", marker, moveGate ) function moveBack ( ) moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) end
Jokeℝ1472771893 Posted July 27, 2012 Author Posted July 27, 2012 thnx it's work but how to make gates closed onMarkerLeave ?
albers14 Posted July 27, 2012 Posted July 27, 2012 Use the same code but to close it? Not really, you putted a timer in you script thats move it back after 2 seconds. If he want todo like you saying then he should remove the timer first
Jokeℝ1472771893 Posted July 27, 2012 Author Posted July 27, 2012 yes i just need that onMarkerLeav Script
albers14 Posted July 27, 2012 Posted July 27, 2012 yes i just need that onMarkerLeav Script function EDIT ( hitPlayer, matchingDimension ) -- Need edit if getElementType(hitPlayer) =="player" and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then moveObject ( gate, 2000, new coords ) -- need edit end end addEventHandler ( "Edit the eventHandler", marker, EDIT!! ) -- Need edit It can take less than 1 minute if you know the coords already else 2 minutes
albers14 Posted July 28, 2012 Posted July 28, 2012 this is onMarkerLeave? O_o If you edit the places where I said you shoul then yes. As event handler you use onMarkerLeave.
Castillo Posted August 2, 2012 Posted August 2, 2012 Try this: local gate = createObject ( 980, 1128.3000488281, -1541.0999755859, 16.10000038147, 0, 0, 180 ) local marker = createMarker ( 1128.3000488281, -1543.5999755859, 13.300000190735, "cylinder", 2, 255, 255, 255, 255 ) function moveGate ( hitPlayer, matchingDimension ) if ( getElementType ( hitPlayer ) == "player" ) and isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( hitPlayer ) ), aclGetGroup ( "Admin" ) ) then if ( eventName == "onMarkerHit" ) then moveObject ( gate, 2000, 1118, -1541.0999755859, 16.10000038147 ) setTimer ( moveBack, 2000, 1 ) elseif ( eventName == "onMarkerLeave" ) then moveBack ( ) end end end addEventHandler ( "onMarkerHit", marker, moveGate ) addEventHandler ( "onMarkerLeave", marker, moveGate ) function moveBack ( ) moveObject ( gate, 2000, 1128.3000488281, -1541.0999755859, 16.10000038147 ) end
Jokeℝ1472771893 Posted August 2, 2012 Author Posted August 2, 2012 nope it's closed again after 6-8 sec
Castillo Posted August 2, 2012 Posted August 2, 2012 It works perfectly here, when enter marker -> gate opens, when leave marker -> gate closes.
Castillo Posted August 2, 2012 Posted August 2, 2012 That's because of the 2 seconds timer the script has: setTimer ( moveBack, 2000, 1 ) remove that and done.
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