Jump to content

help


Hugos

Recommended Posts

Posted (edited)

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

Говорю на русском. Sorry for bad english.
 

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

Говорю на русском. Sorry for bad english.
 

Posted

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

Говорю на русском. Sorry for bad english.
 

Posted

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)

 

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

Говорю на русском. Sorry for bad english.
 

  • Moderators
Posted
2 minutes ago, Hugos said:

Triggers are not deleted like this.

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

  • Like 1

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

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted (edited)
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

Говорю на русском. Sorry for bad english.
 

  • Moderators
Posted
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

 

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