Advertisement
Guest User

Untitled

a guest
Apr 27th, 2015
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.91 KB | None | 0 0
  1. @name HoverBike
  2. @persist [E O Seat Driver Explo]:entity [C, RDists CrashSound ExplodeSound]:array [E2_STATUS]:string
  3. @persist HOLO_INDEX ENABLE_LAND
  4. @persist AIRBRAKE AIRBRAKE_YAW HEIGHT BRAKEFORCE ENGINE_OVERHEAT HAS_OVERHEAT
  5. @persist WHEEL_TURN WING_TIMER SPEED_TIMER SPEED_MULT MAX_SPEED LAST_ANGLE:angle ENGINE_WARNINGS EXPLODE_TIMES FORCE_PARTICLES
  6. @persist MIN_LAND MAX_LAND Pr:entity
  7. @trigger all
  8.  
  9. #models/props_combine/eli_pod_inner.mdl
  10.  
  11. #print(ops())
  12.  
  13. ## FUNCTIONS ##
  14. if(first() || duped()){
  15. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  16. function void createHolo(Model:string,Scl:number,Pos:vector,Ang:angle,Parent:entity){
  17.  
  18. holoCreate(HOLO_INDEX)
  19. holoModel(HOLO_INDEX,Model)
  20. holoPos(HOLO_INDEX,Parent:toWorld(Pos))
  21. holoAng(HOLO_INDEX,Parent:toWorld(Ang))
  22. holoScale(HOLO_INDEX,vec(1/Scl,1/Scl,1/Scl))
  23. holoParent(HOLO_INDEX,Parent)
  24.  
  25. if(Model == "cube"){
  26. holoAlpha(HOLO_INDEX,0)
  27. }
  28.  
  29. HOLO_INDEX+=1
  30. }
  31.  
  32. function void createHolo(Model:string,Scl:vector,Pos:vector,Ang:angle,Parent:entity){
  33.  
  34. holoCreate(HOLO_INDEX)
  35. holoModel(HOLO_INDEX,Model)
  36. holoPos(HOLO_INDEX,Parent:toWorld(Pos))
  37. holoAng(HOLO_INDEX,Parent:toWorld(Ang))
  38. holoScaleUnits(HOLO_INDEX,Scl)
  39. holoParent(HOLO_INDEX,Parent)
  40.  
  41. if(Model == "cube"){
  42. holoAlpha(HOLO_INDEX,0)
  43. }
  44.  
  45. HOLO_INDEX+=1
  46. }
  47.  
  48. function void createSpaceBike_Part_1(){
  49. HOLO_INDEX = 0
  50. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  51. ## Main Screen ##
  52. createHolo("models/props_combine/breenconsole.mdl",1,vec(1.35,23.9,6.36),ang(0,-180,-90),E) ## Bellow Part Combine 1 ##
  53. createHolo("models/props_combine/combine_smallmonitor001.mdl",1,vec(0,-18,-7.32),ang(-90,90,180),E)
  54. createHolo("models/props_combine/combine_smallmonitor001.mdl",1,vec(0,-35,-7.32),ang(-90,90,180),E)
  55. ## ENGINES LIGHTS FRONT ##
  56. createHolo("models/maxofs2d/thruster_propeller.mdl",1,vec(-22.65,20.41,-2.32),ang(90,90,0),E)
  57. createHolo("models/maxofs2d/thruster_propeller.mdl",1,vec(22.65,20.41,-2.32),ang(90,90,0),E)
  58. ## ENGINES LIGHTS BACK ##
  59. createHolo("models/props_wasteland/light_spotlight01_lamp.mdl",1,vec(0,51.06,0.83),ang(0,90,0),E)
  60. ## CHAIR ##
  61. createHolo("models/nova/jeep_seat.mdl",1,vec(-0.26,31.9,3.3),ang(0,180,0),E) holoAlpha(HOLO_INDEX - 1,100)
  62. ## PIPE CHAIR ##
  63. createHolo("models/props_lab/pipesystem03a.mdl",1,vec(0,48,16),ang(0,-180,45),E)
  64. ## Floor Prop ##
  65. createHolo("models/props_combine/breenpod_inner.mdl",1,vec(0.11,-18.58,-5),ang(90,-90,180),E) ## Combine Emitters SIDES ##
  66. createHolo("models/props_combine/combine_emitter01.mdl",1,vec(5.34,3.67,-1.91),ang(0,-90,-90),E)
  67. createHolo("models/props_combine/combine_emitter01.mdl",1,vec(-5.34,3.67,-1.91),ang(0,-90,90),E)
  68. ## Combine Emitters BACK ##
  69. createHolo("models/props_combine/combine_emitter01.mdl",1,vec(-2.65,45,-3.3),ang(0,90,-135),E)
  70. createHolo("models/props_combine/combine_emitter01.mdl",1,vec(2.65,45,-3.3),ang(0,90,135),E)
  71. createHolo("models/props_combine/combine_emitter01.mdl",1,vec(0.35,-53.1,0.36),ang(0,-90,0),E)
  72. ## ENGINE ##
  73. createHolo("models/props_c17/trappropeller_engine.mdl",1,vec(-2,-26.1,7.36),ang(90,90,0),E) ## Light Combine Sides ##
  74. createHolo("models/props_combine/combine_light002a.mdl",1,vec(-6.35,-5,2.36),ang(0,0,90),E)
  75. createHolo("models/props_combine/combine_light002a.mdl",1,vec(6.35,-5,2.36),ang(0,180,-90),E)
  76. ## Light Combine Bottom ##
  77. createHolo("models/props_combine/combine_light002a.mdl",1,vec(-0.18,7.85,-6.01),ang(-90,90,180),E)
  78. createHolo("models/props_combine/combine_light002a.mdl",1,vec(-0.18,-35.85,-6.01),ang(-90,90,180),E)
  79. ## Barricade FRONT ##
  80. createHolo("models/props_combine/combine_barricade_bracket01b.mdl",1,vec(9.29,-59.63,-5.1),ang(0,-90,0),E)
  81. createHolo("models/props_combine/combine_barricade_bracket01b.mdl",1,vec(-9.35,-58.77,-1.99),ang(0,-90,-180),E)
  82. ## Barricade BACK ##
  83. createHolo("models/props_combine/combine_barricade_bracket01b.mdl",1,vec(22.03,-18.48,-7.54),ang(0,0,180),E)
  84. createHolo("models/props_combine/combine_barricade_bracket01b.mdl",1,vec(-22.03,-18.48,-7.54),ang(0,-180,0),E)
  85. ## HELI HOVER ##
  86. createHolo("cube",3,vec(-22.03,-18.48,-7.54),ang(90,65,-90),E)
  87. createHolo("models/props_combine/combine_fence01a.mdl",2,vec(0,0,0),ang(0,0,0),holoEntity(HOLO_INDEX - 1))
  88. createHolo("cube",3,vec(22.03,-18.48,-7.54),ang(-90,115,90),E)
  89. createHolo("models/props_combine/combine_fence01a.mdl",2,vec(0,0,0),ang(0,0,0),holoEntity(HOLO_INDEX - 1))
  90. ## WHEEL ##
  91. createHolo("cube",2,vec(0,0,18),ang(0,-180,50),E)
  92. createHolo("models/props_pipes/valvewheel002.mdl",1,vec(0,0,0),ang(0),holoEntity(HOLO_INDEX - 1))
  93. ## WHEEL BACK ##
  94. createHolo("models/props_lab/reciever01b.mdl",2,vec(0,0,17),ang(0,180,-50),E)
  95. ## WHEEL ENGINE ##
  96. createHolo("models/props_vehicles/tire001c_car.mdl",1,vec(0,44,4),ang(0,90,0),E)
  97.  
  98. ### EXECUTE PART 2 ##
  99. timer("create_part_2",100)
  100. }
  101.  
  102. function void createSpaceBike_part_2(){
  103.  
  104. ## RADIO THINGY ##
  105. createHolo("models/props_lab/reciever01b.mdl",1,vec(0,-0.6,13),ang(-20,90,0),E)
  106. ## PANEL - 33##
  107. createHolo("models/props_combine/combine_binocular01.mdl",1,vec(-12,2.6,-8),ang(-20,90,0),E)
  108. holoClipEnabled(HOLO_INDEX - 1,1)
  109. holoClip(HOLO_INDEX - 1,vec(0,0,5),holoEntity(HOLO_INDEX - 1):up(),0)
  110. ## PANEL OVEHEAT ##
  111. createHolo("hqicosphere",7,vec(4.6,12.8,2.6),ang(0,0,0),holoEntity(HOLO_INDEX - 2))
  112. holoColor(HOLO_INDEX - 1,vec(1,1,1))
  113.  
  114. ## PANEL OVERHEAT - 36##
  115. createHolo("models/bull/dynamicbutton.mdl",2,vec(0,17.4,4.1),ang(0,90,90),holoEntity(HOLO_INDEX))
  116. createHolo("dome",7,vec(0,17.4,4.1),ang(0,90,90),holoEntity(HOLO_INDEX - 4))
  117. holoColor(HOLO_INDEX - 1,vec(1,1,1))
  118. createHolo("pyramid",vec(0.1,0.6,1.2),vec(0.6,0,0.8),ang(90,0,0),holoEntity(36))
  119. holoColor(HOLO_INDEX - 1,vec(1,1,1))
  120. createHolo("hqcylinder",vec(3,3,0.1),vec(0,0,0.5),ang(0,0,0),holoEntity(35))
  121. holoColor(HOLO_INDEX - 1,vec(255,1,1))
  122. holoClipEnabled(HOLO_INDEX - 1,1,1)
  123. holoClipEnabled(HOLO_INDEX - 1,2,1)
  124. holoClip(HOLO_INDEX - 1,1,vec(0,0,0),holoEntity(HOLO_INDEX - 1):right(),0)
  125. holoClip(HOLO_INDEX - 1,2,vec(0,0,0),-holoEntity(HOLO_INDEX - 1):forward(),0)
  126.  
  127. ## PANEL SHIFTING - 39##
  128. createHolo("models/bull/dynamicbutton.mdl",3.5,vec(0.4,16.46,1.46),ang(0,90,90),holoEntity(32)) holoColor(HOLO_INDEX - 1,vec(1,1,1))
  129.  
  130. ## PANEL WING - 40 ##
  131. createHolo("models/bull/dynamicbutton.mdl",2,vec(0.2,17.44,-1.3),ang(0,90,90),holoEntity(32)) createHolo("dome",7,vec(0,0,0),ang(0,0,0),holoEntity(HOLO_INDEX - 1))
  132. holoColor(HOLO_INDEX - 1,vec(1,1,1))
  133. createHolo("pyramid",vec(0.1,0.6,1.2),vec(0.6,0,0.8),ang(90,0,0),holoEntity(41))
  134. holoColor(HOLO_INDEX - 1,vec(1,1,1))
  135. createHolo("hqcylinder",vec(3,3,0.1),vec(0,0,0.5),ang(0,0,0),holoEntity(40))
  136. holoColor(HOLO_INDEX - 1,vec(1,1,255))
  137. holoClipEnabled(HOLO_INDEX - 1,1,1)
  138. holoClipEnabled(HOLO_INDEX - 1,2,1)
  139. holoClip(HOLO_INDEX - 1,1,vec(0,0,0),holoEntity(HOLO_INDEX - 1):right(),0)
  140. holoClip(HOLO_INDEX - 1,2,vec(0,0,0),-holoEntity(HOLO_INDEX - 1):forward(),0)
  141.  
  142.  
  143.  
  144. #ifdef lightParent(normal,entity)
  145. lightCreate(1,E:toWorld(vec(0,-25,-5)),vec(0,90,170),20,209)
  146. lightCreate(2,E:toWorld(vec(0,25,-5)),vec(0,90,170),20,209)
  147. lightCreate(3,holoEntity(5):toWorld(vec(20,0,0)),vec(255,255,255),20,209)
  148. lightParent(1,E)
  149. lightParent(2,E)
  150. lightParent(3,holoEntity(5))
  151. #endif
  152.  
  153. E2_STATUS = "WAITING"
  154. }
  155.  
  156. function normal entity:hover(Height, Cor:array, Airbrake, AirbrakeYaw) { #This is the hot, homosexual, heterosexual hovering function by sandvich :3
  157. local Hit = 0
  158.  
  159. foreach(K,V:vector = Cor) {
  160. rangerFilter(E)
  161. rangerFilter(players())
  162. rangerHitWater(1)
  163. local R = rangerOffsetHull(Height, E:toWorld(V), -This:up(),vec(5,5,1))
  164.  
  165. local Dist = max(0, R:distance())
  166. local Delta = Dist - RDists[K, number]
  167. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  168. if(R:hit()) {
  169. E:applyOffsetForce(This:up() * (Height - (Dist + Delta * 5)) * This:mass() * 0.25, This:toWorld(V))
  170. XVel = This:velL():x()
  171. YVel = This:velL():y()
  172.  
  173. This:applyForce((This:toWorld(vec(-XVel,-YVel * 2,0)) - This:pos()) * Airbrake)
  174.  
  175. This:applyAngForce(-This:angVel():setPitch(0):setRoll(0) * AirbrakeYaw)
  176.  
  177. Hit = 1 #So lazy
  178. }
  179.  
  180. RDists[K, number] = Dist
  181. }
  182. return Hit
  183. }
  184.  
  185. function array entity:getCorners() {
  186. local Size = This:boxSize() / 2
  187. local Cor = array()
  188.  
  189. Cor:pushVector(vec(Size:x(), Size:y(), 0))
  190. Cor:pushVector(vec(-Size:x(), Size:y(), 0))
  191. Cor:pushVector(vec(Size:x(), -Size:y(), 0))
  192. Cor:pushVector(vec(-Size:x(), -Size:y(), 0))
  193.  
  194. return Cor
  195. }
  196.  
  197. function array entity:getCorners(OffsetX, OffsetY) {
  198. local Size = This:boxSize() / 2
  199. local Cor = array()
  200.  
  201. Cor:pushVector(vec(Size:x() + OffsetX, Size:y() + OffsetY, 0))
  202. Cor:pushVector(vec(-Size:x() - OffsetX, Size:y() + OffsetY, 0))
  203. Cor:pushVector(vec(Size:x() + OffsetX, -Size:y() - OffsetY, 0))
  204. Cor:pushVector(vec(-Size:x() - OffsetX, -Size:y() - OffsetY, 0))
  205.  
  206. return Cor
  207. }
  208.  
  209. function void turnLights(On:number){
  210. #ifdef lightParent(normal,entity)
  211. lightToggle(1,On)
  212. lightToggle(2,On)
  213. lightToggle(3,On)
  214. #endif
  215. }
  216.  
  217. function void setWings(Tim:number){
  218.  
  219. local TM = Tim / 1200
  220.  
  221. WING_TIMER = TM
  222.  
  223. if(TM < 0){
  224. TM = 0
  225. WING_TIMER = 0
  226. }elseif(TM > 1){
  227. TM = 1
  228. WING_TIMER = 1
  229. }
  230.  
  231. local Ang_Left = mix(ang(90,65,-90),ang(90,10,-90),TM)
  232. local Ang_Right = mix(ang(-90,115,90),ang(-90,170,90),TM)
  233.  
  234. holoAng(23,E:toWorld(Ang_Left))
  235. holoAng(25,E:toWorld(Ang_Right))
  236. }
  237.  
  238. function void setWingsAuto(Speed:number){
  239.  
  240. if(WING_TIMER <= 1 && WING_TIMER >= 0){
  241. WING_TIMER += Speed
  242. }
  243.  
  244. local Ang_Left = mix(ang(90,65,-90),ang(90,10,-90),WING_TIMER)
  245. local Ang_Right = mix(ang(-90,115,90),ang(-90,170,90),WING_TIMER)
  246.  
  247. holoAng(23,E:toWorld(Ang_Left))
  248. holoAng(25,E:toWorld(Ang_Right))
  249. }
  250.  
  251. function void setWheel(TurnSpeed:number){
  252.  
  253. if(WHEEL_TURN < 40 && WHEEL_TURN > -40){
  254. WHEEL_TURN += TurnSpeed
  255. }
  256.  
  257. if(TurnSpeed == 0){
  258.  
  259. if(WHEEL_TURN < 0){
  260. WHEEL_TURN += 2
  261. }elseif(WHEEL_TURN > 0){
  262. WHEEL_TURN -= 2
  263. }
  264.  
  265. }
  266. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  267. local Ang = ang(0,WHEEL_TURN,0)
  268. holoAng(28,holoEntity(27):toWorld(Ang))
  269. }
  270.  
  271. function void setLand(State:number,Speed:number){
  272.  
  273. if(ENABLE_LAND){
  274. if(!State){
  275. if(HEIGHT > MIN_LAND){
  276. HEIGHT -= Speed
  277. }else{
  278. ENABLE_LAND = 0
  279. HEIGHT = MIN_LAND
  280. }
  281. }else{
  282. if(HEIGHT < MAX_LAND){
  283. HEIGHT += Speed
  284. }else{
  285. ENABLE_LAND = 0
  286. HEIGHT = MAX_LAND
  287. }
  288. }
  289.  
  290. }
  291.  
  292.  
  293. }
  294.  
  295. function void entity:setMovement(Force:number){
  296.  
  297. Force = Force * E:mass() * 2
  298. This:applyForce(This:right() * Force * AIRBRAKE)
  299.  
  300. }
  301.  
  302. function void entity:setTurning(Force:number){
  303.  
  304. Force = Force * E:mass() * 2
  305.  
  306. if(Force > 0){
  307. This:applyOffsetForce(This:forward() , -This:right() * Force)
  308. }else{
  309. This:applyOffsetForce(-This:forward() , This:right() * Force)
  310. }
  311. }
  312.  
  313. function number entity:collide(){
  314.  
  315. rangerFilter(E)
  316. rangerHitWater(0)
  317. Rng = rangerOffsetHull(5,E:toWorld(vec(0,-70,0)),E:right(),vec(10,40,10))
  318.  
  319. local Hit = 0
  320.  
  321. if(changed(Rng:hit()) && Rng:hit()){
  322.  
  323. local Vl = E:vel():length() / 2
  324. if(Vl >= 200){
  325. E:soundPlay(99,10,CrashSound[randint(1,CrashSound:count()),string])
  326. SPEED_TIMER = 0
  327. }
  328.  
  329. }
  330.  
  331. if(Rng:hit()){
  332. Hit = 1
  333. }
  334.  
  335. return Hit
  336. }
  337.  
  338. function entity getSeat(){
  339.  
  340. findIncludePlayerProps(owner())
  341. findByClass("prop_vehicle_prisoner_pod")
  342. findByModel("models/nova/jeep_seat")
  343.  
  344. local Chrs = findToArray()
  345. local I = 0
  346.  
  347. for(I = 0,Chrs:count()){
  348. if(Chrs[I,entity]:isVehicle() && Chrs[I,entity]:getAlpha() > 0){
  349. print("Found Seat! Parenting It!")
  350. return Chrs[I,entity]
  351. }
  352. }
  353.  
  354. return noentity()
  355. }
  356. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  357. function void explodeShip(){
  358.  
  359. Explo = propSpawn("models/props_c17/oildrum001_explosive.mdl",E:pos(),ang(0,0,0),0)
  360. Explo:parentTo(E)
  361. Explo:setAlpha(0)
  362.  
  363. Explo:propBreak()
  364. EXPLODED = 1
  365.  
  366. }
  367.  
  368. function void startUp(){
  369.  
  370. E:soundPlay(1,5,"ambient/machines/thumper_startup1.wav")
  371. E:soundPlay(2,0,"thrusters/hover00.wav")
  372.  
  373. soundVolume(2,0.4)
  374. soundPitch(2,30)
  375.  
  376. holoEntity(16):soundPlay(10,0,"vehicles/v8/v8_idle_loop1.wav")
  377. holoEntity(16):soundPlay(11,0,"vehicles/v8/v8_firstgear_rev_loop1.wav")
  378. holoEntity(16):soundPlay(12,0,"vehicles/v8/fourth_cruise_loop2.wav")
  379. holoEntity(16):soundPlay(13,0,"ambient/machines/spin_loop.wav")
  380.  
  381. soundVolume(10,0.3)
  382. soundVolume(11,0)
  383. soundVolume(12,0)
  384. soundVolume(13,0)
  385.  
  386. }
  387.  
  388. function void shutDown(){
  389. E:soundPlay(1,5,"ambient/machines/thumper_shutdown1.wav")
  390. holoEntity(16):soundPlay(10,0,"vehicles/v8/v8_stop1.wav")
  391. soundVolume(10,0.3)
  392. soundStop(11)
  393. soundStop(12)
  394. soundStop(2,1)
  395. }
  396.  
  397. function void normalizeOverHeat(){
  398.  
  399. if(ENGINE_OVERHEAT > 0){
  400. ENGINE_OVERHEAT -= 0.05
  401. }
  402.  
  403. if(ENGINE_OVERHEAT < 10 && ENGINE_WARNINGS == 1){
  404. ENGINE_WARNINGS = 0
  405. holoColor(34,vec(1,1,1))
  406. }
  407. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  408. if(ENGINE_OVERHEAT > 1){
  409. soundVolume(13,0.5)
  410. soundPitch(13,60 + (ENGINE_OVERHEAT*200)/10)
  411. }elseif(HAS_OVERHEAT){
  412. soundVolume(13,0)
  413. holoColor(14,vec(255,255,255))
  414. HAS_OVERHEAT = 0
  415. holoEntity(16):soundPlay(20,10,"ambient/machines/spindown.wav")
  416. }
  417.  
  418. holoColor(39,vec(1,1,1))
  419.  
  420. }
  421.  
  422. function void startOverHeat(){
  423. ### OVERHEAT ###
  424. if(ENGINE_OVERHEAT < 13){
  425. ENGINE_OVERHEAT += 0.02
  426.  
  427. if(ENGINE_OVERHEAT >= 10 && ENGINE_WARNINGS == 0){
  428. ENGINE_WARNINGS = 1
  429. holoColor(34,vec(255,0,0))
  430. }
  431.  
  432. }else{
  433.  
  434. if(E2_STATUS != "EXPLODING"){
  435.  
  436. E2_STATUS = "EXPLODING"
  437. ENGINE_WARNINGS = 0
  438. soundPurge()
  439. Seat:ejectPod()
  440.  
  441. E:propFreeze(0)
  442. E:applyForce(E:up()*700000)
  443. E:applyTorque(E:forward()*700000)
  444.  
  445. timer("explode",100)
  446.  
  447. }
  448.  
  449. }
  450.  
  451. holoColor(39,vec(1,255,1))
  452. soundVolume(13,0.5)
  453.  
  454. }
  455.  
  456. function void metterController(){
  457.  
  458. local Ang = (ENGINE_OVERHEAT * 360) / 13
  459. holoAng(36,holoEntity(35):toWorld(ang(0,-Ang,0)))
  460.  
  461. local Ang_speed = abs((SPEED_TIMER * 360) / 15)
  462. holoAng(41,holoEntity(40):toWorld(ang(0,-Ang_speed,0)))
  463.  
  464. }
  465.  
  466. function void soundController(){
  467.  
  468. if(E2_STATUS == "ACTIVE" && Seat:isValid()){
  469.  
  470. ## SOUND CONTROLL
  471. local Snd = (abs(SPEED_TIMER)*200)/15 + 30
  472. soundPitch(11,Snd)
  473. soundPitch(12,Snd)
  474.  
  475. local Speed = (E:vel():length() / 2)
  476.  
  477. if(Speed < 50){
  478. soundVolume(10,0.3)
  479. soundVolume(11,0)
  480. soundVolume(12,0)
  481. soundVolume(2,0)
  482. }elseif(Speed >= 100 && Speed <= 380){
  483. soundVolume(12,0)
  484. soundVolume(10,0)
  485. soundVolume(11,0.3)
  486. soundVolume(2,0.6)
  487. }else{
  488. soundVolume(12,0.3)
  489. soundVolume(10,0)
  490. soundVolume(11,0)
  491. }
  492.  
  493. }
  494. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  495. soundPitch(13,60 + (ENGINE_OVERHEAT*200)/10)
  496.  
  497. }
  498.  
  499. }
  500.  
  501. ###############
  502.  
  503. interval(20)
  504.  
  505. if(first() || duped()){
  506.  
  507. hint("Made By FailCake :D (edunad) -> http://www.youtube.com/user/edunad ",7)
  508. hint("Spawn a chair (the same that the holo!)",7)
  509. hint("If the holos are white, the server doen't have holomodelany =S",7)
  510.  
  511. #ifdef propSpawnEffect(number)
  512. E = propSpawn("models/hunter/plates/plate1x2.mdl",entity():pos(),entity():angles(),1)
  513. entity():setAlpha(0)
  514. entity():propNotSolid(1)
  515. print("PropCore Enabled! Building Space Bike")
  516. #else
  517. print("PropCore Not Found!")
  518. selfDestructAll()
  519. #endif
  520.  
  521. O = owner()
  522. Seat = noentity()
  523.  
  524. E:setAlpha(0)
  525. E:setMass(500)
  526.  
  527. ## SETTINGS ##
  528. AIRBRAKE = 3
  529. BRAKEFORCE = 0.1
  530. AIRBRAKE_YAW = 100
  531. HEIGHT = 32
  532. E2_STATUS = "BUILDING_SHIP"
  533.  
  534. MIN_LAND = 22
  535. MAX_LAND = 45
  536. FORCE_PARTICLES = 0
  537.  
  538. C = E:getCorners(-5,-5) #So many great corners to explore
  539. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  540. CrashSound:pushString("vehicles/v8/vehicle_impact_heavy1.wav")
  541. CrashSound:pushString("vehicles/v8/vehicle_impact_heavy2.wav")
  542. CrashSound:pushString("vehicles/v8/vehicle_impact_heavy3.wav")
  543. CrashSound:pushString("vehicles/v8/vehicle_impact_heavy4.wav")
  544.  
  545. createSpaceBike_Part_1()
  546. }
  547.  
  548.  
  549. if(Seat == noentity() && E2_STATUS == "WAITING"){
  550.  
  551. Seat = getSeat()
  552.  
  553. if( Seat:isValid() ){
  554.  
  555. E:propFreeze(1)
  556. Seat:propFreeze(1)
  557. Seat:setPos(holoEntity(6):pos())
  558. Seat:setAng(holoEntity(6):angles())
  559. holoAlpha(6,255)
  560. timer("parenter",400)
  561. timer("particles",50)
  562. timer("warning",50)
  563.  
  564. }
  565.  
  566. }
  567.  
  568. ## Sounds ##
  569. # physics/metal/metal_large_debris2.wav
  570. # thrusters/rocket00.wav
  571. # ambient/materials/cartrap_explode_impact1.wav -> 2
  572. # vehicles/v8/vehicle_impact_heavy1.wav -> 4
  573. # ambient/machines/spin_loop.wav
  574. # ambient/machines/spindown.wav
  575. ## EXECUTE ##
  576.  
  577. if(E2_STATUS != "EXPLODING"){
  578.  
  579. Hit = E:hover(HEIGHT, C, AIRBRAKE, AIRBRAKE_YAW)
  580. Collision = E:collide()
  581.  
  582. soundController()
  583. }
  584.  
  585. metterController()
  586.  
  587. ## EXECUTE ##
  588.  
  589. if(Seat:isValid() && E2_STATUS != "EXPLODING"){
  590.  
  591. Driver = Seat:driver()
  592.  
  593. if(Driver:isValid() && E2_STATUS != "EXPLODING"){
  594.  
  595. if(E2_STATUS == "READY"){
  596.  
  597. E2_STATUS = "TMP_WAIT"
  598. timer("hold",500)
  599. ENABLE_LAND = 1
  600. startUp()
  601. turnLights(1)
  602.  
  603. }
  604.  
  605. setLand(1,0.6)
  606.  
  607. }else{
  608.  
  609. if(E2_STATUS == "ACTIVE"){
  610.  
  611. E2_STATUS = "READY"
  612. ENABLE_LAND = 1
  613. SPEED_TIMER = 0
  614. shutDown()
  615. turnLights(0)
  616.  
  617. }
  618.  
  619. normalizeOverHeat()
  620. setWingsAuto(-0.01)
  621. setLand(0,0.6)
  622. }
  623.  
  624. }elseif(!Seat:isValid() && E2_STATUS != "WAITING" && E2_STATUS != "BUILDING_SHIP" || !E:isValid()){
  625. E:propDelete()
  626. selfDestructAll()
  627. }
  628.  
  629. ## Driver Controls ##
  630.  
  631. if(E2_STATUS == "ACTIVE" && Driver:isValid()){
  632.  
  633. local W = Driver:keyPressed("w")
  634. local A = Driver:keyPressed("a")
  635. local S = Driver:keyPressed("s")
  636. local D = Driver:keyPressed("d")
  637.  
  638. local Shift = Driver:keySprint()
  639.  
  640. if(Driver:keyUse()){
  641. Seat:ejectPod()
  642. }
  643. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  644. if(changed(Shift) && Shift){
  645. holoEntity(16):soundPlay(31,3,"buttons/lever5.wav")
  646. HAS_OVERHEAT = 1
  647. }
  648.  
  649. if(Shift){
  650.  
  651. # Give speed to fly!
  652. SPEED_MULT = 0.1
  653. MAX_SPEED = 15
  654. setWings(E:vel():length() / 2)
  655. startOverHeat()
  656.  
  657. }else{
  658.  
  659. MAX_SPEED = 6
  660. SPEED_MULT = 0.05
  661. setWingsAuto(-0.01)
  662. normalizeOverHeat()
  663.  
  664. }
  665.  
  666. ## MOVEMENT ##
  667.  
  668. if(W && Collision != 1){
  669.  
  670. if(SPEED_TIMER < MAX_SPEED){
  671. SPEED_TIMER += SPEED_MULT
  672. }elseif(SPEED_TIMER > MAX_SPEED){
  673. SPEED_TIMER -= SPEED_MULT
  674. }
  675.  
  676. }elseif(S){
  677.  
  678. if(SPEED_TIMER > -2){
  679. SPEED_TIMER -= SPEED_MULT
  680. }
  681.  
  682. }else{
  683.  
  684. if(SPEED_TIMER > 0){
  685. SPEED_TIMER -= BRAKEFORCE
  686. }elseif(SPEED_TIMER < 0){
  687. SPEED_TIMER += BRAKEFORCE
  688. }
  689.  
  690. }
  691. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  692. E:setMovement(SPEED_TIMER)
  693.  
  694. if(A){
  695. E:setTurning(-25)
  696. setWheel(2)
  697. }elseif(D){
  698. E:setTurning(25)
  699. setWheel(-2)
  700. }else{
  701. setWheel(0)
  702. }
  703.  
  704. }
  705.  
  706. if(E2_STATUS == "EXPLODING"){
  707. Seat:ejectPod()
  708. }
  709.  
  710. if(E2_STATUS == "ACTIVE"){
  711. if(!Hit){
  712. Ang = (LAST_ANGLE - E:angles())
  713. E:applyAngForce(((Ang + $Ang * 2) * E:mass() * 0.4):setYaw(0))
  714. E:setMovement(0)
  715. SPEED_TIMER = 0
  716. }
  717. }
  718.  
  719. ## SAVE ANGLE ##
  720. if(changed(Hit) && Hit == 0){
  721. LAST_ANGLE = E:angles():setRoll(0)
  722. }
  723.  
  724. ## CLK ##
  725.  
  726. if(clk("particles")){
  727.  
  728. if(E2_STATUS == "ACTIVE" || E2_STATUS == "EXPLODING"){
  729.  
  730. if((E:vel():length() / 2) < 100 || FORCE_PARTICLES == 1){
  731.  
  732. #ifdef particleGravity(vector)
  733. if(FORCE_PARTICLES != 1){
  734. particle(2,5,5,"particle/smokesprites_000" + randint(1,9),vec(130,130,130),holoEntity(16):toWorld(vec(0,-13,15)),vec(randint(1,20),randint(1,20),20))
  735. }else{
  736. local I = 0
  737. for(I = 0,5){
  738. particle(2,5,5,"particle/smokesprites_000" + randint(1,9),vec(1,1,1),holoEntity(16):toWorld(vec(0,-13,15)),vec(randint(1,20),randint(1,20),20))
  739. }
  740. }
  741. #endif
  742.  
  743. timer("particles",150)
  744.  
  745. }else{
  746. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  747. #ifdef particleGravity(vector)
  748. local I = 0
  749. for(I = 0,5){
  750. particle(2,3,3,"sprites/blueglow2",vec(130,130,130),holoEntity(5):pos(),vec(randint(-10,10),randint(-10,10),randint(-10,10)))
  751. }
  752. #endif
  753.  
  754. timer("particles",1)
  755. }
  756.  
  757. }else{
  758. timer("particles",150)
  759. }
  760.  
  761. }
  762.  
  763. if(clk("create_part_2")){
  764. createSpaceBike_part_2()
  765. }
  766.  
  767. if(clk("explode")){
  768.  
  769. if(EXPLODE_TIMES < 3){
  770.  
  771. timer("explode",randint(500,800))
  772. explodeShip()
  773. EXPLODE_TIMES+=1
  774.  
  775. }else{
  776.  
  777. EXPLODE_TIMES = 0
  778. E:soundPlay(10,0,"ambient/gas/steam2.wav")
  779. soundVolume(10,0.5)
  780. holoColor(14,vec(1,1,1))
  781. timer("restart",10000)
  782. FORCE_PARTICLES = 1
  783.  
  784. }
  785.  
  786. }
  787. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  788. if(clk("restart")){
  789. soundStop(10,2)
  790. E2_STATUS = "ACTIVE"
  791. SPEED_TIMER = 0
  792. ENGINE_OVERHEAT = 0
  793. FORCE_PARTICLES = 0
  794. holoColor(14,vec(255,255,255))
  795. holoColor(39,vec(1,1,1))
  796. holoColor(34,vec(1,1,1))
  797. }
  798.  
  799. if(clk("warning")){
  800.  
  801. if(ENGINE_WARNINGS){
  802. holoEntity(16):soundPlay(26,2,"buttons/button17.wav")
  803. }
  804.  
  805. timer("warning",1000)
  806. }
  807. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
  808.  
  809. if(clk("hold")){
  810. E2_STATUS = "ACTIVE"
  811. }
  812.  
  813. if(clk("parenter")){
  814. if(Seat != noentity()){
  815. Seat:parentTo(E)
  816. Seat:propFreeze(0)
  817. Seat:setAlpha(0)
  818. E:propFreeze(0)
  819. E2_STATUS = "READY"
  820. }
  821. }
  822. # By FailCake :D (edunad) -> http://www.youtube.com/user/edunad
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement