Jump to content

triggerEvent randomly stops working


Spc

Recommended Posts

Posted (edited)

Hello, I have basic custom event that triggers when player logins:

triggerEvent("onPlayerHasLogged", client)

And it's handled in another resource on global level:

addEventHandler("onPlayerHasLogged", root, function()
    iprint("trigger", source)
end)

 

Everything is working just fine but after a random amount of time (sometimes few hours, sometimes less and sometimes a lot more) eventHandler stops triggering completely. triggerEvent still returns true. When i restart the resource with eventHandler, everything works properly again.

Handlers of other event triggers that have "client" as base element stop working as well.

Does anybody know what may be wrong?

Edited by Spc
  • Moderators
Posted
1 hour ago, Spc said:

Does anybody know what may be wrong?

Are you using addDebugHook function somewhere in your resources?

 

Also the addEvent function should also be called at the resource where addEventHandler is being used.

  • Like 1
Posted (edited)
10 minutes ago, IIYAMA said:

Are you using addDebugHook function somewhere in your resources?

 

Yes, i'm using addDebugHook for detecting and blocking client-side functions as a form of anti-cheat, for example:

addDebugHook("preFunction", ac_checkFunction, DISALLOWED_FUNCTIONS)
function ac_checkFunction(sourceRes, funcName, _, _, _, ...)
    if DISALLOWED_FUNCTIONS[funcName] then
        triggerServerEvent("onACDetection", localPlayer)
        return "skip"
    end
end

 

Quote

Also the addEvent function should also be called at the resource where addEventHandler is being used.

 

Do you mean adding multiple addEvent functions with same event name? I use this event in multiple resources.

Edited by Spc
  • Moderators
Posted
3 minutes ago, Spc said:

Yes, i'm using addDebugHook for detecting and blocking client-side functions as a form of anti-cheat, for example:

This function is able to mimic that behaviour you just mentioned. Just be aware.

 

 

3 minutes ago, Spc said:

Do you mean adding multiple addEvent functions with same event name? I use this event in multiple resources.

It might be worthed to look in to it and test if it has any impact if any of those are restarted.

Also double check if the remote access is disabled for all of them. (2e argument of addEvent)

Posted (edited)
6 minutes ago, IIYAMA said:

It might be worthed to look in to it and test if it has any impact if any of those are restarted.

Also double check if the remote access is disabled for all of them. (2e argument of addEvent)

 

Remote access is disabled.

I'll add addEvents to the resources and i'll reply if it changed something or not. However it is still strange for me, because i've never seen this happen before.

Edited by Spc
  • Like 1
Posted

In the current situation of MTA:SA the entire client-side is completely exposed even the addDebogHook events can be neutralized by hackers, I recommend you to do more checks on the server-side

Posted
On 10/09/2024 at 17:20, Spc said:

I'll add addEvents to the resources and i'll reply if it changed something or not.

The problem stopped occuring. It seems that this did the trick.

Thank you for help.

  • Like 1

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