禁用功能以启用另一个功能



您好,很抱歉打扰您,我目前正在5米上进行反作弊工作

但我在五米/gta中有一个小问题,你有默认的Natives/Functions

Exempel

IsPedInAnyVehicle(ped, boolean)——当ped在车辆中时返回

我想做的是捕捉的功能

像这个

function IsPedInAnyVehicle(ped, boolean)
-- i want to put my conditions here and when the conditions fit it accepts the real default 
--   native/function
end

捕获功能,它阻止了游戏的本地/默认功能,但现在的问题是,当条件适合时,我想执行真正的功能/本地

我想在条件合适的时候删除我所做的函数,但如果可以的话,我还是同意了Thx提前

Neo

只需用新函数覆盖函数,并保留对原始函数的引用,以便在满足条件时使用它。

function someFunction()
print("I'm the old function")
end
local backup = someFunction
someFunction = function ()
if condition then
backup()
else
print("Hey I'm the new function!")
end
end

someFunction()
condition = true
someFunction()
condition = false
someFunction()

打印

Hey I'm the new function
I'm the old function
Hey I'm the new function!

相关内容

最新更新