-- RegisterCommand  0x5FA79B0F

-- REGISTER_COMMAND
RegisterCommand(
	commandName --[[ string ]], 
	handler --[[ func ]], 
	restricted --[[ boolean ]]
)

Parameters:

    commandName:

    The command you want to register.
    handler:

    A handler function that gets called whenever the command is executed.
    restricted:

    If this is a server command and you set this to true, then players will need the command.yourCommandName ace permission to execute this command.

Registered commands can be executed by entering them in the client console (this works for client side and server side registered commands). Or by entering them in the server console/through an RCON client (only works for server side registered commands). Or if you use a supported chat resource, like the default one provided in the cfx-server-data repository, then you can enter the command in chat by prefixing it with a /.

Commands registered using this function can also be executed by resources, using the ExecuteCommand native.

The restricted bool is not used on the client side. Permissions can only be checked on the server side, so if you want to limit your command with an ace permission automatically, make it a server command (by registering it in a server script).
 
 

Parameters:

commandName:

sentence.

handler:

sentence.

restricted:

sentence.

Returns:

None.

Summary

sentence.

Example

---  
    


Additional natives used in this example, or natives commonly used with this native.

NATIVE, NATIVE

Common Errors or Problems

Problem: sentence.

Problem: sentence.

Problem: sentence.

Credits and Disclaimers

The base of this data was taken from the redm/cfx fivem/rdr docs, and vespura. We have been saving and making notes for two years now, and are now adding them to our site for everyone to use. We will be modifying the notes as needed, and building tutorials around the data so these pages will change as we work on it. This is a manual process, not an automated one, so updates will occur as we have time, the priority is releasing resources. Thanks for your patience.

Was the documentation useful?

Related Examples and Posts

By MK