Guest User

Fairy V1

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