Jump to content

Event "OnPlayerCommand" and ACL not support "space"


Quited

Recommended Posts

Posted

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

Posted

The event "onPlayerCommand" only has one argument which is the command name, it doesn't include parameters.

Plus, you can't use spaces on commands.

Posted

I think you didn't understand Solidsnake. He meant that commands don't include parameters. It means that command is only 1st word that you are writing on chatbox.

  • Moderators
Posted

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) 
  
  

Posted

I think I get what does he want.

He wants that you can use commands such as "bind", but he wants to disable some binds, example: say.

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