Advertisement
Guest User

fairy

a guest
Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.82 KB | None | 0 0
  1.  
  2. runOnTick(1)
  3. runOnChat(1)
  4.  
  5. if(first() | duped())
  6. {
  7. #Default Values
  8. DefaultColour = "purple"
  9. Revenge = 1
  10. Mode = 2
  11.  
  12. Owner = owner()
  13. Fairy = entity()
  14. HoloGo = 1
  15. Radius = 1
  16. hint("Hello, "+owner():name()+".",25)
  17. hint("To see a detailed list of commands, or for help, type !cmds",25)
  18. hint("If you don't have a name for me already, give me one!",25)
  19.  
  20. #Choice of colours
  21. ColourList = array()
  22. ColourList:pushString("red")
  23. ColourList:pushVector4(vec4(255,100,100,255))
  24. ColourList:pushString("blue")
  25. ColourList:pushVector4(vec4(100,200,255,255))
  26. ColourList:pushString("green")
  27. ColourList:pushVector4(vec4(100,200,100,255))
  28. ColourList:pushString("gold")
  29. ColourList:pushVector4(vec4(255,200,0,255))
  30. ColourList:pushString("pink")
  31. ColourList:pushVector4(vec4(255,95,215,255))
  32. ColourList:pushString("purple")
  33. ColourList:pushVector4(vec4(170,80,215,255))
  34. ColourList:pushString("white")
  35. ColourList:pushVector4(vec4(200,200,200,255))
  36. ColourList:pushString("invis")
  37. ColourList:pushVector4(vec4(0,0,0,0))
  38. }
  39.  
  40. if (Fairy == noentity()|Fairy:pos() == vec(0,0,0))
  41. {
  42. Owner = owner()
  43. Fairy:setAlpha(0)
  44. HoloGo = 1
  45. }
  46. else
  47. {
  48. if(HoloGo == 1)
  49. {
  50. holoCreate(0, Fairy:pos())
  51. holoParent(0, Fairy)
  52. holoModel(0, "icosphere3")
  53. holoMaterial(0, "models/props_combine/tpballglow")
  54. holoScale(0, vec(0.4,0.4,0.4))
  55. holoCreate(1, Fairy:pos())
  56. holoParent(1, Fairy)
  57. holoModel(1, "icosphere3") holoMaterial(1, "models/props_combine/tpballglow")
  58. holoScale(1, vec(0.8,0.8,0.8))
  59.  
  60. #Set Default Colour
  61. Found = 0
  62. for(I=1, ColourList:count(), 2)
  63. {
  64. if (!Found & DefaultColour == ColourList[I, string])
  65. {
  66. Fairy:setColor(vec(ColourList[I+1, vector4]), 0)
  67. Fairy:setTrails(16, 0, 10, "trails/laser", Fairy:getColor(), ColourList[I+1, vector4]:w())
  68.  
  69. holoColor(0, mix(Fairy:getColor(),vec(200,200,200),0.4),255)
  70. holoColor(1, Fairy:getColor(),255)
  71.  
  72. Found = 1
  73. }
  74. }
  75. if(!Found)
  76. {
  77. hint("Invalid default colour", 45)
  78. }
  79.  
  80. HoloGo = 0
  81. }
  82. holoAng(0, ang(0,0,0))
  83. holoAng(1, ang(0,0,0))
  84. }
  85.  
  86. if (Mode == 3)
  87. {
  88. if(TargetDeaths != Target:deaths())
  89. {
  90. Mode = LastMode
  91. if (Mode == 3)
  92. {
  93. Mode = 0
  94. }
  95. }
  96. }
  97.  
  98. if (Revenge & !isSinglePlayer() & findCanQuery())
  99. {
  100. if (PlayerCount != numPlayers())
  101. {
  102. PlayerCount = numPlayers()
  103. findExcludePlayer(owner())
  104. findByClass("Player")
  105. Players = findToArray()
  106. }
  107.  
  108. if (Deaths != Owner:deaths())
  109. {
  110. for(I=0, Players:count())
  111. {
  112. if (Players[I, entity]:frags() != PlayerKills[I, number])
  113. {
  114. Target = Players[I, entity]
  115. TargetDeaths = Target:deaths()
  116. LastMode = Mode
  117. Mode = 3
  118. }
  119. }
  120. }
  121.  
  122. Deaths = Owner:deaths()
  123.  
  124. for(I=0, Players:count())
  125. {
  126. PlayerKills[I, number] = Players[I, entity]:frags()
  127. }
  128. }
  129.  
  130. Command=Owner:lastSaid()
  131. if ((chatClk(owner()) | chatClk(Owner)) & Command:left(1)=="!")
  132. {
  133. Input = Command:explode(" ")
  134. Command=Input[1, string]:sub(2,Input[1, string]:length())
  135. Argument = Input[2, string]
  136.  
  137. hideChat(HideChat)
  138.  
  139. if(Command == "cmds")
  140. {
  141. hint("Inputs:",45)
  142. hint("'!hidechat 1/0' sets hidechat to hide chat commands.",45)
  143. hint("'!f' f follows what you're looking at",45)
  144. hint("'!f <Player>' gives the fairy to a friend",45)
  145. hint("'!rad ' sets circle radius",45)
  146. hint("'!colours' to see the available colors.",45)
  147. hint("'!colour <Colour Name>' to change to the named colour", 45)
  148. hint("'!stay' makes the fairy stay",45)
  149. hint("'!spiral 1/0' turns on/off the spiral movement",45)
  150. hint("'!revenge 1/0' turns on/off revenge mode", 45)
  151. hint("'!kill <Player>' Kill target", 45)
  152. }
  153. elseif(Command=="f")
  154. {
  155. if(Mode == 1)
  156. {
  157. Mode = 0
  158. }
  159.  
  160. if (Argument:length() > 0)
  161. {
  162. Owner = findPlayerByName(Argument)
  163. if(!Owner)
  164. {
  165. Owner = owner()
  166. hint("Invalid Target",5)
  167. }
  168. hint("Following player " + Owner:name(), 5)
  169. }
  170. else
  171. {
  172. if(Owner:aimEntity():type() == "prop_physics")
  173. {
  174. PropTarget = Owner:aimEntity():model():replace(".mdl", ""):explode("/")
  175. Owner = Owner:aimEntity()
  176. hint("Following prop ''" + PropTarget[PropTarget:count(),string] + "'' owned by " + Owner:owner():name(), 5)
  177. }
  178. elseif(Owner:aimEntity():type() == "player")
  179. {
  180. Owner = Owner:aimEntity()
  181. hint("Following player " + Owner:name(), 5)
  182. }
  183. else
  184. {
  185. hint("Invalid Target",5)
  186. }
  187. }
  188. }
  189. elseif(Command == "rad")
  190. {
  191. if(Argument:toNumber() > 25)
  192. {
  193. hint("Sadly, radius can not be set any higher than 25.",5)
  194. }
  195. else
  196. {
  197. Radius = Argument:toNumber()/10
  198. hint("Setting Radiusius to "+(Radius*10):toString()+", default is 10.",5)
  199. }
  200. }
  201. elseif(Command == "hidechat")
  202. {
  203. if (Argument == "0")
  204. {
  205. HideChat = 0
  206. hint("Showing Chat Inputs!",5)
  207. }
  208. else
  209. {
  210. HideChat = 1
  211. hint("Hiding Chat Inputs!",5)
  212. }
  213. }
  214. elseif(Command == "stay")
  215. {
  216. Mode = 1
  217. CurPos = Fairy:pos()
  218. hint("Staying here.",5)
  219. }
  220. elseif(Command == "spiral")
  221. {
  222. if (Argument == "0")
  223. {
  224. Mode = 0
  225. hint("Turning off Spiral",5)
  226. }
  227. else
  228. {
  229. Mode = 2
  230. hint("Turning on spiral",5)
  231. }
  232. }
  233. elseif(Command == "colour")
  234. {
  235. Found = 0
  236. for(I=1, ColourList:count(), 2)
  237. {
  238. if (!Found & Argument == ColourList[I, string])
  239. {
  240. Fairy:setColor(vec(ColourList[I+1, vector4]), 0)
  241. Fairy:setTrails(16, 0, 10, "trails/laser", Fairy:getColor(), ColourList[I+1, vector4]:w())
  242.  
  243. holoColor(0, mix(Fairy:getColor(),vec(200,200,200),0.4),255)
  244. holoColor(1, Fairy:getColor(),255)
  245.  
  246. hint("Setting Colour to " + ColourList[I, string], 45)
  247.  
  248. Found = 1
  249. }
  250. }
  251.  
  252. if (!Found)
  253. {
  254. hint("Invalid colour, Input !colours to see available colours", 45)
  255. }
  256. }
  257. elseif(Command == "colours")
  258. {
  259. hint("Colours:",45)
  260.  
  261. for(I=1, ColourList:count(), 2)
  262. {
  263. hint(ColourList[I, string], 45)
  264. }
  265. }
  266. elseif(Command == "revenge")
  267. {
  268. if(Argument == "0")
  269. {
  270. Revenge = 0
  271. hint("Revenge mode off", 5)
  272. }
  273. else
  274. {
  275. Revenge = 1
  276. hint("Revenge mode on", 5)
  277. }
  278. }
  279. elseif(Command == "kill")
  280. {
  281. if (Argument:length() > 0)
  282. {
  283. Target = findPlayerByName(Argument)
  284.  
  285. if (Target)
  286. {
  287. TargetDeaths = Target:deaths()
  288. LastMode = Mode
  289. Mode = 3
  290. }
  291. }
  292. else
  293. {
  294. hint("Please specify a player to kill", 5)
  295. }
  296. }
  297. }
  298.  
  299. if(Mode == 0)
  300. {
  301. FairyPos = Owner:pos()+vec(Owner:radius()*sin(curtime()*50)*Radius, Owner:radius()*cos(curtime()*50)*Radius, Owner:height()+20)
  302. Fairy:setMass(1)
  303. Fairy:applyForce(((FairyPos - Fairy:pos()) * 3 - Fairy:vel()) * Fairy:mass())
  304. }
  305. elseif(Mode == 1)
  306. {
  307. FairyPos = CurPos+vec(Owner:radius()*sin(curtime()*50)*Radius, Owner:radius()*cos(curtime()*50)*Radius,0)
  308. Fairy:setMass(1)
  309. Fairy:applyForce(((FairyPos - Fairy:pos()) * 3 - Fairy:vel()) * Fairy:mass())
  310. }
  311. elseif(Mode == 2)
  312. {
  313. FairyPos = Owner:pos()+vec(Owner:radius()*sin(curtime()*50)*Radius, Owner:radius()*cos(curtime()*50)*Radius, (Owner:radius()*cos(curtime()*10)*Radius)+Owner:height()+20)
  314. Fairy:setMass(1)
  315. Fairy:applyForce(((FairyPos - Fairy:pos()) * 3 - Fairy:vel()) * Fairy:mass())
  316. }
  317. elseif(Mode == 3)
  318. {
  319. FairyPos = Target:pos():setZ((Target:height()/2) + Target:pos():z())
  320. Fairy:setMass(50000)
  321. Fairy:applyForce(((FairyPos - Fairy:pos()) * 1) * Fairy:mass())
  322. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement