GMADè\ULX++ - New Commands and More!{ "description": "Description", "type": "tool", "tags": [ "build" ] }Author Namelua/autorun/sh_ulxpp.luaÖœB0lua/autorun/ulxpp/cl_chat.lua·³­ž¼lua/autorun/ulxpp/cl_commands.luaô GƳlua/autorun/ulxpp/sh_commands.luaÄ/t·ùlua/autorun/ulxpp/sh_init.lua' JP¤lua/autorun/ulxpp/sh_properties.luaî  DKlua/autorun/ulxpp/sv_chat.lual É’ÛClua/autorun/ulxpp/sv_commands.luaL1$‘Z— --Not running in ULX folder because it does not being loaded using VLL if SERVER then AddCSLuaFile('autorun/ulxpp/sh_init.lua') end timer.Simple(0, function() include('autorun/ulxpp/sh_init.lua') end) --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] --Because of how ULib is made --I can not provide anything better for autocomplete in chat --I just CAN'T EVEN UNDERTSAND ULib! local ENABLE = CreateConVar('ulx_autocomplete', '1', FCVAR_ARCHIVE, 'Enable chat autocomplete') local ENABLED_SLASH = CreateConVar('sv_ulxpp_slash', '1', {FCVAR_REPLICATED, FCVAR_NOTIFY}, 'Enable / command prefix') local function RealSplit(str, ignore) if not str then return {} end local len = #str local reply = {} local TOKEN_LEVEL = 0 local currentstr = '' for i = 1, len do local char = str[i] if not ignore and char == '-' then break end if char == ' ' and TOKEN_LEVEL == 0 then table.insert(reply, currentstr) currentstr = '' goto CONTINUE elseif char == '<' then TOKEN_LEVEL = TOKEN_LEVEL + 1 elseif char == '>' or char == ']' then --[] --!!!, > last one is missing TOKEN_LEVEL = math.max(TOKEN_LEVEL - 1, 0) end currentstr = currentstr .. char ::CONTINUE:: end table.insert(reply, currentstr) return reply end local ShouldDraw = false local function StartChat() if not ENABLE:GetBool() then return end ShouldDraw = true end local function FinishChat() if not ENABLE:GetBool() then return end ShouldDraw = false end local Drawn = {} local curcommand = '' local curtoken = '' local COMMAND_IS_VALID = false local function ChatTextChanged(str) if not ENABLE:GetBool() then return end local token = str[1] Drawn = {} if token ~= '/' and token ~= '!' then return end if token == '/' and not ENABLED_SLASH:GetBool() then return end curtoken = token local split = string.Explode(' ', str) local find = string.sub(split[1], 2) local len = #find local Found = {} for k, data in pairs(ulx.cmdsByCategory) do for i, obj in pairs(data) do if obj.say_cmd and string.sub(ULXPP.UnpackCommand(obj.cmd), 1, len) == find then table.insert(Found, obj) end end end Drawn[1] = 'ULX Chat Commands:' local last local ply = LocalPlayer() local total = 0 local playerTarget = false local targetPly for k, v in pairs(Found) do local access = ULib.ucl.query(ply, v.cmd) if access then playerTarget = false if total > 10 then table.insert(Drawn, '<...>') break end local usage = v:getUsage(ply) local usplit = RealSplit(usage or '', true) for k, v in pairs(usplit) do if v == '-' then break end if v == '' or v == '' then playerTarget = true targetPly = split[k + 1] end if split[k + 1] then usplit[k] = split[k + 1] end end local format = token .. ULXPP.UnpackCommand(v.cmd) .. ' ' .. table.concat(usplit, ' ') if not table.HasValue(Drawn, format) then total = total + 1 last = ULXPP.UnpackCommand(v.cmd) table.insert(Drawn, format) end end end if total == 0 then Drawn[1] = 'No ULX command match.' COMMAND_IS_VALID = false elseif total == 1 then Drawn[1] = 'ULX Chat Command, to paste all missed arguments press TAB.' curcommand = last COMMAND_IS_VALID = true local hit = false if playerTarget then local target = targetPly and targetPly ~= '' and targetPly ~= ' ' and string.lower(targetPly) for k, v in pairs(player.GetAll()) do if target then if not string.find(string.lower(v:Nick()), target) then goto CONTINUE end end local return_value, msg = hook.Run(ULib.HOOK_PLAYER_TARGET, LocalPlayer(), curcommand, v) if return_value == false then goto CONTINUE end if not hit then hit = true if not target then table.insert(Drawn, 'Valid targets:') else table.insert(Drawn, 'Match targets:') end end table.insert(Drawn, v:Nick()) ::CONTINUE:: end if not hit then table.insert(Drawn, 'No match') end end else COMMAND_IS_VALID = false end end surface.CreateFont('ULXPP.Autocomplete', { font = 'Roboto', size = 18, weight = 500, extended = true, }) local function HUDPaint() if not ENABLE:GetBool() then return end if not ShouldDraw then return end local x, y = chat.GetChatBoxPos() local w, h = chat.GetChatBoxSize() x = x + w + 3 y = y - 20 surface.SetFont('ULXPP.Autocomplete') for k, v in pairs(Drawn) do local w, h = surface.GetTextSize(v) surface.SetDrawColor(0, 0, 0, 200) surface.SetTextColor(255, 255, 255) surface.DrawRect(x - 3, y - 2, w + 6, h + 4) surface.SetTextPos(x, y) surface.DrawText(v) y = y + h + 8 end end local function OnChatTab(str) if not ENABLE:GetBool() then return end if not ShouldDraw then return end if not COMMAND_IS_VALID then return end local command = Drawn[2] if not command then return end local split1 = string.Explode(' ', str) local split2 = RealSplit(command) split1[1] = curtoken .. curcommand local output = table.concat(split1, ' ') for k, v in pairs(split2) do if v == '-' then break end --We hit help end if not split1[k] then output = output .. ' ' .. v end end return output end hook.Add('StartChat', 'ULXPP.Autocomplete', StartChat) hook.Add('FinishChat', 'ULXPP.Autocomplete', FinishChat) hook.Add('ChatTextChanged', 'ULXPP.Autocomplete', ChatTextChanged) hook.Add('HUDPaint', 'ULXPP.Autocomplete', HUDPaint) hook.Add('OnChatTab', 'ULXPP.Autocomplete', OnChatTab) --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] net.Receive('ULXPP.sin', function() local status = net.ReadBool() if status then local Pos = net.ReadVector() hook.Add('Move', 'ULXPP_SIN', function(ply, mv) mv:SetOrigin(Pos + Vector(0, 0, math.sin(CurTimeL()) * 50)) return true end) else hook.Remove('Move', 'ULXPP_SIN') end end) net.Receive('ULXPP.confuse', function() local status = net.ReadBool() if status then hook.Add('Move', 'ULXPP_CONFUSE', function(ply, mv) mv:SetSideSpeed(-mv:GetSideSpeed()) end) else hook.Remove('Move', 'ULXPP_CONFUSE') end end) net.Receive('ULXPP.banish', function() ULXPP.BANISHED = net.ReadBool() end) net.Receive('ULXPP.coloredmessage', function() chat.AddText(net.ReadColor(), net.ReadString()) end) net.Receive('ULXPP.Chat', function() chat.AddText(unpack(net.ReadTable())) end) net.Receive('ULXPP.Profile', function() for k, ply in pairs(net.ReadTable()) do gui.OpenURL('http://steamcommunity.com/profiles/' .. ply:SteamID64()) end end) hook.Add('PostDrawHUD', '!ULXPP.Banish', function() if ULXPP.BANISHED then surface.SetDrawColor(color_black) surface.DrawRect(0, 0, ScrWL(), ScrHL()) return true end end, -1) hook.Add('HUDPaint', '!ULXPP.Banish', function() if ULXPP.BANISHED then surface.SetDrawColor(color_black) surface.DrawRect(0, 0, ScrWL(), ScrHL()) return true end end, -1) hook.Add('HUDShouldDraw', 'ULXPP.Banish', function(str) if not ULXPP.BANISHED then return end if str == 'CHudMenu' then return end if str == 'CHudChat' then return end if str == 'NetGraph' then return end if str == 'CHudGMod' then return end return false end) --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] local C = ULib.cmds local ENT = {} ENT.Type = 'anim' ENT.PrintName = 'Trainfuck' ENT.Author = 'DBot' function ENT:Initialize() self.time = CurTimeL() + 4 self:SetModel("models/props_combine/CombineTrain01a.mdl") self:SetCollisionGroup(COLLISION_GROUP_PLAYER) if SERVER then self:PhysicsInit(SOLID_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) local phys = self:GetPhysicsObject() if IsValid(phys) then phys:Wake() phys:EnableGravity(false) self.phys = phys end end end function ENT:SetPlayer(ply) self.Player = ply local pos = ply:GetPos() pos.x = pos.x + math.random(-1000,1000) pos.y = pos.y + math.random(-1000,1000) pos.z = pos.z + 20 self:SetPos(pos) end function ENT:PhysicsCollide(tab) if tab.HitEntity ~= self.Player then return end self.Player:GodDisable() self.Player:TakeDamage(2 ^ 31 - 1, self, self) end function ENT:Think() if CLIENT then return end if self.time < CurTimeL() then SafeRemoveEntity(self) return end if not IsValid(self.Player) then return end local ply = self.Player ply:ExitVehicle() local pos = ply:GetPos() local newpos = self:GetPos() local normal = pos - newpos local ang = (normal):Angle() ang.y = ang.y + 180 self:SetAngles(ang) if self.phys then self.phys:ApplyForceCenter(normal:GetNormalized() * 10^10) --heh c: end if not ply:GetNWBool("Spectator") and ply:GetMoveType() ~= MOVETYPE_WALK then ply:SetMoveType(MOVETYPE_WALK) end end scripted_ents.Register(ENT, 'dbot_admin_train') ULXPP.Funcs = {} --Functions not called clientside if SERVER then include('autorun/ulxpp/sv_commands.lua') end ULXPP.Declared = { mhp = { help = 'Set max health of target(s)', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 2^31 - 1, hint = 'hp', C.round} } }, roll = { help = 'Rolls the dice', category = 'ULXPP', access = ULib.ACCESS_ALL, params = { {type = C.NumArg, min = 1, max = 256, hint = 'number of faces', C.round, C.optional} } }, rocket = { help = 'Rockets target(s)', category = 'ULXPP', player = true, }, trainfuck = { help = 'Trainfucks target(s)', category = 'ULXPP', player = true, }, sin = { help = 'Forces target(s) to float in air', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 20, hint = 'time', C.round} } }, unsin = { help = 'Unfloats target(s)', category = 'ULXPP', player = true, }, banish = { help = 'Banish target(s)', category = 'ULXPP', player = true, }, unbanish = { help = 'Banish target(s)', category = 'ULXPP', player = true, }, loadout = { help = 'Gives their loadout to target(s)', category = 'ULXPP', player = true, }, giveammo = { help = 'Gives ammo for their current weapon to target(s)', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 9999, hint = 'amount', C.round} } }, giveweapon = { help = 'Gives weapon to target(s)', category = 'ULXPP', player = true, params = { {type = C.StringArg, default = 'weapon_crowbar'} } }, nodraw = { help = 'SetNoDraw for target(s) to true', category = 'ULXPP', player = true, }, unnodraw = { help = 'SetNoDraw for target(s) to false', category = 'ULXPP', player = true, }, uarmor = { help = 'Same as ulx armor but unlimited', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 2 ^ 31 - 1, hint = 'amount', C.round} } }, ctsay = { help = 'Prints colored message to chatbox of all players', category = 'ULXPP', params = { {type = C.StringArg, default = '200 200 200', hint = 'color'}, {type = C.StringArg, default = 'Sample text', hint = 'message'}, } }, ip = { help = 'Prints target(s) IPs', category = 'ULXPP', player = true, }, confuse = { help = 'Confuses target(s)', category = 'ULXPP', player = true, }, unconfuse = { help = 'Unconfuses target(s)', category = 'ULXPP', player = true, }, respawn = { help = 'Respawns target(s) if they are dead', category = 'ULXPP', player = true, }, sendlua = { help = 'SendLua for target(s)', category = 'ULXPP', player = true, access = ULib.ACCESS_SUPERADMIN, params = { {type = C.StringArg, default = '', hint = 'lua'}, } }, frespawn = { help = 'Forces Respawn of target(s)', category = 'ULXPP', player = true, }, uid = { help = 'Prints target(s) UniqueID', category = 'ULXPP', player = true, access = ULib.ACCESS_ALL, }, steamid64 = { help = 'Prints target(s) SteamID64', category = 'ULXPP', player = true, access = ULib.ACCESS_ALL, }, steamid = { help = 'Prints target(s) SteamID', category = 'ULXPP', player = true, access = ULib.ACCESS_ALL, }, profile = { help = 'Opens profile(s) of target(s)', category = 'ULXPP', player = true, access = ULib.ACCESS_ALL, }, jumppower = { help = 'Sets Jump Power of Target(s)', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 2 ^ 16, hint = 'power', C.round} } }, walkspeed = { help = 'Sets Walk Speed of Target(s)', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 2 ^ 16, hint = 'power', C.round} } }, runspeed = { help = 'Sets Run Speed of Target(s)', category = 'ULXPP', player = true, params = { {type = C.NumArg, min = 1, max = 2 ^ 16, hint = 'power', C.round} } }, silence = { help = 'Mute and Gag target(s)', category = 'ULXPP', player = true, }, unsilence = { help = 'Unmute and Ungag target(s)', category = 'ULXPP', player = true, }, buddha = { help = 'Enable buddha mode\nSame as godmode, but player\ngetting affected by knockback', category = 'ULXPP', player = true, }, unbuddha = { help = 'Disable buddha mode', category = 'ULXPP', player = true, }, bot = { help = 'Creates bots', category = 'ULXPP', access = ULib.ACCESS_SUPERADMIN, params = { {type = C.NumArg, min = 1, max = 32, hint = 'number', C.round, C.optional, default = 1} } }, kickbots = { help = 'Kicks all bots', category = 'ULXPP', }, cleanmap = { help = 'Runs game.CleanUpMap()', category = 'ULXPP', }, } for k, v in pairs(ULXPP.Declared) do v.callback = ULXPP.Funcs[k] local obj = ULXPP.CreateCommand(k, v) if v.post then v.post(obj) end end --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] if SERVER then AddCSLuaFile() AddCSLuaFile('autorun/ulxpp/sh_properties.lua') AddCSLuaFile('autorun/ulxpp/sh_commands.lua') AddCSLuaFile('autorun/ulxpp/cl_commands.lua') AddCSLuaFile('autorun/ulxpp/cl_chat.lua') util.AddNetworkString('ULXPP.Chat') end ULXPP = ULXPP or {} ULXPP.COMMANDS = ULXPP.COMMANDS or {} ULXPP.EMPTY_FUNCTION = function() end function ULXPP.UnpackCommand(str) return string.sub(str, 5) end function ULXPP.GetCommand(class) if ULXPP.COMMANDS[class] then return ULXPP.COMMANDS[class].obj end for k, data in pairs(ulx.cmdsByCategory) do for i, obj in pairs(data) do if ULXPP.UnpackCommand(obj.cmd) == class then return obj end end end end function ULXPP.Error(ply, str) ULib.tsayError(ply, str, true) end function ULXPP.StorePreviousFuncsState(ply, class, array) ply.ULXPP_STATE = ply.ULXPP_STATE or {} ply.ULXPP_STATE[class] = {} for k, v in pairs(array) do table.insert(ply.ULXPP_STATE[class], { func = v.func, gfunc = v.gfunc, value = ply[v.gfunc](ply), }) ply[v.func](ply, v.newval) end end function ULXPP.RestorePreviousFuncsState(ply, class) ply.ULXPP_STATE = ply.ULXPP_STATE or {} for k, v in pairs(ply.ULXPP_STATE[class]) do ply[v.func](ply, v.value) end end function ULXPP.CreateCommand(class, data) data.params = data.params or {} ULXPP.COMMANDS[class] = data local obj = ulx.command(data.category or 'ULXPP', 'ulx ' .. class, data.callback or ULXPP.EMPTY_FUNCTION, '!' .. class) obj:defaultAccess(data.access or ULib.ACCESS_ADMIN) obj:help(data.help or 'Undefined') if data.player then ULXPP.PlayerArg(obj) end for k, v in pairs(data.params) do obj:addParam(v) end ULXPP.COMMANDS[class].obj = obj return obj end function ULXPP.PlayerArg(obj) obj:addParam{type = ULib.cmds.PlayersArg} return obj end include('autorun/ulxpp/sh_properties.lua') include('autorun/ulxpp/sh_commands.lua') if SERVER then function ULXPP.PText(ply, ...) net.Start('ULXPP.Chat') net.WriteTable({...}) net.Send(ply) end include('autorun/ulxpp/sv_chat.lua') else include('autorun/ulxpp/cl_commands.lua') include('autorun/ulxpp/cl_chat.lua') end --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] ULXPP.Properties = ULXPP.Properties or {} function ULXPP.AddProperty(class, menuopen) ULXPP.Properties[class] = {obj = ULXPP.GetCommand(class), menuopen = menuopen} end local Property = { MenuLabel = 'ULX', Order = 0, Filter = function(self, ent, ply) return ent:IsPlayer() end, MenuOpen = function(self, menu, ent, tr) local ply = LocalPlayer() local hit = false local sub = menu:AddSubMenu() local nick = ent:Nick() for k, v in pairs(ULXPP.Properties) do local access = ULib.ucl.query(ply, 'ulx ' .. k) if not access then continue end hit = true local menu2 = sub:AddOption(k, function() RunConsoleCommand('ulx', k, nick) end) if v.obj then menu2:SetTooltip(v.obj:getUsage(ply)) end menu2.command = k menu2.nick = nick if v.menuopen then v.menuopen(self, menu2, ent, tr) end end if not hit then menu:Remove() end end, Action = function() end, } properties.Add('ulxpp', Property) local function CreateLoop(start, End, step, format) return function(self, menu2, ent, tr) local sub = menu2:AddSubMenu() for i = start, End, step do sub:AddOption(string.format(format, i), function() RunConsoleCommand('ulx', menu2.command, menu2.nick, i) end) end end end ULXPP.AddProperty('slap', CreateLoop(5, 100, 5, '%s damage')) ULXPP.AddProperty('slay') ULXPP.AddProperty('sslay') ULXPP.AddProperty('jail', CreateLoop(20, 120, 20, 'For %s seconds')) ULXPP.AddProperty('sin', CreateLoop(5, 20, 5, 'For %s seconds')) ULXPP.AddProperty('ignite', CreateLoop(20, 300, 20, 'For %s seconds')) ULXPP.AddProperty('hp', CreateLoop(20, 500, 20, '%s hp')) ULXPP.AddProperty('mhp', CreateLoop(20, 500, 20, '%s hp')) ULXPP.AddProperty('unignite') ULXPP.AddProperty('unjail') ULXPP.AddProperty('unsin') ULXPP.AddProperty('ip') ULXPP.AddProperty('uid') ULXPP.AddProperty('steamid64') ULXPP.AddProperty('steamid') ULXPP.AddProperty('profile') ULXPP.AddProperty('freeze') ULXPP.AddProperty('unfreeze') ULXPP.AddProperty('loadout') ULXPP.AddProperty('trainfuck') ULXPP.AddProperty('rocket') ULXPP.AddProperty('frespawn') --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] local ENABLED = CreateConVar('sv_ulxpp_slash', '1', {FCVAR_ARCHIVE, FCVAR_REPLICATED, FCVAR_NOTIFY}, 'Enable / command prefix') local function sayCmdCheck(ply, strText, bTeam) if not ENABLED:GetBool() then return end if string.sub(strText, 1, 1) ~= '/' then return end strText = '!' .. string.sub(strText, 2) local match for str, data in pairs(ULib.sayCmds) do local str2 = str if strText:len() < str:len() then str2 = string.Trim(str) end if strText:sub(1, str2:len()):lower() == str2 then if not match or match:len() <= str:len() then match = str end end end if not match then return end local data = ULib.sayCmds[match] local args = string.Trim(strText:sub(match:len() + 1)) local argv = ULib.splitArgs(args) if data.__cmd then local return_value = hook.Call(ULib.HOOK_COMMAND_CALLED, _, ply, data.__cmd, argv) if return_value == false then return end end if not ULib.ucl.query(ply, data.access) then ULib.tsay(ply, "You do not have access to this command, " .. ply:Nick() .. ".") return "" end local fn = data.fn local hide = data.hide ULib.pcallError(fn, ply, match:Trim(), argv, args) return '' end hook.Add("PlayerSay", "ULib_saycmdslash", sayCmdCheck, HOOK_HIGH) --[[ Copyright (C) 2016-2018 DBot -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all copies -- or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR -- PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE -- FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -- DEALINGS IN THE SOFTWARE. ]] util.AddNetworkString('ULXPP.sin') util.AddNetworkString('ULXPP.banish') util.AddNetworkString('ULXPP.coloredmessage') util.AddNetworkString('ULXPP.Profile') util.AddNetworkString('ULXPP.confuse') DAMAGE_MODE_NONE = 0 DAMAGE_MODE_BUDDHA = 1 DAMAGE_MODE_ENABLED = 2 DAMAGE_MODE_AIM = 3 local C = ULib.cmds local UP = Vector(0, 0, 10000) ULXPP.Funcs = { mhp = function(ply, targets, hp) for k, ply in ipairs(targets) do ply:SetMaxHealth(hp) end ulx.fancyLogAdmin(ply, "#A set max health for #T to #i", targets, hp) end, rocket = function(ply, targets) for k, ply in pairs(targets) do ply:SetVelocity(UP) end timer.Simple(1, function() for k, ply in ipairs(targets) do if not IsValid(ply) then continue end local effectdata = EffectData() effectdata:SetOrigin(ply:GetPos()) util.Effect("Explosion", effectdata) ply:Kill() end end) ulx.fancyLogAdmin(ply, "#A rocketed #T", targets) end, trainfuck = function(ply, targets) for k, ply in pairs(targets) do local ent = ents.Create('dbot_admin_train') ent:Spawn() ent:SetPlayer(ply) ply:ExitVehicle() ent.time = CurTimeL() + 4 end ulx.fancyLogAdmin(ply, "#A trainfucked #T", targets) end, roll = function(ply, amount) amount = amount or 6 local r = math.random(1, amount) ulx.fancyLogAdmin(ply, "#A rolled (#i) #i", amount, r) end, unsin = function(ply, targets) for k, ply in pairs(targets) do if not ply.ULXPP_SINPOS then ULXPP.Error(ply, string.format('%s is not sinused!', ply:Nick())) targets[k] = nil continue end local id = tostring(ply) .. '_ulxpp_sin' timer.Remove(id) hook.Remove('Think', id) hook.Remove('Move', id) ply.ULXPP_SINPOS = nil net.Start('ULXPP.sin') net.WriteBool(false) net.Send(ply) end ulx.fancyLogAdmin(ply, "#A unsinused #T", targets) end, sin = function(ply, targets, time) for k, ply in pairs(targets) do if ply.ULXPP_SINPOS then ULXPP.Error(ply, string.format('%s is already sinused!', ply:Nick())) targets[k] = nil continue end ply:ExitVehicle() ply.ULXPP_SINPOS = ply:GetPos() + Vector(0, 0, 50) local id = tostring(ply) .. '_ulxpp_sin' net.Start('ULXPP.sin') net.WriteBool(true) net.WriteVector(ply.ULXPP_SINPOS) net.Send(ply) hook.Add('Think', id, function() if not IsValid(ply) then return end ply:ExitVehicle() ply:SetPos(ply.ULXPP_SINPOS + Vector(0, 0, math.sin(CurTimeL()) * 50)) end) hook.Add('Move', id, function(ply2, mv) if ply2 ~= ply then return end mv:SetOrigin(ply.ULXPP_SINPOS + Vector(0, 0, math.sin(CurTimeL()) * 50)) return true end) timer.Create(id, time, 1, function() hook.Remove('Think', id) hook.Remove('Move', id) if IsValid(ply) then ply.ULXPP_SINPOS = nil net.Start('ULXPP.sin') net.WriteBool(false) net.Send(ply) end end) end ulx.fancyLogAdmin(ply, "#A sinused #T for #i seconds", targets, time) end, unbanish = function(ply, targets) for k, ply in pairs(targets) do if not ply.ULXPP_BANISHED then ULXPP.Error(ply, string.format('%s is not banished!', ply:Nick())) targets[k] = nil continue end ply.ULXPP_BANISHED = false net.Start('ULXPP.banish') net.WriteBool(false) net.Send(ply) ULXPP.RestorePreviousFuncsState(ply, 'banish') end ulx.fancyLogAdmin(ply, "#A unbanished #T", targets) end, banish = function(ply, targets) for k, ply in pairs(targets) do if ply.ULXPP_BANISHED then ULXPP.Error(ply, string.format('%s is already banished!', ply:Nick())) targets[k] = nil continue end ply.ULXPP_BANISHED = true ULXPP.StorePreviousFuncsState(ply, 'banish', { { func = 'SetNoDraw', gfunc = 'GetNoDraw', newval = true, },{ func = 'SetSolid', gfunc = 'GetSolid', newval = SOLID_NONE, },{ func = 'SetCollisionGroup', gfunc = 'GetCollisionGroup', newval = COLLISION_GROUP_NONE, },{ func = 'Freeze', gfunc = 'IsFrozen', newval = true, },{ func = 'SetPos', gfunc = 'GetPos', newval = Vector(0, 0, -16000), }, }) net.Start('ULXPP.banish') net.WriteBool(true) net.Send(ply) end ulx.fancyLogAdmin(ply, "#A banished #T", targets) end, loadout = function(ply, targets) for k, ply in pairs(targets) do hook.Run('PlayerLoadout', ply) end ulx.fancyLogAdmin(ply, "#A loadouted #T", targets) end, giveammo = function(ply, targets, amount) for k, ply in pairs(targets) do local wep = ply:GetActiveWeapon() if not IsValid(wep) then ULXPP.Error(ply, string.format('%s is not holding a valid weapon!', ply:Nick())) targets[k] = nil continue end ply:GiveAmmo(amount, wep:GetPrimaryAmmoType()) ply:GiveAmmo(amount, wep:GetSecondaryAmmoType()) end ulx.fancyLogAdmin(ply, "#A gived ammo to #T #i", targets, amount) end, giveweapon = function(ply, targets, str) for k, ply in pairs(targets) do local wep = ply:Give(str) if not IsValid(wep) then ULXPP.Error(ply, string.format('Failed to give weapon to %s!', ply:Nick())) targets[k] = nil continue end end ulx.fancyLogAdmin(ply, "#A gave weapon #s to #T", str, targets) end, nodraw = function(ply, targets) for k, ply in pairs(targets) do ply:SetNoDraw(true) end ulx.fancyLogAdmin(ply, "#A set no draw for #T to true", targets) end, unnodraw = function(ply, targets) for k, ply in pairs(targets) do ply:SetNoDraw(false) end ulx.fancyLogAdmin(ply, "#A set no draw for #T to false", targets) end, uarmor = function(ply, targets, amount) for k, ply in pairs(targets) do ply:SetArmor(amount) end ulx.fancyLogAdmin(ply, "#A set armor for #T to #i", targets, amount) end, jumppower = function(ply, targets, amount) for k, ply in pairs(targets) do ply:SetJumpPower(amount) end ulx.fancyLogAdmin(ply, "#A set the jump power for #T to #i", targets, amount) end, walkspeed = function(ply, targets, amount) for k, ply in pairs(targets) do ply:SetWalkSpeed(amount) end ulx.fancyLogAdmin(ply, "#A set the walk speed for #T to #i", targets, amount) end, runspeed = function(ply, targets, amount) for k, ply in pairs(targets) do ply:SetRunSpeed(amount) end ulx.fancyLogAdmin(ply, "#A set the run speed for #T to #i", targets, amount) end, ctsay = function(ply, color, message) net.Start('ULXPP.coloredmessage') net.WriteColor(Color(unpack(string.Explode(' ', color)))) net.WriteString(message) net.Broadcast() end, ip = function(ply, targets) local c = ply for k, ply in pairs(targets) do ULXPP.PText(c, Color(200, 200, 200), 'IP address of ', team.GetColor(ply:Team()), ply:Nick(), Color(200, 200, 200), ' is ', string.Explode(':', ply:IPAddress())[1]) end end, uid = function(ply, targets) local c = ply for k, ply in pairs(targets) do ULXPP.PText(c, Color(200, 200, 200), 'UniqueID of ', team.GetColor(ply:Team()), ply:Nick(), Color(200, 200, 200), ' is ', ply:UniqueID()) end end, steamid64 = function(ply, targets) local c = ply for k, ply in pairs(targets) do ULXPP.PText(c, Color(200, 200, 200), 'SteamID 64 of ', team.GetColor(ply:Team()), ply:Nick(), Color(200, 200, 200), ' is ', ply:SteamID64()) end end, steamid = function(ply, targets) local c = ply for k, ply in pairs(targets) do ULXPP.PText(c, Color(200, 200, 200), 'SteamID of ', team.GetColor(ply:Team()), ply:Nick(), Color(200, 200, 200), ' is ', ply:SteamID()) end end, profile = function(ply, targets) net.Start('ULXPP.Profile') net.WriteTable(targets) net.Send(ply) end, confuse = function(ply, targets) for k, ply in pairs(targets) do if ply.ULXPP_CONFUSED then ULXPP.Error(ply, string.format('%s is already confused!', ply:Nick())) targets[k] = nil continue end ply.ULXPP_CONFUSED = true local id = tostring(ply) .. '_ulxpp_confuse' net.Start('ULXPP.confuse') net.WriteBool(true) net.Send(ply) hook.Add('Move', id, function(ply2, mv) if not IsValid(ply) then hook.Remove('Move', id) return end if ply2 ~= ply then return end mv:SetSideSpeed(-mv:GetSideSpeed()) end) end ulx.fancyLogAdmin(ply, "#A confused #T", targets) end, unconfuse = function(ply, targets) for k, ply in pairs(targets) do if not ply.ULXPP_CONFUSED then ULXPP.Error(ply, string.format('%s is not confused!', ply:Nick())) targets[k] = nil continue end ply.ULXPP_CONFUSED = nil local id = tostring(ply) .. '_ulxpp_confuse' net.Start('ULXPP.confuse') net.WriteBool(false) net.Send(ply) hook.Remove('Move', id) end ulx.fancyLogAdmin(ply, "#A unconfused #T", targets) end, respawn = function(ply, targets) for k, ply in pairs(targets) do if ply:Alive() then ULXPP.Error(ply, string.format('%s is not dead!', ply:Nick())) targets[k] = nil continue end ply:Spawn() end ulx.fancyLogAdmin(ply, "#A respawned #T", targets) end, sendlua = function(ply, targets, str) for k, ply in pairs(targets) do ply:SendLua(str) end end, frespawn = function(ply, targets) for k, ply in pairs(targets) do if ply:Alive() then ply:Kill() end --Next frame timer.Simple(0, function() ply:Spawn() end) end ulx.fancyLogAdmin(ply, "#A respawned #T", targets) end, bot = function(ply, num) num = num or 1 for i = 1, num do RunConsoleCommand('bot') end ulx.fancyLogAdmin(ply, "#A created #i bots", num) end, kickbots = function(ply) for k, v in pairs(player.GetAll()) do if v:IsBot() then v:Kick('Kicked bot from server') end end ulx.fancyLogAdmin(ply, "#A kicked all bots from server") end, silence = function(ply, targets) for k, v in pairs(targets) do v.ulx_gagged = true v.gimp = 2 v:SetNWBool("ulx_gagged", true) v:SetNWBool("ulx_muted", true) end ulx.fancyLogAdmin(ply, "#A silenced #T", targets) end, unsilence = function(ply, targets) for k, v in pairs(targets) do v.ulx_gagged = false v.gimp = nil v:SetNWBool("ulx_gagged", false) v:SetNWBool("ulx_muted", false) end ulx.fancyLogAdmin(ply, "#A unsilenced #T", targets) end, cleanmap = function(ply) ulx.fancyLogAdmin(ply, "#A cleaned up map") game.CleanUpMap() end, buddha = function(ply, targets) for k, v in pairs(targets) do v:GodDisable() --Remove godmode flag v:SetSaveValue('m_takedamage', DAMAGE_MODE_BUDDHA) end ulx.fancyLogAdmin(ply, "#A enabled buddha mode on #T", targets) end, unbuddha = function(ply, targets) for k, v in pairs(targets) do v:GodDisable() --Remove godmode flag v:SetSaveValue('m_takedamage', DAMAGE_MODE_ENABLED) end ulx.fancyLogAdmin(ply, "#A disabled buddha mode on #T", targets) end, } hook.Add('PlayerDeath', 'ULX++', function(ply) if ply:GetSaveTable().m_takedamage == DAMAGE_MODE_BUDDHA then ply:SetSaveValue('m_takedamage', DAMAGE_MODE_ENABLED) end end) ,¾‡×