BumpWeapon
Posted: Sat Mar 14, 2015 3:25 pm
I use this code:
But when I return True or False at the end of the event, I get the following:
https://www.dropbox.com/s/o0npfgl6e1umupb/no_name.png?dl=0
I used the data from the source python extension:
Syntax: Select all
# =============================================================================
# >> IMPORTS
# =============================================================================
# Memory
import memory
from memory import DataType
from memory import Convention
from memory.hooks import PreHook
# Players
from weapons.entity import WeaponEntity
from players.helpers import userid_from_pointer
from players.helpers import index_from_userid
# Core
from core import PLATFORM
# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Get the server binary
server = memory.find_binary('cstrike/bin/server')
if PLATFORM == 'windows':
identifier = b'\x55\x8B\xEC\x83\xEC\x38\x89\x4D\xF4'
else:
identifier = '_ZN9CCSPlayer10BumpWeaponEP17CBaseCombatWeapon'
BUMP_WEAPON = server[identifier].make_function(
Convention.THISCALL,
(DataType.POINTER, DataType.POINTER, DataType.POINTER, DataType.INT),
DataType.VOID
)
# =============================================================================
# >> CALLBACKS
# =============================================================================
@PreHook(BUMP_WEAPON)
def pre_bump_weapon(args):
index = index_from_userid(userid_from_pointer(args[0]))
test = memory.make_object(WeaponEntity, args[1])
return True
But when I return True or False at the end of the event, I get the following:
https://www.dropbox.com/s/o0npfgl6e1umupb/no_name.png?dl=0
I used the data from the source python extension:
Code: Select all
[CCSPlayer::BumpWeapon]
shortname = "BumpWeapon"
sig = " 55 8B EC 83 EC 38 89 4D F4"
symbol = "_ZN9CCSPlayer10BumpWeaponEP17CBaseCombatWeapon"
param = "pp)i"
convention = "thiscall"