project-error / npwd

NPWD is a FiveM phone resource written entirely in TypeScript and React.
https://projecterror.dev
Other
338 stars 277 forks source link

fix(game/server/players): 'this' scope lost to service function #1013

Closed Gittified closed 6 months ago

Gittified commented 1 year ago

Pull Request Description

The scope of the 'this' keyword is lost in two methods because they get executed from within the class and use the 'this' keyword themselves, because 'this' is not based on declaration but invocation it gets lost. I solved the issue by simply binding the correct instance of 'this' to the invocation of the function, this solves #1010

Pull Request Checklist:

itschip commented 10 months ago

I haven't tested this, but if this is the case we should call the bound functions.

Gittified commented 10 months ago

I haven't tested this, but if this is the case we should call the bound functions.

I made this PR after noticing an error myself, also found an issue with a similar problem. After this the problem was resolved as far as I could see, if you can test it out and let me know, I'd appreciate it!