Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============================================================================
- # >> IMPORTS
- # =============================================================================
- # EventScripts
- import es
- # Custom types
- from custom_types import CUserCmd
- from custom_types import CCSPlayer
- # =============================================================================
- # >> LOAD & UNLOAD
- # =============================================================================
- def load():
- CCSPlayer.PlayerRunCommand.add_pre_hook(PrePlayerRunCommand)
- def unload():
- CCSPlayer.PlayerRunCommand.remove_pre_hook(PrePlayerRunCommand)
- # =============================================================================
- # >> CALLBACKS
- # =============================================================================
- def PrePlayerRunCommand(args):
- # Wrap the CUserCmd pointer
- ucmd = CUserCmd(args[1])
- # Print selected weapon
- if ucmd.weaponselect:
- classname = es.entitygetvalue(ucmd.weaponselect, 'classname')
- es.msg('Weapon selected: %s'% classname)
- # Print fired impulse
- if ucmd.impulse:
- es.msg('Impulse fired: %s'% ucmd.impulse)
- # Block back move
- if ucmd.forwardmove < 0:
- ucmd.forwardmove = 0
Advertisement
Add Comment
Please, Sign In to add comment