Fix lua explosion bypass (#2255)
* move explosion_anti_cheat_bypass to its own file * fix(lua): make sure lua user don't get tapped by game ac when using ADD_OWNED_EXPLOSION
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
#include "lua_native_binding.hpp"
|
||||
#include "natives.hpp"
|
||||
#include "util/explosion_anti_cheat_bypass.hpp"
|
||||
|
||||
namespace lua::native
|
||||
{
|
||||
@ -63,7 +64,11 @@ namespace lua::native
|
||||
|
||||
static void LUA_NATIVE_FIRE_ADD_OWNED_EXPLOSION(Ped ped, float x, float y, float z, int explosionType, float damageScale, bool isAudible, bool isInvisible, float cameraShake)
|
||||
{
|
||||
big::explosion_anti_cheat_bypass::apply();
|
||||
|
||||
FIRE::ADD_OWNED_EXPLOSION(ped, x, y, z, explosionType, damageScale, isAudible, isInvisible, cameraShake);
|
||||
|
||||
big::explosion_anti_cheat_bypass::restore();
|
||||
}
|
||||
|
||||
static void LUA_NATIVE_FIRE_ADD_EXPLOSION_WITH_USER_VFX(float x, float y, float z, int explosionType, Hash explosionFx, float damageScale, bool isAudible, bool isInvisible, float cameraShake)
|
||||
|
@ -95,6 +95,9 @@ class NativeFunc:
|
||||
s += "\n"
|
||||
s += "\t{\n"
|
||||
|
||||
if self.cpp_name == "ADD_OWNED_EXPLOSION":
|
||||
s+= "\t\tbig::explosion_anti_cheat_bypass::apply();\n\n"
|
||||
|
||||
call_native = "\t\t"
|
||||
if len(self.out_params) > 0:
|
||||
if returning_multiple_values:
|
||||
@ -127,6 +130,9 @@ class NativeFunc:
|
||||
|
||||
s += call_native
|
||||
|
||||
if self.cpp_name == "ADD_OWNED_EXPLOSION":
|
||||
s+= "\n\n\t\tbig::explosion_anti_cheat_bypass::restore();"
|
||||
|
||||
if returning_multiple_values:
|
||||
assign_return_values = "\n"
|
||||
if self.return_type != "void":
|
||||
@ -262,6 +268,8 @@ def generate_native_binding_cpp_and_hpp_files(functions_per_namespaces):
|
||||
|
||||
file_buffer += '#include "lua_native_binding.hpp"\n'
|
||||
file_buffer += '#include "natives.hpp"\n'
|
||||
if namespace_name == "FIRE":
|
||||
file_buffer += '#include "util/explosion_anti_cheat_bypass.hpp"\n'
|
||||
file_buffer += "\n"
|
||||
file_buffer += "namespace lua::native\n"
|
||||
file_buffer += "{\n"
|
||||
|
Reference in New Issue
Block a user