Jump to content

Event "OnPlayerCommand" and ACL not support "space"


Quited

Recommended Posts

Event "OnPlayerCommand" and ACL not support "space"

Example : i want to add in ACL "command.stop admin" and set to false

If i type in console "stop admin" the resource stopped succesfuly and no denied by ACL because "space" between stop and admin

Can someone help me and i don't need to protect admin panel in mtaserver.conf

Link to comment
  • Moderators

Why not use addCommandHandler?

I have never added acl rights with scripts so I may made a mistake.

  
local trueOrFalse = {["true"]=true,["false"]=true} 
local setTrueOrFalse = {["true"]=true,["false"]=false} 
  
function changeAcl (player,CMD,pointer1,pointer2) 
    if pointer1 = "admin" and trueOrFalse[pointer2] then 
        local acl = aclGet (CMD) 
        if acl then 
            aclSetRight (acl, "admin",setTrueOrFalse[pointer2]) 
            aclSave () 
        end 
    end 
end 
  
addCommandHandler ( "command.stop", changeAcl) 
  
  
  
  
  

This may also works:

  
local trueOrFalse = {["true"]=true,["false"]=true} 
  
addCommandHandler ( "command.stop", 
function  (player,CMD,pointer1,pointer2) 
    if pointer1 = "admin" and trueOrFalse[pointer2] then 
        local acl = aclGet (CMD) 
        if acl then 
            aclSetRight (cal, "admin",(pointer2 == "true" and true or false)) 
            aclSave () 
        end 
    end 
end) 
  
  

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...