How to use 'hookfunction'

Описание к видео How to use 'hookfunction'

This is a video that explains how to use hookfunction.

One thing I forgot about in the video is how to use the old function to implement a toggle. Here is what I mean:
Let's say that I want to have a toggle for the infinite ammo. Whenever this toggle is off, I want the function to return the original value. Whenever this toggle is on, I want the function to return my custom value. Here is how we can do this:
local oldgetammo; oldgetammo = hookfunction(getammo, function(...)
if infammo then
return 100;
else
return oldgetammo(...);
end;
end);

Комментарии

Информация по комментариям в разработке