Override or hook native functions

A way to override or hook into native (or script) functions would be very useful.

Imagine a custom resource that handles custom player names, being able to override GetPlayerName in any other resource to call the custom function is required, unless you want to replace every instance of GetPlayerName with an export across every single resource (not very easy, especially to maintain compatibility with existing resources and across servers).
This would provide a seamless way to do so, without server owners having to modify a single line of code.

Hooking into native calls could provide resources with a way to do certain actions when a specific action is taken in a script, such as when a vehicle is created, launch it into the sky or set its body paint to yellow (While still maintainting the existing code that spawns the vehicle and whatnot.)

These two features would add some new fronts for crazy stuff, and open up for resources that change or control core features.

No. This would lead to infinite performance issues in an already touchy piece of code.

Even just tracking usage counts (incrementing a mere counter!) led to people having infinite performance issues and a crying day, allowing arbitrary behavior interception would only require 500x more logic for such, and slow down 500x more than that counter stuff back in the day.

2 Likes

… actually there’s a way this would be viable except it’d still make intercepted natives really slow unless adopting some sort of crazy JIT compiler logic similar to what Unity has for ā€œBurstā€ or whatever they call it, or maybe something like Ravi (or worse and yet different, Terra?).

Interesting to look into at some point, perhaps.

3 Likes

In addition to what @glitchdetector stated it could be very useful for anti-cheat as we could also hook natives like SET_SUPER_JUMP_THIS_FRAME and report cheaters.

1 Like

OK, then it won’t be implemented at all ever. Fuck your client ā€˜anticheat’ obsession.

Fucking knew this was just a covert way to get another thing implemented for you kids to do ā€˜client anticheat’ shit.