Hugos

help

Recommended Posts

Would you please tell me how to remove the trigger?

For example:

triggerEvent("trig", resourceRoot)

addEvent("trig", true)
function trig()
 	...
end
addEventHandler("trig", resourceRoot, trig)

...how to remove it?

Edited by Hugos

Share this post


Link to post

Could you be more specified ?

If you want to remove an event to prevent his execution, just, don't execute it.

Regards.

Share this post


Link to post
Just now, Overkillz said:

Could you be more specified ?

If you want to remove an event to prevent his execution, just, don't execute it.

Regards.

I need to delete it after running)

Share this post


Link to post

Just use a boolean to check if is running or not.

triggerEvent("trig", resourceRoot)

local isRunning = false
addEvent("trig", true)
function trig()
	if not isRunning then
		isRunning = true
		...
	end
end
addEventHandler("trig", resourceRoot, trig)

Share this post


Link to post
Just now, Overkillz said:

Just use a boolean to check if is running or not.


triggerEvent("trig", resourceRoot)

local isRunning = false
addEvent("trig", true)
function trig()
	if not isRunning then
		isRunning = true
		...
	end
end
addEventHandler("trig", resourceRoot, trig)

Such an option is not suitable.

Share this post


Link to post

Could you just tell me why not ?

I have never used this, but you can try.

triggerEvent("trig", resourceRoot)

addEvent("trig", true)
function trig()
 	...
	removeEventHandler("trig", resourceRoot, trig)
end
addEventHandler("trig", resourceRoot, trig)

 

Share this post


Link to post
Just now, Overkillz said:

Could you just tell me why not ?

I have never used this, but you can try.


triggerEvent("trig", resourceRoot)

addEvent("trig", true)
function trig()
 	...
	removeEventHandler("trig", resourceRoot, trig)
end
addEventHandler("trig", resourceRoot, trig)

 

Triggers are not deleted like this.

Share this post


Link to post
2 minutes ago, Hugos said:

Triggers are not deleted like this.

Triggers can't be deleted, only prevented by not trigger them.

  • Like 1

Share this post


Link to post
Just now, IIYAMA said:

Triggers can't be deleted, only prevented by not trigger them.

If it is not possible to delete, then such a question:
I have "guiCreateStaticImage," and I use "onClientGUIClick" for the image.
What function do I need to add them to avoid using a trigger?

Edited by Hugos

Share this post


Link to post
1 hour ago, Hugos said:

I have "guiCreateStaticImage," and I use "onClientGUIClick" for the image.
What function do I need to add them to avoid using a trigger?

You could disable the element.

https://wiki.multitheftauto.com/wiki/GuiSetEnabled

 

Share this post


Link to post

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.