thesensorykiller Posted August 20, 2021 Share Posted August 20, 2021 hi im new in mta editing i add a resource to my server but all players can use it how i put only admins who can use it Link to comment
Scripting Moderators ds1-e Posted August 20, 2021 Scripting Moderators Share Posted August 20, 2021 If you mean command then you could use optional argument for addCommandHandler. bool addCommandHandler ( string commandName, function handlerFunction [, bool restricted = false, bool caseSensitive = true ] ) Quote restricted: Specify whether or not this command should be restricted by default. Use this on commands that should be inaccessible to everyone as default except special users specified in the ACL (Access Control List). This is to make sure admin commands such as ie. 'punish' won't be available to everyone if a server administrator forgets masking it in ACL. Make sure to add the command to your ACL under the proper group for it to be usefull (i.e <right name="command.killEveryone" access="true"></right>). This argument defaults to false if nothing is specified. Link to comment
thesensorykiller Posted August 20, 2021 Author Share Posted August 20, 2021 no is not a command this resource work when u click on "o" just a click u dont need a cmd. Link to comment
ExTa Posted August 30, 2021 Share Posted August 30, 2021 If its a server side script then try this. if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then -- first line in the function -- what was in the function end -- last line in the function Link to comment
kcj2ubxi Posted September 4, 2021 Share Posted September 4, 2021 On 8/20/2021 at 6:13 PM, thesensorykiller said: no is not a command this resource work when u click on "o" just a click u dont need a cmd. A simple example of "bindKey", when you press a key that you put inside the "bindKey", it will execute, when executing it will check if the player is inside the ACL Admin or Group you exist that you want to put. Example: local key = "b" local statePress = "down" addEventHandler("onResourceStart", resourceRoot, function() for i, players in ipairs(getElementsByType("player")) do bindKey(players, key, statePress, checkGroupACL) end end) function checkGroupACL(player, key, state) local account = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then print("Yes, it's inside the 'Admin' ACL") else print("Error, not inside ACL 'Admin'") end end 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