Pushok

Expression2 Bot

Dec 24th, 2011
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @name Something_Funny
  2.  
  3. #defines
  4. @persist ToOwnerBearing:normal Coef:normal HandFromBody:normal
  5. @persist IndexBody IndexHead IndexHand
  6. @persist BodyPos:vector HeadPos:vector HandPos:vector
  7. @persist BodySize:vector HeadSize:vector HandSize:vector
  8. @persist BodyAng:angle HeadAng:angle HandAng:angle
  9. @persist BodyColor:vector HeadColor:vector HandColor:vector
  10. @persist HandTop ChipPos:vector BallIndex
  11.  
  12. @persist OldVictimPos:vector OldWeaponPos:vector OldWeaponAngles:angle
  13. @persist LenFromBallToTarget CurrentLength Clock Acceleration
  14.  
  15. #@persist TimeOfChat
  16. #end
  17.  
  18. function normal createTheBall( VictimPos:vector, WeaponPos:vector )
  19. {
  20.     Index = randint( 4, 100 )
  21.    
  22.     BallSize = vec( 0.4, 0.4, 0.4 )
  23.     BallColor = vec( 0, 0, 0 )
  24.     BallOrigin = WeaponPos
  25.    
  26.    
  27.     holoCreate( Index, BallOrigin, BallSize, ang( 0, 0, 0 ), BallColor )
  28.     holoModel( Index, "sphere", 0 )
  29.    
  30.     return Index
  31. }
  32.  
  33. interval( 50 )
  34. runOnChat( 1 )
  35.  
  36. if( first() )
  37. {
  38.     ChipPos = entity():pos()
  39.    
  40.     Coef = 6
  41.     Acceleration = 3.5
  42.     TimeOfChat = 0
  43.    
  44.     HandFromBody = 2*Coef + 0.8*Coef
  45.     HandTop = 5*Coef*2 - 3*Coef
  46.    
  47.     BodyPos = ChipPos + vec( 0, 0, 5*Coef )
  48.     HeadPos = ChipPos + vec( 0, 0, 2.5*Coef + 5*Coef*2)
  49.     HandPos = ChipPos + vec( 0, HandFromBody, HandTop )
  50.    
  51.     HandSize = vec( 0.8, 0.8, 3 )
  52.     BodySize = vec( 2, 2, 5 )
  53.     HeadSize = vec( 2.5, 2.5, 2.5 )
  54.    
  55.     HandAng = ang( 0, 0, 0 )
  56.     BodyAng = ang( 0, 0, 0 )
  57.     HeadAng = ang( 0, 0, 0 )
  58.    
  59.     BodyColor = vec( 255, 0, 0 )
  60.     HeadColor = vec( 0, 255, 0 )
  61.     HandColor = vec( 0, 0, 255 )
  62.    
  63.     IndexBody = 1
  64.     IndexHead = 2
  65.     IndexHand = 3
  66.    
  67.     holoCreate( IndexHand, HandPos, HandSize, HandAng, BodyColor )
  68.     holoCreate( IndexBody,  BodyPos, BodySize, BodyAng, HeadColor )
  69.     holoCreate( IndexHead, HeadPos, HeadSize, HeadAng, HandColor )
  70.    
  71.     holoModel( IndexHead, "sphere", 0 )
  72.  
  73.     #something about balls
  74.    
  75.     BallIndex = -1
  76.     CurrentLength = 0
  77. }
  78. else
  79. {
  80.     OwnerOrigin = entity():owner():shootPos()
  81.     ToOwnerBearing = entity():bearing( OwnerOrigin )
  82.    
  83.     BodyAng = ang( 0, -ToOwnerBearing, 0 )
  84.     HeadAng = ang( 0, -ToOwnerBearing, 0 )
  85.    
  86.     ToOwnerElevation = elevation( HandPos, ang( 0, 0, 0 ), OwnerOrigin )
  87.     FromHandToHeadBearing = bearing( HandPos, ang( 0, 0, 0 ), OwnerOrigin )
  88.     HandAngles = ang( -(ToOwnerElevation - 90), -ToOwnerBearing, 0 )
  89.    
  90.     holoAng( IndexBody, ang( 0, -ToOwnerBearing, 0 ) )
  91.     holoAng( IndexHead, ang( 0, -ToOwnerBearing, 0 ) )
  92.     holoAng( IndexHand, HandAngles )
  93.    
  94.     HandNewPos = ChipPos + vec( HandFromBody * sin( FromHandToHeadBearing ), HandFromBody * cos( FromHandToHeadBearing ), HandTop )
  95.    
  96.     holoPos( IndexHand, HandNewPos )
  97.    
  98.     LenFromBallToTarget = (OwnerOrigin - HandNewPos):length()
  99.    
  100.     if( entity():owner():lastSaid() == "!shoot" && chatClk() && BallIndex == -1 && LenFromBallToTarget < 550 )
  101.     {
  102.         BallIndex = createTheBall( OwnerOrigin, HandNewPos )
  103.         LenFromBallToTarget = (OwnerOrigin - HandNewPos):length()
  104.         OldWeaponPos = HandNewPos
  105.         OldWeaponAngles = HandAngles
  106.         OldVictimPos = OwnerOrigin
  107.        
  108.         CurrentLength = 0
  109.     }
  110.    
  111.     if( BallIndex >= 4 && CurrentLength < LenFromBallToTarget )
  112.     {
  113.         holoPos( BallIndex, OldWeaponPos + vec( CurrentLength * cos(OldWeaponAngles:yaw()), CurrentLength * sin(OldWeaponAngles:yaw()), CurrentLength * cos(OldWeaponAngles:pitch())) )
  114.         CurrentLength = Clock*Acceleration
  115.        
  116.         Clock += 10
  117.     }
  118.     else
  119.     {
  120.         holoDelete( BallIndex )
  121.        
  122.         OldWeraponPos = vec( 0, 0, 0 )
  123.         OldWeaponAngles = ang( 0, 0, 0 )
  124.         OldVictimPos = vec( 0, 0, 0 )
  125.        
  126.         BallIndex = -1
  127.         CurrentLength = 0
  128.         Clock = 0
  129.     }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment