Jump to content

Help Scripting Permission


Jamie_Mews

Recommended Posts

i want only certain people to be able to open the gate, there will be a group name on the ACL called "police". and i want only the people from the "police" to be able to open the gate, it currently opens to those who have permission to kick people,

local theMarker = createMarker ( -1572, 662, 6,  "cylinder", 10, 0, 0, 255, 0 ) 
local gate = createObject ( 969, -1571.7370605469, 665.71630859375, 6.1875, 0, 0, 270.27026367188 ) 
  
function openGate ( hitElement ) 
if (getElementType(hitElement) == "player" ) then 
if hasObjectPermissionTo( hitElement, "function.kickPlayer" ) then 
moveObject ( gate, 1500, -1571.5941162109, 656.59051513672, 6.1875, 0, 0, 0 ) 
else 
outputChatBox ( "** You have entered a restricted area, you will now be taken away. **", hitElement, 255, 0, 0 ) 
setElementPosition ( hitElement, -1536, 651, 8 ) 
end 
end 
end 
  
function closeGate ( leftElement ) 
if (getElementType(leftElement) == "player" ) then 
moveObject ( gate, 1500, -1571.5941162109, 656.59051513672 + 9, 6.1875, 0, 0, 0 ) 
end 
end 
addEventHandler( "onMarkerLeave", theMarker, closeGate ) 
  
addEventHandler( "onMarkerHit", theMarker, openGate ) 

Link to comment

Indeed, replace source with hitElement.

It's really stupid and an abuse of the ACL system to check for specific named groups - the whole point of the ACL is to make it so that that kind of stuff isn't necessary - to detach scripts from knowledge of the users. So if you find yourself using aclGetGroup in your script, think twice about it. The only valid use for that is for admin tools that are modifying the ACL.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...