[Cs:s] How to hook weapon reload
Posted: Sat Nov 05, 2022 4:25 pm
Hi, how i can hook when player have finished weapon reload?
I can't use weapon_reload event since it doesn't get called when weapon starts reloading when automatically starts reloading
Edit:
i tried to hook CBaseCombatWeapon::Reload
but the print never get executed
I can't use weapon_reload event since it doesn't get called when weapon starts reloading when automatically starts reloading
Edit:
i tried to hook CBaseCombatWeapon::Reload
Syntax: Select all
from core import PLATFORM
from memory import Convention, DataType
from entities.hooks import EntityPreHook, EntityCondition
if PLATFORM == 'linux':
offset = 271
else:
offset = 270
def prepare_hook(entity):
return entity.pointer.make_virtual_function(offset,
Convention.THISCALL,
[DataType.POINTER],
DataType.VOID)
@EntityPreHook(EntityCondition.is_player, prepare_hook)
def weapon_reloaded_hook(args):
print('Weapon reload was executed')
but the print never get executed