Jump to content

i need help please


Recommended Posts

  • Scripting Moderators

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
  • 2 weeks later...

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

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