Advertisement
Guest User

Untitled

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