Advertisement
dbf04

Untitled

Feb 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.36 KB | None | 0 0
  1.  
  2.  
  3. local Mortadex = {}
  4. Mortadex.Version = "1"
  5. Mortadex.Modules = {}
  6. Mortadex.ModuleCount = 0
  7. Mortadex.ModuleSelection = 1
  8.  
  9. Mortadex.Stealth = true -- this will just remove print messages
  10. Mortadex.Debug = false
  11. Mortadex.FreeForAll = false
  12. Mortadex.Studio = false
  13.  
  14. function Mortadex:RegisterModule(name, onrender, norender)
  15. if Mortadex.Modules[name] then
  16. return error("Module \""..name.."\" already registered!")
  17. else
  18. Mortadex:FLog("Registering module \"%s\"", name)
  19. Mortadex.Modules[name] = {OnRender = onrender, NoRender = norender, Scratchpad = {}, Enabled = false, Order = Mortadex.ModuleCount}
  20. Mortadex.ModuleCount = Mortadex.ModuleCount + 1
  21. end
  22. end
  23.  
  24. function Mortadex:Log(...)
  25. if Mortadex.Stealth then return end
  26. return print("[- MORTADEX -] ", ...)
  27. end
  28.  
  29. function Mortadex:FLog(o, ...)
  30. return Mortadex:Log(o:format(...))
  31. end
  32.  
  33. local getrawmetatable = getrawmetatable
  34.  
  35. ---------------------------------------------------------------
  36.  
  37. Mortadex:Log("Loading core utilities...")
  38.  
  39. Mortadex.HookManager = {IdxHooks = {}, NIdxHooks = {}}
  40. Mortadex.Utilities = {}
  41. Mortadex.Services = {
  42. Players = game:GetService("Players"),
  43. Lighting = game:GetService("Lighting"),
  44. RunService = game:GetService("RunService"),
  45. UserInputService = game:GetService("UserInputService")
  46. }
  47. Mortadex.Instances = {
  48. LocalPlayer = Mortadex.Services.Players.LocalPlayer,
  49. LocalCharacter = Mortadex.Services.Players.LocalPlayer.Character,
  50. LocalCamera = workspace.CurrentCamera,
  51. LocalMouse = Mortadex.Services.Players.LocalPlayer:GetMouse()
  52. }
  53.  
  54. function Mortadex.HookManager:Init()
  55. if getrawmetatable then
  56. local ObjectMt = getrawmetatable(game)
  57. Mortadex.OriginalIndex = ObjectMt.__index
  58. Mortadex.OriginalNewIndex = ObjectMt.__newindex
  59.  
  60. ObjectMt.__index = function(self, key)
  61. local Hook = Mortadex.HookManager:LookupIndexHook(self, key)
  62. if Hook then
  63. return Hook(self)
  64. else
  65. return Mortadex.OriginalIndex(self, key)
  66. end
  67. end
  68.  
  69. ObjectMt.__newindex = function(self, key, value)
  70. local Hook = Mortadex.HookManager:LookupNewIndexHook(self, key)
  71. if Hook then
  72. return Hook(self, value)
  73. else
  74. return Mortadex.OriginalNewIndex(self, key, value)
  75. end
  76. end
  77.  
  78. return true
  79. end
  80. end
  81.  
  82. function Mortadex.HookManager:LookupIndexHook(inst, key)
  83. for _, Hook in next, Mortadex.HookManager.IdxHooks do
  84. if Mortadex.OriginalIndex(inst, "IsA")(inst, Hook.AffectedClass) and Hook.Property == key then
  85. return Hook.HookFunction
  86. end
  87. end
  88. end
  89.  
  90. function Mortadex.HookManager:LookupNewIndexHook(inst, key)
  91. for _, Hook in next, Mortadex.HookManager.NIdxHooks do
  92. if Mortadex.OriginalIndex(inst, "IsA")(inst, Hook.AffectedClass) and Hook.Property == key then
  93. return Hook.HookFunction
  94. end
  95. end
  96. end
  97.  
  98. function Mortadex.HookManager:HookIndex(class, prop, f)
  99. return table.insert(Mortadex.HookManager.IdxHooks, {AffectedClass = class, Property = prop, HookFunction = f})
  100. end
  101.  
  102. function Mortadex.HookManager:HookNewIndex(class, prop, f)
  103. return table.insert(Mortadex.HookManager.NIdxHooks, {AffectedClass = class, Property = prop, HookFunction = f})
  104. end
  105.  
  106. function Mortadex.Utilities:WorldToScreenPoint(...)
  107. return Mortadex.Instances.LocalCamera:WorldToScreenPoint(...)
  108. end
  109.  
  110. function Mortadex.Utilities:PathObstructed(p1, p2, ...)
  111. local ray = Ray.new(p1, (p2 - p1).unit * 500)
  112. local haspart, hitpos = workspace:FindPartOnRayWithIgnoreList(ray, {...})
  113. if haspart then return true, hitpos else return false end
  114. end
  115.  
  116. function Mortadex.Utilities:GetReplicator()
  117. return game:FindFirstChild("ClientReplicator", true)
  118. end
  119.  
  120. function Mortadex.Utilities:GetSize(i)
  121. if i:IsA("BasePart") then
  122. return i.Size
  123. elseif i:IsA("Model") then
  124. return i:GetExtentsSize()
  125. end
  126. end
  127.  
  128. function Mortadex.Utilities:GetPlayers(mode)
  129. local Result = {}
  130. for _,player in next, Mortadex.Services.Players:GetPlayers() do
  131. if mode == 0 then -- exclude players in current team
  132. if (player ~= Mortadex.Instances.LocalPlayer and (Mortadex.Instances.LocalPlayer.TeamColor ~= player.TeamColor or (FreeForAll or DEBUG))) then
  133. table.insert(Result, player)
  134. end
  135. else -- include everyone
  136. table.insert(Result, player)
  137. end
  138. end
  139. return Result
  140. end
  141.  
  142. function Mortadex.Utilities:GetNearestPlayer()
  143. if not Mortadex.Instances.LocalPlayer.Character then return end
  144. local Players = Mortadex.Utilities:GetPlayers(0)
  145. local SelectedPlayer, SelectedPlayerPrevDistance = nil, 25000
  146. for i,v in next, Players do
  147. if v.Character and v.Character:FindFirstChild("HumanoidRootPart") then
  148. local Distance = Mortadex.Utilities:GetDistance(Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.Position, v.Character.HumanoidRootPart.Position)
  149. if Distance < SelectedPlayerPrevDistance then
  150. SelectedPlayer = v
  151. SelectedPlayerPrevDistance = Distance
  152. end
  153. end
  154. end
  155. return SelectedPlayer
  156. end
  157.  
  158. function Mortadex.Utilities:GetDistance(v1, v2)
  159. return (v1 - v2).magnitude
  160. end
  161.  
  162. function Mortadex.Utilities:GetCanvas()
  163. if not Mortadex.Canvas then
  164. if getrawmetatable then
  165. Mortadex.Canvas = Instance.new("ScreenGui", game:GetService("CoreGui"))
  166. else
  167. Mortadex.Canvas = Instance.new("ScreenGui", Mortadex.Services.Players.LocalPlayer.PlayerGui)
  168. end
  169. end
  170. return Mortadex.Canvas
  171. end
  172.  
  173. Mortadex.EmptyVector3 = Vector3.new()
  174. Mortadex.EmptyCFrame = CFrame.new()
  175.  
  176. ---------------------------------------------------------------
  177.  
  178. --> ESP
  179. Mortadex:RegisterModule("ESP", function(Storage)
  180. local Canvas = Mortadex.Utilities:GetCanvas()
  181. local Root = Canvas:FindFirstChild("ESP")
  182. if not Root then
  183. Root = Instance.new("Frame")
  184. Root.Name = "ESP"
  185. Root.Size = UDim2.new(1, 0, 1, 0)
  186. Root.BackgroundTransparency = 1
  187. end
  188.  
  189. Root:ClearAllChildren()
  190. for _, Player in next, Mortadex.Utilities:GetPlayers(0) do
  191. if Player.Character and Player.Character:FindFirstChild("Torso") then
  192. local Locator = Instance.new("Frame")
  193. Locator.BackgroundColor = Player.TeamColor
  194. Locator.BackgroundTransparency = .5
  195. local VPos, VVis = Mortadex.Utilities:WorldToScreenPoint(Player.Character.Torso.Position)
  196. if VVis then
  197. Locator.Size = UDim2.new(0, -2800 / VPos.z, 0, -4300 / VPos.z)
  198. Locator.Position = UDim2.new(0, VPos.x - Locator.Size.X.Offset / 2, 0, VPos.y - Locator.Size.Y.Offset / 2)
  199. local Name = Instance.new("TextLabel")
  200. Name.TextColor3 = Color3.new(1,1,1)
  201. Name.Size = UDim2.new(1,0,0, Locator.Size.Y.Offset / 5)
  202. Name.BackgroundTransparency = 1
  203. Name.TextScaled = true
  204. Name.FontSize = 'Size24'
  205. Name.Text = Player.Name
  206. Name.TextStrokeTransparency = .3
  207. Name.Font = 'SourceSansLight'
  208. Name.TextXAlignment = 'Left'
  209. Name.Parent = Locator
  210. Locator.Parent = Root
  211. else
  212. Locator:Destroy()
  213. end
  214. end
  215. end
  216.  
  217. if not Root.Parent then
  218. Root.Parent = Canvas
  219. end
  220. end)
  221.  
  222. --> FreeForAll
  223. Mortadex:RegisterModule("FreeForAll", function(Storage)
  224. FreeForAll = true
  225. end, function(Storage) FreeForAll = false end)
  226.  
  227. --> Chams
  228. Mortadex:RegisterModule("Chams", function(Storage)
  229. for i, Cham in next, Storage do
  230. if Cham.Name:find("Cham") then
  231. Cham:Destroy()
  232. Storage[i] = nil
  233. end
  234. end
  235.  
  236. for _, Player in next, Mortadex.Utilities:GetPlayers(0) do
  237. if Player.Character and Player.Character:FindFirstChild("Torso") then
  238. for _, Part in next, Player.Character:GetChildren() do
  239. if Part:IsA("PVInstance") then
  240. local Box = Instance.new("BoxHandleAdornment")
  241. Box.Size = Mortadex.Utilities:GetSize(Part) + Vector3.new(.2, .2, .2)
  242. Box.Name = "Cham" .. Player.Name
  243. Box.Color3 = Player.TeamColor.Color
  244. Box.Adornee = Part
  245. Box.AlwaysOnTop = true
  246. Box.ZIndex = 5
  247. Box.Transparency = .1
  248. table.insert(Storage, Box)
  249. Box.Parent = Mortadex.Utilities:GetCanvas()
  250. end
  251. end
  252. end
  253. end
  254. end)
  255.  
  256. --> LagSwitch
  257. Mortadex:RegisterModule("LagSwitch", function(Storage)
  258. if not Storage.State then
  259. Storage.State = true
  260. local Replicator = Mortadex.Utilities:GetReplicator()
  261. if Replicator then
  262. Replicator:DisableProcessPackets()
  263. end
  264. end
  265. end,
  266.  
  267. function(Storage)
  268. if Storage.State then
  269. Storage.State = false
  270. local Replicator = Mortadex.Utilities:GetReplicator()
  271. if Replicator then
  272. Replicator:EnableProcessPackets()
  273. end
  274. end
  275. end)
  276.  
  277. --> IronSight
  278. Mortadex:RegisterModule("IronSight", function(Storage)
  279. local Sight = Instance.new("Frame")
  280. Sight.Size = UDim2.new(0, 5, 0, 5)
  281. Sight.BackgroundTransparency = .5
  282. Sight.BackgroundColor3 = Color3.new(1, 1, 1)
  283. Sight.Position = UDim2.new(0, Mortadex.Instances.LocalMouse.X, 0, Mortadex.Instances.LocalMouse.Y)
  284. Sight.Parent = Mortadex.Utilities:GetCanvas()
  285. end)
  286.  
  287. --> KnifeMaster
  288. Mortadex:RegisterModule("KnifeMaster", function(Storage)
  289. if not Mortadex.Instances.LocalPlayer.Character then
  290. return
  291. end
  292. local Pl = Mortadex.Utilities:GetNearestPlayer()
  293. if Pl and Pl.Character and Mortadex.Utilities:GetDistance(Pl.Character.Torso.Position, Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.Position) < 150 then
  294. Mortadex.Instances.LocalPlayer.Character.HumanoidRootPart.CFrame = Pl.Character.Torso.CFrame * CFrame.new(0,0,3)
  295. end
  296. end)
  297.  
  298. --> BigHead
  299. Mortadex:RegisterModule("BigHead", function(Storage)
  300. for _, v in next, Mortadex.Utilities:GetPlayers(0) do
  301. if v.Character then
  302. if not Storage[v.Name] then
  303. Storage[v.Name] = { v.Character.Head.Size, v.Character.Head.CFrame }
  304. end
  305. v.Character.Head.CanCollide = false
  306. v.Character.Head.Size = Vector3.new(40, 40, 40)
  307. v.Character.Head.CFrame = v.Character.Torso.CFrame * CFrame.new(0, 20, 0)
  308. v.Character.Head.Transparency = .3
  309. end
  310. end
  311. end,
  312.  
  313. function(Storage)
  314. if not Storage.NormalSize then
  315. Storage.NormalSize = Vector3.new(2, 1, 1)
  316. end
  317.  
  318. for _, v in next, Mortadex.Utilities:GetPlayers(0) do
  319. if v.Character then
  320. v.Character.Head.CanCollide = true
  321. v.Character.Head.Size = Storage.NormalSize
  322. end
  323. end
  324. end)
  325.  
  326. ---------------------------------------------------------------
  327.  
  328. Mortadex:Log("Loading UI...")
  329.  
  330. function Mortadex:CreateWindow(name, size, timed_close, tween)
  331. local TopBar = Instance.new("TextLabel")
  332. TopBar.Name = "NO_CLEAR"
  333. TopBar.Size = UDim2.new(size.X.Scale, size.X.Offset, 0, 20)
  334. TopBar.BorderSizePixel = 0
  335. TopBar.BackgroundColor3 = Color3.new(1, 0, 0)
  336. TopBar.Text = name
  337. TopBar.TextXAlignment = Enum.TextXAlignment.Left
  338. TopBar.TextScaled = true
  339. TopBar.Font = Enum.Font.Code
  340. TopBar.TextColor3 = Color3.new(0, 0, 0)
  341. TopBar.Position = UDim2.new(.5, -(size.X.Offset/2), .5, -(size.Y.Offset/2))
  342. TopBar.Draggable = true
  343. TopBar.Active = true
  344.  
  345. local Window = Instance.new("Frame")
  346. Window.Name = "Content"
  347. Window.Size = size
  348. Window.BackgroundColor3 = Color3.new(0, 0, 0)
  349. Window.Position = UDim2.new(0, 0, 0, 20)
  350. Window.BackgroundTransparency = .3
  351. Window.BorderSizePixel = 0
  352.  
  353. if not timed_close then
  354. local CloseBtn = Instance.new("TextButton", TopBar)
  355. CloseBtn.Position = UDim2.new(1, -20, 0, 0)
  356. CloseBtn.Size = UDim2.new(0, 20, 1, 0)
  357. CloseBtn.BorderSizePixel = 0
  358. CloseBtn.Name = "CloseBtn"
  359. CloseBtn.BackgroundColor3 = Color3.new(0,0,0)
  360. CloseBtn.TextColor3 = Color3.new(1, 0, 0)
  361. CloseBtn.Text = "X"
  362. CloseBtn.MouseButton1Click:connect(function()
  363. TopBar:Destroy()
  364. end)
  365. else
  366. local Countdown = Instance.new("TextLabel", TopBar)
  367. Countdown.Position = UDim2.new(1, -20, 0, 0)
  368. Countdown.Size = UDim2.new(0, 20, 1, 0)
  369. Countdown.BackgroundTransparency = 1
  370. Countdown.TextColor3 = Color3.new(0, 0, 0)
  371. Countdown.Text = tostring(timed_close)
  372. local BackPos
  373. if tween then
  374. BackPos = TopBar.Position
  375. TopBar.Position = UDim2.new(.5, -(size.X.Offset/2), 1, 0)
  376. end
  377. spawn(function()
  378. if tween then
  379. TopBar:TweenPosition(BackPos, "Out", "Quad", .3, true)
  380. end
  381. for i = timed_close-1, 0, -1 do
  382. wait(1)
  383. Countdown.Text = tostring(i)
  384. end
  385. if not tween then
  386. TopBar:Destroy()
  387. else
  388. TopBar:TweenPosition(UDim2.new(.5, -(size.X.Offset/2), 1, 0), "Out", "Sine", .3, true)
  389. wait(.3)
  390. TopBar:Destroy()
  391. end
  392. end)
  393. end
  394.  
  395. Window.Parent = TopBar
  396. TopBar.Parent = Mortadex.Utilities:GetCanvas()
  397. return TopBar
  398. end
  399.  
  400.  
  401. ---------------------------------------------------------------
  402.  
  403. if not script then script = Instance.new("LocalScript") end
  404. Mortadex.UpvalScript = script
  405.  
  406. Mortadex:Log("Hooking functions...")
  407. Mortadex.HookManager:Init()
  408. Mortadex.HookManager:HookIndex("Player", "Kick", error)
  409. Mortadex.HookManager:HookIndex("BasePart", "Size", function(Part)
  410. local caller_env = getfenv(1)
  411. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  412. if Part.Name == "Head" then
  413. return Mortadex.EmptyVector3
  414. end
  415. end
  416. return Mortadex.OriginalIndex(Part, "Size")
  417. end)
  418.  
  419. Mortadex.HookManager:HookIndex("BasePart", "CFrame", function(Part)
  420. local caller_env = getfenv(1)
  421. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  422. if Part.Name == "Head" then
  423. return Mortadex.EmptyCFrame
  424. end
  425. end
  426. return Mortadex.OriginalIndex(Part, "CFrame")
  427. end)
  428.  
  429. Mortadex.HookManager:HookIndex("BasePart", "Transparency", function(Part)
  430. local caller_env = getfenv(1)
  431. if caller_env.script ~= Mortadex.UpvalScript and caller_env.script.ClassName ~= "CoreScript" then
  432. if Part.Name == "Head" then
  433. return 0
  434. end
  435. end
  436. return Mortadex.OriginalIndex(Part, "Transparency")
  437. end)
  438.  
  439. Mortadex:Log("Creating menu...")
  440. Mortadex.SelectionMenu = Mortadex:CreateWindow("Mortadex v"..Mortadex.Version, UDim2.new(0, 250, 0, 20 * Mortadex.ModuleCount))
  441. Mortadex.SelectionMenu.Position = UDim2.new(0, 10, 0, 10)
  442. Mortadex.SelectionMenu.CloseBtn:Destroy()
  443.  
  444. for ModuleName, Module in next, Mortadex.Modules do
  445. local Entry = Instance.new("TextLabel")
  446. Entry.BackgroundTransparency = 1
  447. Entry.BackgroundColor3 = Color3.new(1,1,1)
  448. Entry.TextColor3 = Color3.new(1, 1, 1)
  449. Entry.TextScaled = true
  450. Entry.Font = "Code"
  451. Entry.TextXAlignment = "Left"
  452. Entry.Text = ModuleName
  453. Entry.Position = UDim2.new(0, 0, 0, 20 * Module.Order)
  454. Entry.Size = UDim2.new(1, 0, 0, 20)
  455. Entry.Name = tostring(Module.Order)
  456. Entry.Parent = Mortadex.SelectionMenu.Content
  457. Entry.BorderSizePixel = 0
  458.  
  459. local Status = Instance.new("Frame")
  460. Status.BorderSizePixel = 0
  461. Status.BackgroundColor3 = Color3.new(1, 0, 0)
  462. Status.Size = UDim2.new(0, 5, 0, 5)
  463. Status.Position = UDim2.new(1, -10, 0, 8)
  464. Status.Name = "Status"
  465. Status.Parent = Entry
  466. end
  467.  
  468. Mortadex:Log("Connecting UI renderer...")
  469. Mortadex.Services.RunService:BindToRenderStep("Mortadex", Enum.RenderPriority.Last.Value + 1, function()
  470. for _, Object in next, Mortadex.Utilities:GetCanvas():GetChildren() do
  471. if not Object.Name:find("NO_CLEAR") then
  472. Object:Destroy()
  473. end
  474. end
  475.  
  476. for i, Module in next, Mortadex.Modules do
  477. if Module.Enabled and Module.OnRender then
  478. local Success, ErrMsg = pcall(Module.OnRender, Module.Scratchpad)
  479. if not Success then
  480. Mortadex:FLog("Panic during execution of \"%s\"::OnRender: %s", i, ErrMsg)
  481. end
  482. elseif not Module.Enabled and Module.NoRender then
  483. local Success, ErrMsg = pcall(Module.NoRender, Module.Scratchpad)
  484. if not Success then
  485. Mortadex:FLog("Panic during execution of \"%s\"::NoRender: %s", i, ErrMsg)
  486. end
  487. end
  488. end
  489. end)
  490.  
  491. Mortadex:Log("Attaching controls...")
  492. Mortadex.Services.UserInputService.InputBegan:connect(function(InputObject)
  493. local PreviousSelection = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  494. if PreviousSelection then
  495. PreviousSelection.BackgroundTransparency = 1
  496. PreviousSelection.TextColor3 = Color3.new(1, 1, 1)
  497. end
  498. if InputObject.KeyCode.Name == "J" then
  499. Mortadex.ModuleSelection = Mortadex.ModuleSelection - 1
  500. if Mortadex.ModuleSelection < 0 then
  501. Mortadex.ModuleSelection = Mortadex.ModuleCount - 1
  502. end
  503. elseif InputObject.KeyCode.Name == "K" then
  504. Mortadex.ModuleSelection = Mortadex.ModuleSelection + 1
  505. if Mortadex.ModuleSelection > Mortadex.ModuleCount-1 then
  506. Mortadex.ModuleSelection = 0
  507. end
  508. elseif InputObject.KeyCode.Name == "L" then
  509. local EntryLabel = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  510. if EntryLabel then
  511. local ModuleEntry = Mortadex.Modules[EntryLabel.Text]
  512. if ModuleEntry then
  513. ModuleEntry.Enabled = not ModuleEntry.Enabled
  514. if ModuleEntry.Enabled then
  515. EntryLabel.Status.BackgroundColor3 = Color3.new(0, 1, 0)
  516. else
  517. EntryLabel.Status.BackgroundColor3 = Color3.new(1, 0, 0)
  518. end
  519. end
  520. end
  521. elseif InputObject.KeyCode.Name == "P" then
  522. Mortadex.SelectionMenu.Position = UDim2.new(1, -270, 0, 10)
  523. end
  524. local EntryLabel = Mortadex.SelectionMenu.Content:FindFirstChild(tostring(Mortadex.ModuleSelection))
  525. if EntryLabel then
  526. EntryLabel.BackgroundTransparency = .3
  527. EntryLabel.TextColor3 = Color3.new(0, 0, 0)
  528. end
  529. end)
  530.  
  531. Mortadex:Log("Finishing up...")
  532. local IntroWindow = Mortadex:CreateWindow("Mortadex", UDim2.new(0, 350, 0, 200), 5, true)
  533. local IntroLabel = Instance.new("TextLabel")
  534. IntroLabel.Font = "Code"
  535. IntroLabel.TextWrapped = true
  536. IntroLabel.FontSize = "Size24"
  537. IntroLabel.TextColor3 = Color3.new(1, 1, 1)
  538. IntroLabel.BackgroundTransparency = 1
  539. IntroLabel.Text = "Welcome to Mortadex! If you need to change the menu's placement, simply drag the window around the screen. Press P to dock the window to the right side of the screen in case the chat blocks the menu."
  540. IntroLabel.Parent = IntroWindow.Content
  541. IntroLabel.Size = UDim2.new(1, 0, 1, 0)
  542.  
  543. Mortadex:Log("Initialization complete!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement