Jump to content

Commands


_Marco_

Recommended Posts

  • Moderators
Posted (edited)
5 hours ago, _Marco_ said:

Hello guys

is it possible to give a person access to a command?  

 

Syntax /givecommand [command] [playername]

Commands are set based on the Account Control List (ACL).
Admin panel does have an user interface to modify this, that can be found under resources: click on the right top to modify the ACL.

 

For creating the exact thing you want, modify the example on this page:

https://wiki.multitheftauto.com/wiki/AclSetRight

 

<right name="command.givecommand" access="true" />

 

<right name="command.YOUR COMMAND NAME" access="true" />

Note, this works only for Groups.

Else you will have to create something custom.

 

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

I do not want to use the ACL

I want to use the database to do this, is it possible?

If possible, send materials or training in this regard

  • Moderators
Posted (edited)
2 hours ago, _Marco_ said:

If possible, send materials or training in this regard

Then here you are:

https://wiki.multitheftauto.com/wiki/OnPlayerCommand

https://wiki.multitheftauto.com/wiki/CancelEvent

 

Database stuff etc. can be found on the wiki. Keep in mind that A-sync database requests with cancelled commands are not possible.

 

 

Edited by IIYAMA

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

  • Moderators
Posted
1 hour ago, _Marco_ said:

Can you give me an example of how to do this?

local commandObject = {
	collection = {
		["fly"] = true
	},
	playerAccess = {
		["<playerserial>"] = { -- put your serial in here.
			["fly"] = true
		}
	}
}

addEventHandler("onPlayerCommand", root,
    function(command)
		if commandObject.collection[command] then
			local serial = getPlayerSerial(source)
			local playerAccess = commandObject.playerAccess[serial]
			if playerAccess and playerAccess[command] then
				return
			end
			cancelEvent()
		end
    end
)

Sure.

 

 

1 hour ago, _Marco_ said:

How to give a command to a multiplexer so that it is stored in the database?

I am not going to teach you stuff that is beyond your current level, for obvious reasons.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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