Ayuto

binutils type reconstructing (simple)

Dec 23rd, 2013
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. # =============================================================================
  2. # >> IMPORTS
  3. # =============================================================================
  4. # EventScripts
  5. import es
  6.  
  7. # Custom types
  8. from custom_types import CUserCmd
  9. from custom_types import CCSPlayer
  10.  
  11.  
  12. # =============================================================================
  13. # >> LOAD & UNLOAD
  14. # =============================================================================
  15. def load():
  16.     CCSPlayer.PlayerRunCommand.add_pre_hook(PrePlayerRunCommand)
  17.  
  18. def unload():
  19.     CCSPlayer.PlayerRunCommand.remove_pre_hook(PrePlayerRunCommand)
  20.  
  21.  
  22. # =============================================================================
  23. # >> CALLBACKS
  24. # =============================================================================
  25. def PrePlayerRunCommand(args):
  26.     # Wrap the CUserCmd pointer
  27.     ucmd = CUserCmd(args[1])
  28.  
  29.     # Print selected weapon
  30.     if ucmd.weaponselect:
  31.         classname = es.entitygetvalue(ucmd.weaponselect, 'classname')
  32.         es.msg('Weapon selected: %s'% classname)
  33.  
  34.     # Print fired impulse
  35.     if ucmd.impulse:
  36.         es.msg('Impulse fired: %s'% ucmd.impulse)
  37.  
  38.     # Block back move
  39.     if ucmd.forwardmove < 0:
  40.         ucmd.forwardmove = 0
Advertisement
Add Comment
Please, Sign In to add comment