Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*----------------------------------------------------------------------
- Leak by Famouse
- Play good games:↓
- http://store.steampowered.com/curator/32364216
- Subscribe to the channel:↓
- www.youtube.com/c/Famouse
- More leaks in the discord:↓
- https://discord.gg/rFdQwzm
- ------------------------------------------------------------------------*/
- -- If you do not know Lua fairly well, I would suggest that you do not edit this file --
- -- [[ Sidebar Buttons ]] --
- /*
- This is for editing the buttons that show up on the right side when selecting a user on the scoreboard
- ------------------------
- Creating A Custom Button
- ------------------------
- To create a custom button, you must create a custom category to hold all of your custom buttons.
- Create a new anonymous table inside of the 'FancyScoreboard.Buttons' table. This table MUST contain these three variables:
- - Category (String) The text that shows on the label above your buttons
- - Enabled (Bool | Function) Either a bool or a function to determine whether to display it to the player or not
- - Buttons (Table) A table that contains all of the buttons that are part of this category
- (More info on these can be found in the 'Documentation' section below)
- Then, to create buttons inside of your category, create a new anonymous table inside of the "Buttons" sub-table you created.
- This table also has three REQUIRED variables:
- - Name (String | Function) The text that is written on your button
- - Enabled (Bool | Function) Determines whether the user should be able to see your button
- - Action (Function) A function that's called when the user clicks the button
- (Again, more information on these can be found below)
- -------
- Example
- -------
- -- This table should be placed in "FancyScoreboard.Buttons"
- {
- Category = "Example Category", -- The text for the label above the buttons
- Enabled = true, -- Category will always show
- Buttons = {
- -- Basic button
- {
- Name = "Print Hi", -- Button text
- Enabled = true, -- Always enabled
- Action = function(selectedPly) -- Callback for button press
- chat.AddText(FancyScoreboard.Colors.Accent, "Currently selecting: ", FancyScoreboard.Colors.Text, selectedPly:Nick())
- end
- }, -- Don't forget this comma
- -- Slightly more advanced button
- {
- Name = function(selectedPly)
- -- Button's text will be selected player's name
- return selectedPly:Nick()
- end,
- Enabled = function(selectedPly)
- -- Button only enabled if local player is admin
- return LocalPlayer():IsAdmin()
- end,
- Action = function(selectedPly)
- RunConsoleCommand("say", "Hello " .. selectedPly.Nick())
- end
- }, -- Don't forget this comma
- }
- }, -- Don't forget the ending comma
- --------------------
- Documentation Format
- --------------------
- // Variable Name //
- == Type Information
- -- Short Description
- [Ex.] Example
- -------------
- Documentation
- -------------
- -- Main table, holds everything that is related to one specific "category" of buttons
- {
- // Category //
- == String
- -- This is the text that will show on the label above your buttons
- [Ex.] Category = "Your Category",
- // Enabled //
- == Boolean [OR] Function(selectedPly)
- == The function has 1 argument: The player that is currently selected on the scoreboard
- == The function must return a boolean value
- -- If your category of buttons should show up for the user
- [Ex.] Enabled = true, -- Category and buttons will always show
- [Ex.] Enabled = false, -- Will never show
- [Ex.] Enabled = function(selectedPly)
- -- Button will only show if the local player is admin
- return LocalPlayer():IsAdmin()
- end,
- -- Table that contains all of the buttons for this category
- Buttons = {
- {
- // Name //
- == String OR Function(selectedPly)
- == The function has 1 argument: The currently selected player
- == The function must return a string
- -- The text that shows on the button
- [Ex.] Name = "Your button",
- [Ex.] Name = function(selectedPlayer)
- return selectedPlayer:Nick()
- end
- // Enabled //
- == Boolean OR Function(selectedPly)
- == The function has 1 argument: The currently selected player
- == The function has 1 argument: The currently selected player
- == The function must return a boolean value
- -- Whether your buttons will show up for the user.
- [Ex.] Enabled = true, -- Button will always show
- [Ex.] Enabled = function(selectedPly)
- -- Button will only show if the local player is admin
- return LocalPlayer():IsAdmin()
- end,
- // Action //
- == Function(selectedPly)
- == The argument, "selectedPly", is the player currently selected on the scoreboard
- -- The callback function that's called when the user presses the button
- [Ex.] Action = function(selectedPly)
- -- Prints out the name of the selected player using the "Accent" color from the current theme
- chat.AddText(FancyScoreboard.Colors.Accent, "You have selected ", selectedPly:Nick())
- end
- },
- },
- },
- !! Make sure not to forget the ending commas after the closing brackets for the tables !!
- */
- FancyScoreboard.Buttons = {
- -- Basic Actions
- {
- Category = FancyScoreboard.GetPhrase("BasicActions"),
- Enabled = FancyScoreboard.Modules.Basic_Actions,
- Buttons = {
- {
- Name = FancyScoreboard.GetPhrase("CopySteamID"),
- Enabled = true,
- Action = function(selectedPly)
- SetClipboardText(selectedPly:SteamID())
- chat.AddText(FancyScoreboard.Colors.Accent, FancyScoreboard.GetPhrase("CopiedID"))
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("OpenProfile"),
- Enabled = true,
- Action = function(selectedPly)
- if selectedPly:SteamID() ~= "NULL" then
- gui.OpenURL("http://www.steamcommunity.com/profiles/" .. tostring(selectedPly:SteamID64()) .. "/")
- else
- chat.AddText(FancyScoreboard.Colors.Accent, FancyScoreboard.GetPhrase("ProfileBot"))
- end
- end
- },
- }
- },
- -- DarkRP Actions
- {
- Category = FancyScoreboard.GetPhrase("DarkRPActions"),
- Enabled = function(selectedPly)
- return DarkRP ~= nil and LocalPlayer():IsAdmin() and FancyScoreboard.Modules.DarkRP_Actions
- end,
- Buttons = {
- {
- Name = FancyScoreboard.GetPhrase("SetMoney"),
- Enabled = true,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("SetMoneyTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Amount = 0
- }
- local amountLabel = vgui.Create("DLabel", menu)
- amountLabel:SetText(FancyScoreboard.GetPhrase("Amount") .. ":")
- amountLabel:SetFont("FancyScoreboard.Normal")
- amountLabel:SizeToContents()
- amountLabel:SetPos(0, 0)
- local amountBox = vgui.Create("DTextEntry", menu)
- amountBox:SetText("")
- amountBox:SetPos(0, amountLabel:GetTall() + 5)
- print("amountBox: " .. amountLabel:GetTall() + 5)
- amountBox:SetSize(menu:GetWide(), 26)
- amountBox:SetFont("FancyScoreboard.Normal")
- amountBox:SetNumeric(true)
- function amountBox:OnChange()
- settings.Amount = tonumber(self:GetText())
- end
- return settings
- end,
- OnAccept = function(settings)
- RunConsoleCommand("darkrp", "setmoney", selectedPly:Nick(), tostring(settings.Amount))
- end
- })
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("JobBan"),
- Enabled = function(selectedPly)
- return DarkRP ~= nil and LocalPlayer():IsAdmin() and FancyScoreboard.Modules.DarkRP_Actions
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("JobBanTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Job = 1,
- Time = 0
- }
- local timeChoices = {
- [FancyScoreboard.GetPhrase("Forever")] = 0,
- [FancyScoreboard.GetPhrase("Second")] = 1,
- [FancyScoreboard.GetPhrase("Minute")] = 60,
- [FancyScoreboard.GetPhrase("Hour")] = 3600,
- [FancyScoreboard.GetPhrase("Day")] = 86400,
- [FancyScoreboard.GetPhrase("Week")] = 604800
- }
- local yPos = 0
- local timeMult = timeChoices["Hours"]
- local jobLabel = vgui.Create("DLabel", menu)
- jobLabel:SetText(FancyScoreboard.GetPhrase("Job") .. ":")
- jobLabel:SetFont("FancyScoreboard.Normal")
- jobLabel:SizeToContents()
- jobLabel:SetPos(0, yPos)
- yPos = yPos + jobLabel:GetTall() + 5
- local jobBox = vgui.Create("DComboBox", menu)
- jobBox:SetFont("FancyScoreboard.Normal")
- jobBox:SetSize(menu:GetWide(), 26)
- jobBox:SetPos(0, yPos)
- for k, v in pairs(FancyScoreboard.GetDarkRPJobs()) do
- jobBox:AddChoice(v.name, v.team)
- end
- jobBox:ChooseOption(team.GetName(selectedPly:Team()))
- function jobBox:OnSelect(index, value, boxData)
- settings.Job = boxData
- end
- yPos = yPos + jobBox:GetTall() + 25
- local timeLabel = vgui.Create("DLabel", menu)
- timeLabel:SetText(FancyScoreboard.GetPhrase("Time") .. ":")
- timeLabel:SetFont("FancyScoreboard.Normal")
- timeLabel:SizeToContents()
- timeLabel:SetPos(0, yPos)
- yPos = yPos + timeLabel:GetTall() + 5
- local timeField = vgui.Create("DNumberWang", menu)
- timeField:SetPos(0, yPos)
- timeField:SetDecimals(0)
- timeField:SetMinMax(0, 10000)
- timeField:SetValue(1)
- function timeField:OnValueChanged(val)
- settings.Time = val * timeMult
- end
- yPos = yPos + timeField:GetTall() + 5
- local timeBox = vgui.Create("DComboBox", menu)
- timeBox:SetFont("FancyScoreboard.Normal")
- timeBox:SetSize(menu:GetWide(), 26)
- timeBox:SetPos(0, yPos)
- for k, v in SortedPairsByValue(timeChoices) do
- timeBox:AddChoice(k, v)
- end
- timeBox:ChooseOption(FancyScoreboard.GetPhrase("Forever"))
- function timeBox:OnSelect(index, value, boxData)
- timeMult = boxData
- settings.Time = settings.Time * timeMult
- end
- return settings
- end,
- OnAccept = function(settings)
- RunConsoleCommand("darkrp", "teamban", tostring(selectedPly:Nick()), tostring(settings.Job), tostring(settings.Time))
- end,
- })
- end,
- },
- {
- Name = FancyScoreboard.GetPhrase("JobUnban"),
- Enabled = function(selectedPly)
- return DarkRP ~= nil and LocalPlayer():IsAdmin() and FancyScoreboard.Modules.DarkRP_Actions
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("JobUnbanTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Job = 1
- }
- local yPos = 0
- local jobLabel = vgui.Create("DLabel", menu)
- jobLabel:SetText(FancyScoreboard.GetPhrase("Job") .. ":")
- jobLabel:SetFont("FancyScoreboard.Normal")
- jobLabel:SizeToContents()
- jobLabel:SetPos(0, yPos)
- yPos = yPos + jobLabel:GetTall() + 5
- local jobBox = vgui.Create("DComboBox", menu)
- jobBox:SetFont("FancyScoreboard.Normal")
- jobBox:SetSize(menu:GetWide(), 26)
- jobBox:SetPos(0, yPos)
- for k, v in pairs(FancyScoreboard.GetDarkRPJobs()) do
- jobBox:AddChoice(v.name, v.team)
- end
- jobBox:ChooseOption(team.GetName(selectedPly:Team()))
- function jobBox:OnSelect(index, value, boxData)
- settings.Job = boxData
- end
- return settings
- end,
- OnAccept = function(settings)
- RunConsoleCommand("darkrp", "teamunban", tostring(selectedPly:Nick()), tostring(settings.Job))
- end,
- })
- end,
- }
- }
- },
- -- ULX Actions
- {
- Category = FancyScoreboard.GetPhrase("ULXActions"),
- Enabled = function(selectedPly)
- return ulx ~= nil and FancyScoreboard.Modules.ULX_Actions == true
- end,
- Buttons = {
- {
- Name = FancyScoreboard.GetPhrase("Goto"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx goto") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "goto", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Bring"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx bring") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "bring", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Slay"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx slay") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "slay", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Freeze"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx freeze") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "freeze", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Unfreeze"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx unfreeze") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "unfreeze", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Spectate"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx spectate") end,
- Action = function(selectedPly)
- RunConsoleCommand("ulx", "spectate", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Kick"),
- Enabled = function(selectedPly) return LocalPlayer():query("ulx kick") end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("KickTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultKickReason,
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("ulx", "kick", selectedPly:Nick(), tostring(settings.Reason))
- else
- RunConsoleCommand("ulx", "kick", selectedPly:Nick())
- end
- end
- })
- end
- },
- {
- Name = "Ban",
- Enabled = function(selectedPly) return LocalPlayer():query("ulx ban") end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("BanTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultBanReason,
- Length = 0
- }
- local banLengths = {
- [FancyScoreboard.GetPhrase("Forever")] = 0,
- ["1 " .. FancyScoreboard.GetPhrase("Hour")] = 60,
- ["1 " .. FancyScoreboard.GetPhrase("Day")] = 1440,
- ["1 " .. FancyScoreboard.GetPhrase("Week")] = 10080,
- ["1 " .. FancyScoreboard.GetPhrase("Month")] = 43800,
- ["1 " .. FancyScoreboard.GetPhrase("Year")] = 525600
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- local lengthLabel = vgui.Create("DLabel", menu)
- lengthLabel:SetText(FancyScoreboard.GetPhrase("Time") .. ":")
- lengthLabel:SetFont("FancyScoreboard.Normal")
- lengthLabel:SizeToContents()
- lengthLabel:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + 10)
- local lengthBox = vgui.Create("DComboBox", menu)
- lengthBox:SetFont("FancyScoreboard.Normal")
- lengthBox:SetSize(menu:GetWide(), 26)
- lengthBox:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + lengthLabel:GetTall() + 15)
- for k, v in SortedPairsByValue(banLengths) do
- lengthBox:AddChoice(k, v)
- end
- lengthBox:ChooseOption(FancyScoreboard.GetPhrase("Forever"))
- function lengthBox:OnSelect(index, value, boxData)
- settings.Length = boxData
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("ulx", "ban", selectedPly:Nick(), tostring(settings.Length), tostring(settings.Reason))
- else
- RunConsoleCommand("ulx", "ban", selectedPly:Nick(), tostring(settings.Length))
- end
- end
- })
- end
- }
- }
- },
- -- Serverguard actions
- {
- Category = FancyScoreboard.GetPhrase("ServerguardActions"),
- Enabled = function(selectedPly)
- return serverguard ~= nil and FancyScoreboard.Modules.Serverguard_Actions
- end,
- Buttons = {
- {
- Name = FancyScoreboard.GetPhrase("Bring"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Bring")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("sg", "bring", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Goto"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Goto")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("sg", "goto", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Slay"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Slay")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("sg", "slay", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("ToggleFreeze"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Freeze")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("sg", "freeze", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Spectate"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Spectate")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("sg", "spectate", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Kick"),
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Kick")
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("KickTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultKickReason,
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("sg", "kick", selectedPly:Nick(), tostring(settings.Reason))
- else
- RunConsoleCommand("sg", "kick", selectedPly:Nick())
- end
- end
- })
- end
- },
- {
- Name = "Ban",
- Enabled = function(selectedPly)
- return serverguard.player:HasPermission(LocalPlayer(), "Ban")
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("BanTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultBanReason,
- Length = 0
- }
- local banLengths = {
- [FancyScoreboard.GetPhrase("Forever")] = 0,
- ["1 " .. FancyScoreboard.GetPhrase("Hour")] = 60,
- ["1 " .. FancyScoreboard.GetPhrase("Day")] = 1440,
- ["1 " .. FancyScoreboard.GetPhrase("Week")] = 10080,
- ["1 " .. FancyScoreboard.GetPhrase("Month")] = 43800,
- ["1 " .. FancyScoreboard.GetPhrase("Year")] = 525600
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- local lengthLabel = vgui.Create("DLabel", menu)
- lengthLabel:SetText(FancyScoreboard.GetPhrase("Time") .. ":")
- lengthLabel:SetFont("FancyScoreboard.Normal")
- lengthLabel:SizeToContents()
- lengthLabel:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + 10)
- local lengthBox = vgui.Create("DComboBox", menu)
- lengthBox:SetFont("FancyScoreboard.Normal")
- lengthBox:SetSize(menu:GetWide(), 26)
- lengthBox:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + lengthLabel:GetTall() + 15)
- for k, v in SortedPairsByValue(banLengths) do
- lengthBox:AddChoice(k, v)
- end
- lengthBox:ChooseOption(FancyScoreboard.GetPhrase("Forever"))
- function lengthBox:OnSelect(index, value, boxData)
- settings.Length = boxData
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("sg", "ban", selectedPly:Nick(), tostring(settings.Length), tostring(settings.Reason))
- else
- RunConsoleCommand("sg", "ban", selectedPly:Nick(), tostring(settings.Length))
- end
- end
- })
- end
- }
- }
- },
- -- FAdmin Actions
- {
- Category = FancyScoreboard.GetPhrase("FAdminActions"),
- Enabled = function(selectedPly)
- return FAdmin ~= nil and FancyScoreboard.Modules.FAdmin_Actions
- end,
- Buttons = {
- {
- Name = FancyScoreboard.GetPhrase("Bring"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "bring")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("FAdmin", "bring", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Goto"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "goto")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("FAdmin", "goto", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Slay"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "slay")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("FAdmin", "slay", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Freeze"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "freeze")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("FAdmin", "freeze", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Unfreeze"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "unfreeze")
- end,
- Action = function(selectedPly)
- RunConsoleCommand("FAdmin", "unfreeze", selectedPly:Nick())
- end
- },
- {
- Name = FancyScoreboard.GetPhrase("Kick"),
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "kick")
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("KickTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultKickReason,
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("FAdmin", "kick", selectedPly:Nick(), tostring(settings.Reason))
- else
- RunConsoleCommand("FAdmin", "kick", selectedPly:Nick())
- end
- end
- })
- end
- },
- {
- Name = "Ban",
- Enabled = function(selectedPly)
- return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "ban")
- end,
- Action = function(selectedPly)
- FancyScoreboard.OpenDialogue({
- Title = FancyScoreboard.GetPhrase("BanTitle", {"%player%", selectedPly:Nick()}),
- Type = "Confirm",
- Width = 450,
- Build = function(menu)
- local settings = {
- Reason = FancyScoreboard.Config.DefaultBanReason,
- Length = 0
- }
- local banLengths = {
- [FancyScoreboard.GetPhrase("Forever")] = 0,
- ["1 " .. FancyScoreboard.GetPhrase("Hour")] = 60,
- ["1 " .. FancyScoreboard.GetPhrase("Day")] = 1440,
- ["1 " .. FancyScoreboard.GetPhrase("Week")] = 10080,
- ["1 " .. FancyScoreboard.GetPhrase("Month")] = 43800,
- ["1 " .. FancyScoreboard.GetPhrase("Year")] = 525600
- }
- local reasonLabel = vgui.Create("DLabel", menu)
- reasonLabel:SetText(FancyScoreboard.GetPhrase("Reason") .. ":")
- reasonLabel:SetFont("FancyScoreboard.Normal")
- reasonLabel:SizeToContents()
- reasonLabel:SetPos(0, 0)
- local reasonBox = vgui.Create("DTextEntry", menu)
- reasonBox:SetText("")
- reasonBox:SetPos(0, reasonLabel:GetTall() + 5)
- reasonBox:SetSize(menu:GetWide(), 26)
- reasonBox:SetFont("FancyScoreboard.Normal")
- function reasonBox:OnChange()
- settings.Reason = self:GetText()
- end
- local lengthLabel = vgui.Create("DLabel", menu)
- lengthLabel:SetText(FancyScoreboard.GetPhrase("Time") .. ":")
- lengthLabel:SetFont("FancyScoreboard.Normal")
- lengthLabel:SizeToContents()
- lengthLabel:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + 10)
- local lengthBox = vgui.Create("DComboBox", menu)
- lengthBox:SetFont("FancyScoreboard.Normal")
- lengthBox:SetSize(menu:GetWide(), 26)
- lengthBox:SetPos(0, reasonLabel:GetTall() + reasonBox:GetTall() + lengthLabel:GetTall() + 15)
- for k, v in SortedPairsByValue(banLengths) do
- lengthBox:AddChoice(k, v)
- end
- lengthBox:ChooseOption(FancyScoreboard.GetPhrase("Forever"))
- function lengthBox:OnSelect(index, value, boxData)
- settings.Length = boxData
- end
- return settings
- end,
- OnAccept = function(settings)
- if settings.Reason then
- RunConsoleCommand("FAdmin", "ban", selectedPly:Nick(), tostring(settings.Length), tostring(settings.Reason))
- else
- RunConsoleCommand("FAdmin", "ban", selectedPly:Nick(), tostring(settings.Length))
- end
- end
- })
- end
- }
- }
- },
- }
- /*------------------------------------------------------------------------
- Donation for leaks
- Qiwi Wallet 4890494419811120
- YandexMoney 410013095053302
- WebMoney(WMR) R235985364414
- WebMoney(WMZ) Z309855690994
- ------------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment