Guest User

Untitled

a guest
Jan 6th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. @name FailCake Bike V1
  2. @inputs Seat:wirelink
  3. @persist Eject Offs Vels MaxSpeed TEMP Delay
  4. @persist [ANG Ang]:angle Tim Speed
  5. @trigger all
  6. @model models/props_junk/bicycle01a.mdl
  7.  
  8. runOnTick(1)
  9.  
  10. E = entity()
  11. Angs = E:angles():roll()
  12. ANG = E:angles()
  13. # By FailCake
  14. W = Seat:number("W")
  15. S = Seat:number("S")
  16. A = Seat:number("A")
  17. D = Seat:number("D")
  18. MOUSE2 = Seat:number("Mouse2")
  19. Active = Seat:number("Active")
  20. MaxSpeed = 300
  21.  
  22. rangerHitWater(0)
  23. rangerFilter(E)
  24. Rng = rangerOffset(E:pos(),E:pos()-vec(0,0,60))
  25.  
  26. if(first()){
  27. Offs = 1
  28. }
  29.  
  30.  
  31. if (Angs >= -35 & Angs <= 35 & Offs != 1){
  32. if (Rng:hit()){
  33. Diff = 24-Rng:distance()
  34. E:applyForce((vec(0,0,Diff)*20-E:vel()/30)*E:mass())
  35.  
  36. TarQ = quat(ang(0,Tim,0))
  37. CurQ = quat(E)
  38. Q = TarQ/CurQ
  39. V = E:toLocal(rotationVector(Q)+E:pos())
  40. E:applyTorque((800*V - 12*E:angVelVector())*E:inertia())
  41.  
  42. }
  43. }else{
  44. Offs = 1
  45. }
  46.  
  47. # By FailCake
  48. if(Offs == 0){
  49. if(W){
  50. if(Speed <= MaxSpeed){
  51. Speed += 50
  52. E:applyForce((E:forward()*Speed+vec(0,0,Diff)*20-E:vel())*E:mass())
  53. }else{
  54. if(Speed >= 0){
  55. Speed-=100
  56. }
  57. }
  58. }
  59.  
  60. if(S){
  61. E:applyForce((-E:forward()*200+vec(0,0,Diff)*20-E:vel())*E:mass())
  62. }else{
  63. }
  64.  
  65.  
  66. if(A){
  67. Tim+=2
  68. }else{
  69. Tim = Tim
  70. }
  71.  
  72. if(D){
  73. Tim-=2
  74. }else{
  75. Tim = Tim
  76. }
  77. }
  78. ## Ranger Holo ##
  79.  
  80. holoCreate(1)
  81. holoModel(1,"cube")
  82. holoScaleUnits(1,vec(2,15,15))
  83. holoParent(1,E)
  84. holoPos(1,E:toWorld(vec(37,0,-7)))
  85. holoAlpha(1,0)
  86. # By FailCake
  87. ## Ranger Holo ##
  88.  
  89. rangerHitWater(0)
  90. rangerFilter(E)
  91. Ranger = rangerOffset(300,holoEntity(1):pos(),holoEntity(1):forward())
  92. Distance = holoEntity(1):pos():distance(Ranger:position())
  93. Vels = E:vel():length()/10
  94.  
  95. if(Distance <= 10 & Ranger:hit() & Vels >= 20){
  96. Offs = 1
  97. }
  98.  
  99. if(Offs == 1){
  100. timer("Delay",1000)
  101. if(clk("Delay")){
  102. Offs = 0
  103. stoptimer("Delay")
  104. }
  105. }
  106.  
  107. if(Delay == 1){
  108. timer("Delay2",400)
  109. if(clk("Delay2")){
  110. Delay = 0
  111. stoptimer("Delay2")
  112. }
  113. }# By FailCake
  114.  
  115. if(MOUSE2){
  116. if(Delay == 0){
  117. E:soundPlay(100,100,"ambient/alarms/city_firebell_loop1.wav")
  118. soundPitch(100,170)
  119. Delay = 1
  120. }
  121. }else{
  122. soundStop(100)
  123. }
Advertisement
Add Comment
Please, Sign In to add comment