Ayuto

custom_types example4 (TESystem)

Dec 28th, 2013
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. # =============================================================================
  2. # >> IMPORTS
  3. # =============================================================================
  4. # Python
  5. from random import randint
  6.  
  7. # EventScripts
  8. import es
  9.  
  10. # binutils
  11. import custom_types
  12.  
  13.  
  14. # =============================================================================
  15. # >> TESTS
  16. # =============================================================================
  17. te = custom_types.server_tools.GetTempEntsSystem()
  18.  
  19. def player_jump(ev):
  20.     x, y, z = es.getplayerlocation(ev['userid'])
  21.  
  22.     # Allocate memory for a new Vector instance
  23.     center = custom_types.Vector()
  24.  
  25.     # Initialize it by setting the x, y and z values
  26.     center.Init(x, y, z)
  27.  
  28.     # Allocate memory for a new CRecipientFilter instance
  29.     recipients = custom_types.CRecipientFilter()
  30.  
  31.     # We have to call the constructor to initialize the virtual function table
  32.     recipients.constructor()
  33.  
  34.     # Add all players for testing purpose
  35.     recipients.AddAllPlayers()
  36.  
  37.     # Precache the model
  38.     index = es.precachemodel('sprites/laser.vmt')
  39.  
  40.     # Now create the BeamRingPoint effect
  41.     te.BeamRingPoint(
  42.         recipients,                   # filter
  43.         0,                            # delay
  44.         center,                       # center
  45.         0,                            # fStartRadius
  46.         500,                          # fEndRadius
  47.         index,                        # szModelPath
  48.         0,                            # iHaloIndex
  49.         0,                            # iStartFrame
  50.         255,                          # iFrameRate
  51.         3,                            # fLife
  52.         3,                            # fWidth
  53.         0,                            # iSpread
  54.         0,                            # fAmplitude
  55.         randint(0, 255),              # iRed
  56.         randint(0, 255),              # iGreen
  57.         randint(0, 255),              # iBlue
  58.         255,                          # iAlpha
  59.         1,                            # iSpeed
  60.         0,                            # iFlags
  61.     )
  62.  
  63.     # Call the destructor for <recipients>
  64.     recipients.destructor()
  65.  
  66.     # Deallocate <center> and <recipients>
  67.     center.dealloc()
  68.     recipients.dealloc()
Advertisement
Add Comment
Please, Sign In to add comment