Disabling a resource through script

Hi everyone! I am new to FiveM resource development. Is there a way to disable a resource through a script? I want to show a text when I type in a command in the chat, and I want to disable it when I type the command again. I have tried modifying the resource client script with RegisterCommand, but I haven’t got any luck. I have defined a variable called count which I set to 1 when it is zero, and the command is typed and 0 when it is one and the command is typed. Here is my code:

	RegisterCommand("aduty", function()
		if count == 0 then
		   count = 1
		elseif count == 1 then
		   count = 0
		end
   end, false)

I don’t know if my code is correct, but that is why I am posting on this forum. I am also interested in if it is possible to do this using a different resource, but disabling the text printing resource instead.

You can use https://runtime.fivem.net/doc/natives/?_0x21783161 (server sided) to completely disable a resource.

In your case, using a boolean to know if the command has already been used is a better idea (like what you have done here).