local meta = FindMetaTable("Player") local Banlist = {} local insert = table.insert if (SERVER) then hook.Add("InitPostEntity","InitBanlist",function() if (!sql.TableExists("Banlist")) then local Dat = { "id INTEGER PRIMARY KEY", "steamid TEXT", "time INT", "name TEXT", "reason TEXT", } Msg("No banlist was found.\nCreating new banlist!\n") sql.Query("CREATE TABLE IF NOT EXISTS Banlist ("..table.concat(Dat,",")..");") else local dat = sql.Query("SELECT * FROM Banlist") if (dat) then for k,v in pairs(dat) do insert(Banlist,v.steamid) end end end end) hook.Add("CheckPassword","BlockBannedPlayers",function(SteamID64,NetworkID,ServerPassword,Password,Name) if (table.HasValue(Banlist,util.SteamIDFrom64(SteamID64))) then print(Name.." attempted to join, but was found in the banlist. Blocking access!") return false, "You are banned from this server!" end end) --Useage: mas_goto string_playername concommand.Add("mas_goto", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_goto string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then pl:SetPos(v:GetPos()+(v:GetUp()*72)) return end end print("Player not found" .. arg[1]) end) --Useage: mas_sethp string_playername number_health --Spawn health is 100 concommand.Add("mas_sethp", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1] or !arg[2]) then print("Usage: mas_sethp string_playername number_health") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:SetHealth(arg[2]) return end end print("Player not found" .. arg[1]) end) --Useage: mas_bring string_playername concommand.Add("mas_bring", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_bring string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:SetPos(pl:GetPos()+(pl:GetUp()*72)) return end end print("Player not found" .. arg[1]) end) --Useage: mas_god string_playername --Note: all bars will still tick up, but no dammage will be taken concommand.Add("mas_god", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_god string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:GodEnable() return end end print("Player not found" .. arg[1]) end) --Useage: mas_ungod string_playername concommand.Add("mas_ungod", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_ungod string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:GodDisable() return end end print("Player not found" .. arg[1]) end) --Useage: mas_vanish string_playername concommand.Add("mas_vanish", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_vanish string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:SetColor(Color(0,0,0,0)) return end end print("Player not found" .. arg[1]) end) --Useage: mas_unvanish string_playername concommand.Add("mas_unvanish", function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if(!arg[1]) then print("Usage: mas_unvanish string_playername") return end for k,v in pairs(player.GetAll()) do if(v:Name():lower():find(arg[1]:lower())) then v:SetColor(Color(255,255,255,255)) return end end print("Player not found" .. arg[1]) end) --Useage: mas_bansteamid string_steamid number_time string_reason --You MUST include a reason for banning --If the time is 0, this will ban the player permenently concommand.Add("mas_bansteamid",function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if (!arg[3]) then return end local steamid = arg[1] local time = tonumber(arg[2] or 0) local reason = table.concat(arg," ",3) local dat = sql.Query("SELECT * FROM Banlist WHERE steamid="..SQLStr(steamid)) if (!dat) then sql.Query("INSERT INTO Banlist(steamid,time,name,reason) VALUES ("..SQLStr(steamid)..","..time..",'Unknown',"..SQLStr(reason)..")") insert(Banlist,steamid) for k,v in pairs(player.GetAll()) do if (v:SteamID() == steamid) then v:Kick("Banned from server: "..reason) end v:ChatPrint(pl:Nick().." has banned "..steamid) end MsgN(pl:Nick().." has banned "..steamid) else MsgN(steamid.." was already located in the database.") end end) --Usgeage: mas_unbansteamid string_steamid concommand.Add("mas_unbansteamid",function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if (!arg[1]) then return end local dat = sql.Query("DELETE * FROM Banlist WHERE steamid="..SQLStr(arg[1])) if (dat) then MsgN(pl:Nick().." has unbanned "..arg[1]) for k,v in pairs(Banlist) do if (v == arg[1]) then table.remove(Banlist,k) break end end end end) --Usage: mas_printbannedplayers concommand.Add("mas_printbannedplayers",function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end local dat = sql.Query("SELECT * FROM Banlist") if (dat) then for k,v in pairs(dat) do pl:ChatPrint(v.steamid.." - "..v.name) end end end) --Usage: mas_banplayer string_playername --Note: will ban the first player that contains playername, in the order the players joined the server concommand.Add("mas_banplayer",function(pl,com,arg) if (!IsValid(pl) or !pl:IsAdmin()) then return end if (!arg[3]) then return end local name = arg[1] local time = tonumber(arg[2] or 0) local reason = table.concat(arg," ",3) for k,v in pairs(player.GetAll()) do if (v:Nick():lower():find(name:lower())) then local dat = sql.Query("SELECT * FROM Banlist WHERE steamid="..SQLStr(v:SteamID())) if (!dat) then sql.Query("INSERT INTO Banlist(steamid,time,name,reason) VALUES ("..SQLStr(v:SteamID())..","..time..","..SQLStr(v:Nick())..","..SQLStr(reason)..")") insert(Banlist,v:SteamID()) v:Kick("Banned from server: "..reason) break end end end end) else end