Walterin0

Untitled

Apr 5th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.92 KB | None | 0 0
  1. --SynapseX Decompiler
  2.  
  3. repeat
  4. wait()
  5. until game.Players.LocalPlayer
  6. local nocol = {}
  7. nocol.events = {}
  8. nocol.cache = {}
  9. nocol.classes = {}
  10. nocol.network = {}
  11. nocol.springs = {}
  12. function waitfor2(parent, child)
  13. repeat
  14. wait()
  15. until parent:FindFirstChild(child)
  16. return parent[child]
  17. end
  18. waitfor = workspace.WaitForChild
  19. nocol.cache = {
  20. max = math.max,
  21. min = math.min,
  22. abs = math.abs,
  23. sin = math.sin,
  24. cos = math.cos,
  25. tan = math.tan,
  26. rnd = math.random,
  27. sed = math.randomseed,
  28. deg = math.deg,
  29. pie = math.pi,
  30. rad = math.rad,
  31. acos = math.acos,
  32. asin = math.asin,
  33. clmp = math.clamp,
  34. sign = math.sign,
  35. vc2 = Vector2.new,
  36. _vc2 = Vector2.new(),
  37. vc3 = Vector3.new,
  38. _vc3 = Vector3.new(),
  39. ud2 = UDim2.new,
  40. _ud2 = UDim2.new(),
  41. ud1 = UDim.new,
  42. _ud1 = UDim.new(),
  43. cfr = CFrame.new,
  44. _cfr = CFrame.new(),
  45. ang = CFrame.Angles,
  46. _ang = CFrame.Angles(0, 0, 0),
  47. ray = Ray.new,
  48. ins = Instance.new,
  49. ser = game.GetService,
  50. gap = 30,
  51. findchild = workspace.FindFirstChild,
  52. player = game.Players.LocalPlayer,
  53. pgui = game.Players.LocalPlayer.PlayerGui,
  54. camera = workspace.CurrentCamera,
  55. waitfor = workspace.WaitForChild,
  56. backpack = waitfor2(game.Players.LocalPlayer, "Backpack"),
  57. mouse = game.Players.LocalPlayer:GetMouse(),
  58. lerp = function(a, b, t)
  59. return (1 - t) * a + t * b
  60. end,
  61. cspace = 0,
  62. run = game:GetService("RunService"),
  63. input = game:GetService("UserInputService")
  64. }
  65. ang = nocol.cache.ang
  66. rad = nocol.cache.rad
  67. cfr = nocol.cache.cfr
  68. v3 = nocol.cache.vc3
  69. min = nocol.cache.min
  70. max = nocol.cache.max
  71. rdef = cfr(1, 0.5, 0, -4.37113883E-8, 0, 1, 0, 0.99999994, 0, -1, 0, -4.37113883E-8)
  72. ldef = cfr(-1, 0.5, 0, -4.37113883E-8, 0, -1, 0, 0.99999994, 0, 1, 0, -4.37113883E-8)
  73. nocol.cache.func = waitfor(game.ReplicatedStorage, "NoCol_Function")
  74. nocol.cache.event = waitfor(game.ReplicatedStorage, "NoCol_Event")
  75. do
  76. local a, b = 69, 420
  77. function nocol.network.call(call, ...)
  78. nocol.cache.func:InvokeServer(call, [[
  79.  
  80.  
  81.  
  82. }]], ",{METATABLE DOESNT EXIST,", [[
  83.  
  84.  
  85. ]], ...)
  86. end
  87. function nocol.network.receive(call, ...)
  88. end
  89. end
  90. nocol.classes.bullet = require(script.MODULES.BULLETS)
  91. nocol.classes.animate = require(script.MODULES.ANIMATE)
  92. nocol.classes.effect = require(script.MODULES.EFFECTS)
  93. nocol.classes.misc = require(script.MODULES.MISC)
  94. nocol.springs.fire = nocol.classes.misc.physics.spring.new(v3())
  95. nocol.springs.fire.s = 70
  96. nocol.springs.fire.d = 1
  97. nocol.springs.cam = nocol.classes.misc.physics.spring.new(v3())
  98. nocol.springs.cam.s = 35
  99. nocol.springs.cam.d = 1
  100. nocol.classes.tool = {
  101. container = {},
  102. events = {}
  103. }
  104. function nocol.classes.tool:__index(index)
  105. return nocol.classes.tool[index]
  106. end
  107. function nocol.classes.tool.new(tool)
  108. local data = nocol.cache.findchild(tool, "CONFIG")
  109. if data then
  110. data = require(data)
  111. else
  112. error("INVALID WEAPON")
  113. return
  114. end
  115. local wep = setmetatable({
  116. bin = tool,
  117. rpm = 60 / (data.rpm or 200),
  118. dmg = data.dmg or 20,
  119. spread = data.spread or 0.1,
  120. recoil = data.recoil or v3(1, 1, 1),
  121. audio = data.audio,
  122. volume = data.volume or 0.2,
  123. audrep = data.audio_rep,
  124. bullet = data.bullet,
  125. amount = data.bulletamount or 1,
  126. firemode = data.firemode,
  127. teamkill = data.teamkill,
  128. onfire = data.onfire,
  129. onhit = data.onhit,
  130. onrel = data.onrel,
  131. animations = {},
  132. __tick = tick() + 60 / (data.rpm or 200),
  133. __anims = data.animations,
  134. __gc = function(garbage)
  135. print(garbage)
  136. end,
  137. __state = {
  138. equipped = false,
  139. ammo = {
  140. data.ammo,
  141. data.ammo
  142. },
  143. state = "idle"
  144. }
  145. }, nocol.classes.tool)
  146. nocol.classes.tool.container[tool] = wep
  147. nocol.network.call("ownership", tool)
  148. tool.Equipped:connect(function()
  149. wep.equipped(wep)
  150. end)
  151. tool.Unequipped:connect(function()
  152. wep.unequipped(wep)
  153. end)
  154. tool.AncestryChanged:connect(function(c, p)
  155. if c == tool and p == nil then
  156. wep:unbind()
  157. end
  158. end)
  159. return tool, wep
  160. end
  161. function nocol.classes.tool:unbind()
  162. if self.bin then
  163. self.bin:Destroy()
  164. end
  165. nocol.classes.tool.container[self] = nil
  166. for animation_id = 1, #self.animations do
  167. if self.animations[animation_id] then
  168. self.animations[animation_id]:Stop(0.2)
  169. self.animations[animation_id] = nil
  170. end
  171. end
  172. if collectgarbage("count") % 2 ~= 0 then
  173. print("(possible) lag")
  174. end
  175. print("unbound")
  176. end
  177. function nocol.classes.tool:animate(index, delta, fade, speed, keyframe)
  178. fade = fade or 0
  179. speed = speed or 1
  180. if not nocol.cache.findchild(self.bin.NoCol, index) then
  181. end
  182. if not self.animations[index] then
  183. local anim = Instance.new("Animation")
  184. anim.AnimationId = self.__anims[index]
  185. local animation = nocol.cache.player.Character.Humanoid:LoadAnimation(anim)
  186. local kf
  187. kf = animation.KeyframeReached:connect(function(kf)
  188. if string.sub(kf, 1, 3) == "sf-" then
  189. local id = string.sub(kf, 4)
  190. local s = Instance.new("Sound", self.bin.Handle)
  191. s.SoundId = "rbxassetid://" .. id
  192. s:Play()
  193. game.Debris:AddItem(s, 1)
  194. end
  195. end)
  196. anim:Destroy()
  197. self.animations[index] = animation
  198. end
  199. if delta then
  200. self.animations[index]:Play(fade, 1, speed)
  201. return self.animations[index]
  202. else
  203. self.animations[index]:Stop(fade)
  204. end
  205. end
  206. function nocol.classes.tool:set(tab, index, value)
  207. tab[index] = value
  208. if nocol.cache.gui then
  209. nocol.cache.gui.Ammo.Text = self.__state.ammo[1] .. "/" .. self.__state.ammo[2]
  210. end
  211. end
  212. function nocol.classes.tool:equipped()
  213. if not self.__state.equipped then
  214. self.__state.equipped = true
  215. do
  216. local idle = self:animate("idle", true, 0.2)
  217. nocol.classes.tool.events[#nocol.classes.tool.events + 1] = game.Players.PlayerAdded:connect(function()
  218. local humanoid = nocol.cache.character:FindFirstChild("Humanoid")
  219. if humanoid then
  220. local animations = humanoid:GetPlayingAnimationTracks()
  221. for _, track in next, animations, nil do
  222. local originalPosition = track.TimePosition
  223. track:Stop(0)
  224. track.TimePosition = 0
  225. track:Play(0)
  226. track.TimePosition = originalPosition
  227. end
  228. end
  229. end)
  230. nocol.cache.input.MouseIconEnabled = false
  231. nocol.cache.gui = script.ASSETS.HuD:clone()
  232. nocol.cache.gui.Enabled = true
  233. nocol.cache.gui.Parent = nocol.cache.pgui
  234. nocol.cache.gui.Ammo.Text = self.__state.ammo[1] .. "/" .. self.__state.ammo[2]
  235. nocol.cache.character.Torso:WaitForChild("Right Shoulder")
  236. nocol.cache.character.Torso:WaitForChild("Left Shoulder")
  237. nocol.cache.character.Torso:WaitForChild("Grip")
  238. nocol.cache.rig = {
  239. nocol.cache.character.Torso["Right Shoulder"],
  240. nocol.cache.character.Torso["Left Shoulder"],
  241. nocol.cache.character.Torso.Grip
  242. }
  243. local camx, camy, camz, camw, t, dt = false, nil, nil, nil, nil, nil
  244. nocol.cache.run:BindToRenderStep("weapon.step", Enum.RenderPriority.Camera.Value + 1, function()
  245. if nocol.springs.fire.t ~= v3() and (nocol.springs.fire.p - nocol.springs.fire.t).magnitude < 1 then
  246. nocol.springs.fire.t = v3()
  247. nocol.springs.fire.s = 25
  248. nocol.springs.fire.d = 0.5
  249. nocol.springs.cam.d = 0.4
  250. nocol.springs.cam.t = v3()
  251. end
  252. nocol.cache.cspace = math.floor(nocol.cache.lerp(nocol.cache.cspace, nocol.springs.fire.p.magnitude * 100, 0.3))
  253. nocol.cache.gui.Crosshair.Position = UDim2.new(0, nocol.cache.mouse.X - nocol.cache.gap / 2 - nocol.cache.cspace / 2, 0, nocol.cache.mouse.Y - nocol.cache.gap / 2 - nocol.cache.cspace / 2)
  254. nocol.cache.gui.Crosshair.Size = UDim2.new(0, nocol.cache.gap + nocol.cache.cspace, 0, nocol.cache.gap + nocol.cache.cspace)
  255. camx = nocol.springs.cam.p.X / 6
  256. camy = nocol.springs.cam.p.Z / 3
  257. camz = nocol.springs.cam.p.Z / 3
  258. nocol.cache.camera.CFrame = nocol.cache.camera.CFrame * ang(camx, camy, camz)
  259. nocol.cache.rig[1].C0 = rdef * cfr(-3 * nocol.springs.fire.p.X, nocol.springs.fire.p.Y, nocol.springs.fire.p.X) * ang(nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4 + nocol.springs.fire.p.Y, nocol.springs.fire.p.X)
  260. nocol.cache.rig[2].C0 = ldef * cfr(3 * nocol.springs.fire.p.X, nocol.springs.fire.p.Y, nocol.springs.fire.p.X) * ang(0.65 * nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4, -nocol.springs.fire.p.X)
  261. nocol.cache.rig[3].C0 = cfr(0, nocol.springs.fire.p.Y, nocol.springs.fire.p.X * 3) * ang(nocol.springs.fire.p.X, nocol.springs.fire.p.Z / 4, 0)
  262. if nocol.cache.mdown then
  263. t = tick()
  264. if self.__tick < t then
  265. self.__tick = t + self.rpm
  266. if 0 < self.__state.ammo[1] and self.__state.state == "idle" and 0 < nocol.cache.character.Humanoid.Health and self.__state.equipped then
  267. nocol.springs.fire.s = 70
  268. nocol.springs.fire.d = 1
  269. nocol.springs.fire.t = v3(self.recoil.X, self.recoil.Y, nocol.cache.rnd(-10, 10) / 10 * self.recoil.Z)
  270. camw = false
  271. nocol.springs.cam.d = 0.9
  272. nocol.springs.cam.s = 40
  273. nocol.springs.cam.t = nocol.springs.fire.t
  274. for _, particle in pairs(self.bin.Barrel:children()) do
  275. if particle:IsA("ParticleEmitter") then
  276. particle:Emit(particle.Rate)
  277. elseif particle:IsA("PointLight") then
  278. particle.Enabled = true
  279. delay(0.05, function()
  280. particle.Enabled = false
  281. end)
  282. end
  283. end
  284. do
  285. local damage_table = {}
  286. for i = 1, self.amount do
  287. local dist = (self.bin.Barrel.CFrame.p - nocol.cache.mouse.Hit.p).magnitude
  288. local spread = nocol.cache.vc3(nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist, nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist, nocol.cache.rnd(-self.spread * 100, self.spread * 100) * 0.01 * dist)
  289. nocol.classes.bullet.new({
  290. origin = self.bin.Barrel.CFrame.p,
  291. direction = (self.bin.Barrel.CFrame.p - nocol.cache.mouse.Hit.p + spread).unit,
  292. part = self.bin.Barrel,
  293. bullet = self.bullet.type or "normal",
  294. thickness = self.bullet.thickness or 0.1,
  295. velocity = self.bullet.velocity or 2000,
  296. anchor = self.bin.Barrel,
  297. audio = self.audio.fire,
  298. onanchor = function(sd)
  299. if not self.audrep and sd and sd.anchor then
  300. do
  301. local s = Instance.new("Sound")
  302. s.SoundId = sd.audio
  303. s.Volume = self.volume
  304. s.Pitch = math.random(9.5, 11) / 10
  305. s.Parent = sd.anchor
  306. delay(wait(), function()
  307. s:Play()
  308. end)
  309. game.Debris:AddItem(s, s.TimeLength + wait())
  310. end
  311. end
  312. end,
  313. onhit = function(v, pos)
  314. if self.onhit then
  315. self.onhit(v, pos)
  316. end
  317. local hum = v.Parent:FindFirstChild("Humanoid") or v.Parent.Parent:FindFirstChild("Humanoid")
  318. if hum then
  319. if game.Players:FindFirstChild(hum.Parent.Name) then
  320. if (game.Players[hum.Parent.Name].TeamColor ~= nocol.cache.player.TeamColor or self.teamkill) and not damage_table[hum] then
  321. damage_table[hum] = true
  322. local s = Instance.new("Sound", workspace.CurrentCamera)
  323. s.SoundId = "rbxassetid://160432334"
  324. s:Play()
  325. game.Debris:AddItem(s, 1)
  326. nocol.network.call("register_hit", hum, self.dmg * ((v.Name == "Head" or v.Name == "Handle") and self.hs or 1))
  327. end
  328. elseif not damage_table[hum] then
  329. damage_table[hum] = true
  330. local s = Instance.new("Sound", workspace.CurrentCamera)
  331. s.SoundId = "rbxassetid://160432334"
  332. s:Play()
  333. game.Debris:AddItem(s, 1)
  334. nocol.network.call("register_hit", hum, self.dmg * ((v.Name == "Head" or v.Name == "Handle") and self.hs or 1))
  335. end
  336. end
  337. if (pos - nocol.cache.camera.CFrame.p).magnitude < 500 then
  338. local e = nocol.classes.effect.new("SmallSmoke")
  339. e:emit(pos, 20)
  340. end
  341. end
  342. })
  343. end
  344. self:set(self.__state.ammo, 1, self.__state.ammo[1] - 1)
  345. end
  346. elseif self.autism then
  347. self.autism:Stop()
  348. self.autism:Destroy()
  349. self.autism = nil
  350. end
  351. if self.firemode == "single" then
  352. nocol.cache.mdown = false
  353. if self.autism then
  354. self.autism:Stop()
  355. self.autism:Destroy()
  356. self.autism = nil
  357. end
  358. elseif self.firemode == "bolt" then
  359. nocol.cache.mdown = false
  360. if 0 < self.__state.ammo[1] then
  361. self:animate("bolt", true, 0.2)
  362. end
  363. end
  364. end
  365. end
  366. end)
  367. nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.mouse.Button1Down:connect(function()
  368. nocol.cache.mdown = true
  369. if self.onfire then
  370. self.onfire()
  371. end
  372. end)
  373. nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.mouse.Button1Up:connect(function()
  374. nocol.cache.mdown = false
  375. if self.autism then
  376. self.autism:Stop()
  377. self.autism:Destroy()
  378. self.autism = nil
  379. end
  380. end)
  381. nocol.classes.tool.events[#nocol.classes.tool.events + 1] = nocol.cache.input.InputBegan:connect(function(obj, eh)
  382. if eh then
  383. return
  384. end
  385. if obj.UserInputType == Enum.UserInputType.Keyboard then
  386. if obj.KeyCode == Enum.KeyCode.R then
  387. if self.__state.state ~= "reloading" then
  388. self.__state.state = "reloading"
  389. if self.firemode == "bolt" then
  390. self:animate("bolt", true, 0.2).Stopped:wait()
  391. end
  392. if self.onrel then
  393. self.onrel()
  394. end
  395. local anim = self:animate("reload", true, 0.3, 0.8)
  396. anim.Stopped:connect(function()
  397. if self.__state.equipped and self.__state.state == "reloading" then
  398. self:set(self.__state.ammo, 1, self.__state.ammo[2])
  399. self.__state.state = "idle"
  400. end
  401. end)
  402. end
  403. elseif obj.KeyCode == Enum.KeyCode.F then
  404. if not self.__anims.atease then
  405. return
  406. end
  407. if self.__state.state ~= "reloading" then
  408. if self.__state.state ~= "atease" then
  409. if self.__anims.stnc1 then
  410. self:animate("stnc1", false, 0.3)
  411. end
  412. nocol.cache.character.Humanoid.WalkSpeed = 20
  413. local anim = self:animate("atease", true, 0.3, 1)
  414. self.__state.state = "atease"
  415. else
  416. self:animate("atease", false, 0.3)
  417. self.__state.state = "idle"
  418. nocol.cache.character.Humanoid.WalkSpeed = 16
  419. end
  420. end
  421. elseif obj.KeyCode == Enum.KeyCode.G then
  422. if not self.__anims.stnc1 then
  423. return
  424. end
  425. if self.__state.state ~= "reloading" then
  426. if self.__state.state ~= "stnc1" then
  427. if self.__anims.atease then
  428. self:animate("atease", false, 0.3)
  429. end
  430. local anim = self:animate("stnc1", true, 0.3, 1)
  431. self.__state.state = "stnc1"
  432. else
  433. self:animate("stnc1", false, 0.3)
  434. self.__state.state = "idle"
  435. end
  436. end
  437. end
  438. end
  439. end)
  440. end
  441. end
  442. end
  443. function nocol.classes.tool:unequipped()
  444. if nocol.cache.gui then
  445. nocol.cache.gui:Destroy()
  446. nocol.cache.gui = nil
  447. end
  448. nocol.cache.input.MouseIconEnabled = true
  449. if nocol.cache.rig then
  450. if nocol.cache.rig[1] then
  451. nocol.cache.rig[1].C0 = rdef
  452. end
  453. if nocol.cache.rig[2] then
  454. nocol.cache.rig[2].C0 = ldef
  455. end
  456. if nocol.cache.rig[3] then
  457. nocol.cache.rig[3].C0 = cfr()
  458. end
  459. end
  460. if self.autism then
  461. self.autism:Stop()
  462. self.autism:Destroy()
  463. self.autism = nil
  464. end
  465. for event_id = 1, #nocol.classes.tool.events do
  466. if nocol.classes.tool.events[event_id] then
  467. nocol.classes.tool.events[event_id]:disconnect()
  468. nocol.classes.tool.events[event_id] = nil
  469. end
  470. end
  471. nocol.cache.run:UnbindFromRenderStep("weapon.step")
  472. for animation_index, id in pairs(self.__anims) do
  473. self:animate(animation_index, false, 0.2)
  474. end
  475. self.__state.state = "idle"
  476. self.__state.equipped = false
  477. end
  478. nocol.cache.character = waitfor(workspace, nocol.cache.player.Name)
  479. nocol.cache.hump = waitfor(nocol.cache.character, "HumanoidRootPart")
  480. nocol.cache.backpack.ChildAdded:connect(function(tool)
  481. tool:WaitForChild("NoCol", 3)
  482. if tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol") and not nocol.classes.tool.container[tool] then
  483. nocol.classes.tool.new(tool)
  484. end
  485. end)
  486. nocol.cache.player.Chatted:connect(function(msg)
  487. if string.sub(msg, 1, 5) == "size/" then
  488. local size = tonumber(string.sub(msg, 6))
  489. nocol.cache.gap = size
  490. end
  491. end)
  492. nocol.cache.character.ChildAdded:connect(function(tool)
  493. local tool = not (tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol")) or nocol.classes.tool.container[tool] or nocol.classes.tool.new(tool)
  494. end)
  495. nocol.cache.character.Humanoid.Died:connect(function()
  496. nocol.cache.func.Parent = game.ReplicatedStorage
  497. end)
  498. for _, tool in pairs(nocol.cache.backpack:children()) do
  499. if tool:IsA("Tool") and nocol.cache.findchild(tool, "NoCol") and not nocol.classes.tool.container[tool] then
  500. nocol.classes.tool.new(tool)
  501. end
  502. end
Advertisement
Add Comment
Please, Sign In to add comment