[HL2DM] GetPlayerMaxSpeed crashing
Posted: Sat Oct 19, 2019 4:44 pm
I'm trying to hook CBasePlayer::GetPlayerMaxSpeed() and the server (Windows) keeps crashing the moment I load the plugin.
Here's my CBasePlayer.ini:
And the plugin code:
Any idea why it's crashing? At first I thought it was cause I wasn't returning a float, but even after I added that, it still crashes.
Here's my CBasePlayer.ini:
Syntax: Select all
[virtual_function]
[[get_player_max_speed]]
offset_linux = 438
offset_windows = 437
return_type = FLOAT
Syntax: Select all
# ../max_speed_test/max_speed_test.py
# Source.Python
from entities.hooks import EntityPreHook, EntityCondition
from memory import make_object
from memory.manager import TypeManager
from path import Path
manager = TypeManager()
CBasePlayer = manager.create_type_from_file(
'CBasePlayer', Path(__file__).parent / 'CBasePlayer.ini')
@EntityPreHook(
EntityCondition.is_player,
lambda entity: make_object(CBasePlayer, entity.pointer).get_player_max_speed)
def get_player_max_speed_pre(stack_data):
print('test')
return 0.0
Any idea why it's crashing? At first I thought it was cause I wasn't returning a float, but even after I added that, it still crashes.