Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CLIENT
- -- Fonts
- surface.CreateFont("WasiedRefundFont", {
- font = "Arial",
- size = 23,
- weight = 2000,
- })
- surface.CreateFont("WasiedRefundFont2", {
- font = "Arial",
- size = 18,
- weight = 1000,
- })
- surface.CreateFont("WasiedRefundFont3", {
- font = "Arial",
- size = 18,
- weight = 700,
- })
- surface.CreateFont("WasiedAdminMenuTitle", {
- font = "Trebuchet24",
- size = 30,
- weight = 700,
- })
- surface.CreateFont("WasiedAdminMenuClose", {
- font = "Trebuchet24",
- size = 60,
- weight = 700,
- })
- surface.CreateFont("WasiedAdminMenuButton", {
- font = "Trebuchet24",
- size = 35,
- weight = 700,
- })
- local lang = AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage]
- local staffMod = 0
- -- Disable FAdmin Messages
- if AdvancedStaffConfig.HideFAdmin then
- timer.Simple(5, function()
- function FAdmin.Messages.AddMessage(MsgType, Message)
- end
- end)
- end
- -- Hide Physgun Beam
- if AdvancedStaffConfig.HidePhysForStaff then
- hook.Add("DrawPhysgunBeam", "NoDrawPhysgunBeamOnStaff", function(ply)
- return not ply:Team() == AdvancedStaffConfig.AllowedTeam
- end)
- end
- -- Staff Mod
- if AdvancedStaffConfig.ShowMoreInfos && AdvancedStaffConfig.ShowMoreContext && AdvancedStaffConfig.AllowedRanks[LocalPlayer():GetUserGroup()] then
- hook.Add("OnContextMenuOpen", "AdvAdminContextOpen", function()
- staffMod = 1
- end)
- hook.Add("OnContextMenuClose", "AdvAdminContextClose", function()
- staffMod = 0
- end)
- end
- -- Refund Menu
- net.Receive("AdvAdminSyst:Refund:OpenMenu", function()
- local playertable = net.ReadTable()
- local scrw, scrh = ScrW(), ScrH()
- local refundframe = vgui.Create("DFrame")
- refundframe:SetPos(0,0)
- refundframe:SetSize(600,700)
- refundframe:Center()
- refundframe:SetTitle("")
- refundframe:ShowCloseButton(false)
- refundframe:MakePopup()
- refundframe:SlideDown(1)
- function refundframe.Paint(self, w, h)
- Derma_DrawBackgroundBlur(self, self.startTime)
- draw.RoundedBox(0, 0, 0, w, h, Color(205,180,180,150))
- draw.RoundedBox(0, 0, 0, w, 50, Color(255,70,70,190))
- draw.DrawText(lang.RefundMenuTitle, "WasiedRefundFont", w/2, 5, Color(255,255,255,255), TEXT_ALIGN_CENTER)
- draw.DrawText(lang.RefundMenuSubhead, "WasiedRefundFont2", w/2, 25, Color(255,255,255,255), TEXT_ALIGN_CENTER)
- end
- local closebutton = vgui.Create("DButton", refundframe)
- closebutton:SetPos(0,660)
- closebutton:SetSize(600,40)
- closebutton:SetText("")
- closebutton:SetTextColor(Color(255,0,0))
- closebutton.DoClick = function()
- refundframe:SlideUp(1)
- end
- closebutton.OnCursorEntered = function(self)
- self.hover = true
- surface.PlaySound("UI/buttonrollover.wav")
- end
- closebutton.OnCursorExited = function(self)
- self.hover = false
- end
- function closebutton.Paint(self, w, h)
- if !self.hover then
- draw.RoundedBox(0, 0, 0, w, h, Color(255,70,70,190))
- else
- draw.RoundedBox(0, 0, 0, w, h, Color(255,90,90,220))
- end
- draw.DrawText(lang.CloseButton,"WasiedRefundFont",w/2, h/4, Color(255,255,255,255), TEXT_ALIGN_CENTER)
- end
- local scrollpanel = vgui.Create("DScrollPanel", refundframe)
- scrollpanel:SetPos(10,70)
- scrollpanel:SetSize(580,520)
- local scrollbar = scrollpanel:GetVBar()
- function scrollbar:Paint(w, h)
- draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 110 ) )
- end
- function scrollbar.btnUp:Paint(w, h)
- draw.RoundedBox( 2, 0, 0, w, h, Color(32, 32, 32) )
- end
- function scrollbar.btnDown:Paint(w, h)
- draw.RoundedBox( 2, 0, 0, w, h, Color(32, 32, 32) )
- end
- function scrollbar.btnGrip:Paint(w, h)
- draw.RoundedBox( 6, 0, 0, w, h, Color(0, 137, 255) )
- end
- for _,v in pairs(player.GetAll()) do
- if not playertable[v:EntIndex()] then continue end
- local weapons = table.concat(playertable[v:EntIndex()].weapons,", ")
- local refundemb = vgui.Create("DPanel", scrollpanel)
- refundemb:SetSize(0,80)
- refundemb:DockMargin(0,0,0,5)
- refundemb:Dock( TOP )
- function refundemb:Paint(w,h)
- draw.RoundedBox(5,0,0,w,h,Color(26,30,39))
- draw.SimpleText(lang.NameText.." : " .. v:GetName(), "WasiedRefundFont3", 80, 10, Color(255, 255, 255))
- draw.SimpleText(lang.MoneyBeforeDeathText.." : " .. playertable[v:EntIndex()].money .. lang.Currency, "WasiedRefundFont3", 80, 25, Color(255, 255, 255))
- draw.DrawText(lang.WeaponsBeforeDeathText.." :\n".. weapons, "WasiedRefundFont3", 80, 40, Color(255,255,255))
- end
- local pm = vgui.Create("DModelPanel", refundemb)
- pm:SetSize(70,70)
- pm:SetPos(5,5)
- pm:SetModel(v:GetModel())
- pm:SetFOV(15)
- pm:SetCamPos(Vector(50,0,55))
- pm:SetLookAt(v:OBBCenter() + Vector(0,0,25))
- function pm:LayoutEntity() return end
- function pm.Entity:GetPlayerColor() return v:GetPlayerColor() end
- local acceptbutton = vgui.Create("DButton", refundemb)
- acceptbutton:SetPos(400,15)
- acceptbutton:SetSize(100,35)
- acceptbutton:SetText(lang.RefundButtonText)
- acceptbutton:SetTextColor(Color(255,255,255))
- acceptbutton:SetFont("WasiedRefundFont")
- acceptbutton.OnCursorEntered = function(self)
- surface.PlaySound("UI/buttonrollover.wav")
- self.hover = true
- end
- acceptbutton.OnCursorExited = function(self)
- self.hover = false
- end
- acceptbutton.Paint = function(self, w, h)
- if !self.hover then
- draw.RoundedBox(6, 0, 0, w, h, Color(0,128,255))
- else
- draw.RoundedBox(5, 0, 0, w, h, Color(0,160,255))
- end
- end
- acceptbutton.DoClick = function()
- if IsValid(v) then
- net.Start("AdvAdminSyst:Refund:ReturnStuff")
- net.WriteEntity(v)
- net.SendToServer()
- refundframe:Close()
- surface.PlaySound("buttons/button14.wav")
- end
- end
- end
- end)
- -- Staff Mod
- local function ShowBasicInfos()
- if staffMod == 1 then
- if AdvancedStaffConfig.AllowedRanks[LocalPlayer():GetUserGroup()] then
- for _,v in pairs(player.GetAll()) do
- if !IsValid(v) then return end
- if LocalPlayer() != v then
- local pos = v:GetShootPos()
- pos.z = pos.z+5
- pos = pos:ToScreen()
- if not pos.visible then continue end
- local x, y = pos.x, pos.y
- draw.DrawText("●", "Trebuchet20", x-2 , y-27, team.GetColor(v:Team()), TEXT_ALIGN_CENTER)
- if v:GetPos():Distance(LocalPlayer():GetPos()) < AdvancedStaffConfig.MaxDistance then
- -- Name
- draw.RoundedBox( 0, x-62, y-71, 130, 20, Color(0,0,0,90) )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/vcard.png") )
- surface.DrawTexturedRect( x-60, y-69, 16, 16 )
- draw.DrawText(v:GetName(), "Trebuchet18", x+10 , y-71, Color(255,255,255,200), TEXT_ALIGN_CENTER)
- -- Job
- local jobColor = team.GetColor(v:Team())
- local jobName = team.GetName(v:Team())
- jobColor.a = 90
- draw.RoundedBox( 0, x-62, y-50, 130, 20, jobColor )
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/user_suit.png") )
- surface.DrawTexturedRect( x-60, y-48, 16, 16 )
- draw.DrawText(jobName, "Trebuchet20", x , y-50, Color(255,255,255,200), TEXT_ALIGN_CENTER)
- if LocalPlayer():GetNWInt("MoreInfos") == 1 then
- -- Money
- local money = v:getDarkRPVar("money") or 0
- draw.RoundedBox( 0, x-62, y-92, 130, 20, Color(0,204,0,90))
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/money.png") )
- surface.DrawTexturedRect( x-60, y-90, 16, 16 )
- draw.DrawText(money..lang.Currency, "Trebuchet20", x, y-94, Color(255,255,255), TEXT_ALIGN_CENTER)
- -- Health
- local plyHealth = math.Clamp(v:Health(), 0, 100)
- draw.RoundedBox( 0, x-62, y-114, plyHealth*1.3, 20, Color(255,0,0,90))
- surface.SetDrawColor( 255, 0, 0, 255 )
- surface.SetMaterial( Material("icon16/heart.png") )
- surface.DrawTexturedRect( x-60, y-112, 16, 16 )
- draw.DrawText(v:Health()..lang.HealthPoint, "Trebuchet20", x, y-116, Color(255,255,255,200), TEXT_ALIGN_CENTER)
- -- Armor
- local plyArmor = math.Clamp(v:Armor(), 0, 100)
- if plyArmor == 0 then
- draw.RoundedBox( 0, x-62, y-136, 130, 20, Color(0,0,0,90))
- else
- draw.RoundedBox( 0, x-62, y-136, plyArmor*1.3, 20, Color(255,0,0,90))
- end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/shield.png") )
- surface.DrawTexturedRect( x-60, y-134, 16, 16 )
- draw.DrawText(v:Armor(), "Trebuchet20", x, y-138, Color(255,255,255,200), TEXT_ALIGN_CENTER)
- -- Hunger
- local plyHunger = v:getDarkRPVar( "Energy" ) or 0
- if plyHunger == 0 then
- draw.RoundedBox( 0, x-62, y-158, 130, 20, Color(0,0,0,90))
- else
- draw.RoundedBox( 0, x-62, y-158, plyHunger*130/100, 20, Color(255, 110, 0,90))
- end
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/cup.png") )
- surface.DrawTexturedRect( x-60, y-156, 16, 16 )
- draw.DrawText(plyHunger, "Trebuchet20", x, y-160, Color(255,255,255), TEXT_ALIGN_CENTER)
- -- Rank
- local plyRank = v:GetUserGroup()
- draw.RoundedBox( 0, x-62, y-178, 130, 20, Color(255, 110, 0,90))
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material("icon16/key.png") )
- surface.DrawTexturedRect( x-60, y-176, 16, 16 )
- draw.DrawText(plyRank, "Trebuchet20", x, y-180, Color(255,255,255), TEXT_ALIGN_CENTER)
- end
- end
- end
- end
- end
- end
- end
- hook.Add("HUDPaint", "DrawPlyInfos", ShowBasicInfos)
- net.Receive("AdvAdminSyst:ShowInfo:Show", function()
- local int = net.ReadInt(4)
- staffMod = int
- end)
- net.Receive("AdvAdminSyst:AdminMenu:Open", function()
- if IsValid(menuframe) then return end
- local menuframe = vgui.Create("DFrame")
- menuframe:SetSize(ScrW()/2,ScrH()/4)
- menuframe:Center()
- menuframe:SetTitle("")
- menuframe:SetDraggable(false)
- menuframe:MakePopup()
- function menuframe:Paint(w,h)
- draw.RoundedBox(3, 0, 0, w, h, Color(30,30,30,230))
- draw.RoundedBox(2, 0, 0, w, 40, Color(60,120,255))
- draw.SimpleText(lang.AdminMenuTitle, "WasiedAdminMenuTitle", w/2, 7, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
- end
- local refundMenu = vgui.Create("DButton", menuframe)
- refundMenu:SetPos(10, 60)
- refundMenu:SetSize(menuframe:GetWide()/2-20,55)
- refundMenu:SetText("")
- refundMenu.OnCursorEntered = function(self)
- surface.PlaySound("UI/buttonrollover.wav")
- self.hover = true
- end
- refundMenu.OnCursorExited = function(self)
- self.hover = false
- end
- function refundMenu:Paint(w, h)
- if !self.hover then
- draw.RoundedBox(8, 0, 0, w, h, Color(0,0,0,220))
- else
- draw.RoundedBox(8, 0, 0, w, h, Color(30,30,30,220))
- end
- draw.SimpleText(lang.RefundMenuTitle, "WasiedAdminMenuButton", w/2, h/2, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- refundMenu.DoClick = function()
- menuframe:Close()
- LocalPlayer():ConCommand("say "..AdvancedStaffConfig.RefundTextCommand)
- end
- local staffMod = vgui.Create("DButton", menuframe)
- staffMod:SetPos(menuframe:GetWide()/2+10, 60)
- staffMod:SetSize(menuframe:GetWide()/2-20,55)
- staffMod:SetText("")
- staffMod.OnCursorEntered = function(self)
- surface.PlaySound("UI/buttonrollover.wav")
- self.hover = true
- end
- staffMod.OnCursorExited = function(self)
- self.hover = false
- end
- function staffMod:Paint(w, h)
- if !self.hover then
- draw.RoundedBox(8, 0, 0, w, h, Color(0,0,0,220))
- else
- draw.RoundedBox(8, 0, 0, w, h, Color(30,30,30,220))
- end
- if staffMod == 0 then
- draw.SimpleText(lang.Activate.." "..string.lower(lang.StaffModTitle), "WasiedAdminMenuButton", w/2, h/2, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- elseif staffMod == 1 then
- draw.SimpleText(lang.Disable.." "..string.lower(lang.StaffModTitle), "WasiedAdminMenuButton", w/2, h/2, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- elseif staffMod == 2 then
- draw.SimpleText(lang.PleaseWait, "WasiedAdminMenuButton", w/2, h/2, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- end
- staffMod.DoClick = function()
- menuframe:Close()
- LocalPlayer():ConCommand("say "..AdvancedStaffConfig.StaffCommand)
- end
- local closeButton = vgui.Create("DButton", menuframe)
- closeButton:SetPos(10, menuframe:GetTall()-65)
- closeButton:SetSize(menuframe:GetWide()-20,55)
- closeButton:SetText("")
- closeButton.OnCursorEntered = function(self)
- surface.PlaySound("UI/buttonrollover.wav")
- self.hover = true
- end
- closeButton.OnCursorExited = function(self)
- self.hover = false
- end
- function closeButton:Paint(w, h)
- if self.hover then
- draw.RoundedBox(3, 0, 0, w, h, Color(100,140,255))
- else
- draw.RoundedBox(3, 0, 0, w, h, Color(90,130,255))
- end
- draw.SimpleText(lang.CloseButton, "WasiedAdminMenuClose", w/2, h/2, Color(255,255,255), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
- end
- closeButton.DoClick = function()
- menuframe:Close()
- end
- end)
- -- Server
- -- Networking
- util.AddNetworkString("AdvAdminSyst:Refund:ReturnStuff")
- util.AddNetworkString("AdvAdminSyst:Refund:OpenMenu")
- util.AddNetworkString("AdvAdminSyst:AdminMenu:Open")
- util.AddNetworkString("AdvAdminSyst:ShowInfo:Show")
- local function VerifyStaff(ply)
- if !IsValid(ply) then return false end
- if !AdvancedStaffConfig.AllowedRanks[ply:GetUserGroup()] then
- DarkRP.notify(ply, 0, 7, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].UnableTo)
- return false
- else
- return true
- end
- end
- -- Refund Menu
- hook.Add("PlayerDeath", "RefundCheckDeath", function(ply, inflicator, attacker)
- local weapons = {}
- local pos = ply:GetPos()
- ply.refund = {
- money = ply:getDarkRPVar("money"),
- weapons = weapons
- }
- for _,v in pairs(ply:GetWeapons()) do
- if !IsValid(v) then return false end
- table.insert(weapons, v:GetClass())
- if AdvancedStaffConfig.dropWeapons then
- for _,bWeap in pairs(AdvancedStaffConfig.blacklistedWeapons) do
- if bWeap != v then
- ply:DropWeapon(v)
- end
- end
- end
- end
- if AdvancedStaffConfig.dropMoney then DarkRP.createMoneyBag(pos, ply:getDarkRPVar("money")) end
- if AdvancedStaffConfig.lostWeapons then ply:StripWeapons() end
- if AdvancedStaffConfig.lostMoney then ply:setDarkRPVar("money", 0) end
- end)
- net.Receive("AdvAdminSyst:Refund:ReturnStuff",function(len, ply)
- local playerrefund = net.ReadEntity()
- if VerifyStaff(ply) then
- if IsValid(playerrefund) and playerrefund:Alive() then
- if not playerrefund.refund then return end
- for k, v in pairs(playerrefund.refund.weapons) do
- playerrefund:Give(v)
- end
- playerrefund:setDarkRPVar("money", playerrefund.refunshowd.money)
- playerrefund.refund = nil
- DarkRP.notify(playerrefund, 0, 7, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].SuccessfullNotificationText.." ".. ply:GetName())
- else
- DarkRP.notify(ply, 0, 7, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].DisconnectedTarget)
- end
- end
- end)
- local showInfos = 0
- local staffJob = AdvancedStaffConfig.AllowedTeam
- local returnJob = AdvancedStaffConfig.ReturnTeam
- hook.Add("PlayerSay", "AdvancedAdminSystem:OnStaffCommand", function(staff, text)
- if !IsValid(staff) then return end
- local playertable = {}
- if text == AdvancedStaffConfig.ShowMoreCommand then
- if !AdvancedStaffConfig.ShowMoreContext && AdvancedStaffConfig.ShowMoreInfos && VerifyStaff(staff) then
- if showInfos == 0 then
- showInfos = 1
- elseif showInfos == 1 then
- showInfos = 0
- end
- net.Start("AdvAdminSyst:ShowInfo:Show")
- net.WriteInt(showInfos, 4)
- net.Send(staff)
- end
- elseif text == AdvancedStaffConfig.RefundTextCommand then
- if VerifyStaff(staff) then
- for _,v in pairs(player.GetAll()) do
- if not v.refund then continue end
- playertable[v:EntIndex()] = v.refund
- end
- net.Start("AdvAdminSyst:Refund:OpenMenu")
- net.WriteTable(playertable)
- net.Send(staff)
- DarkRP.notify(staff, 0, 5, "Ouverture du menu de remboursement...")
- end
- elseif text == AdvancedStaffConfig.StaffCommand && AdvancedStaffConfig.StaffSystem then
- if VerifyStaff(staff) then
- if staff:GetNWInt("StaffMod") == 0 then
- if AdvancedStaffConfig.EnableChangeTeam then
- if staff:Team() != staffJob then
- staff:changeTeam(staffJob, true, AdvancedStaffConfig.HideNotifOnChangeTeam)
- end
- end
- if AdvancedStaffConfig.EnableGod then
- staff:GodEnable()
- end
- if AdvancedStaffConfig.EnableRevive then
- staff:SetHealth(100)
- end
- if AdvancedStaffConfig.EnableCloak then
- ULib.invisible( staff, true, 0 )
- end
- if AdvancedStaffConfig.EnableNoclip then
- staff:SetMoveType(MOVETYPE_NOCLIP)
- end
- DarkRP.notify(staff, 0, 5, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].EnterStaffMod)
- staff:SetNWInt("StaffMod" , 1)
- elseif staff:GetNWInt("StaffMod") == 1 then
- if AdvancedStaffConfig.EnableChangeTeam then
- if staff:Team() != returnJob then
- staff:changeTeam(returnJob, true, AdvancedStaffConfig.HideNotifOnChangeTeam)
- end
- end
- if AdvancedStaffConfig.EnableRevive then
- staff:SetHealth(100)
- end
- if AdvancedStaffConfig.EnableCloak then
- ULib.invisible( staff, false, 0 )
- end
- if AdvancedStaffConfig.EnableNoclip then
- staff:SetMoveType(MOVETYPE_WALK)
- end
- if AdvancedStaffConfig.EnableGod then
- DarkRP.notify(staff, 0, 5, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].GodSecurity)
- staff:SetNWInt("StaffMod", 2)
- timer.Simple(3, function()
- staff:GodDisable()
- staff:SetNWInt("StaffMod" , 0)
- DarkRP.notify(staff, 0, 5, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].GodSuccessfull)
- end)
- else
- staff:SetNWInt("StaffMod", 0)
- end
- DarkRP.notify(staff, 0, 5, AdvancedStaffConfig.Language[AdvancedStaffConfig.ScriptLanguage].LeaveStaffMod)
- end
- end
- elseif text == AdvancedStaffConfig.AdminMenuCommand && AdvancedStaffConfig.AdminMenu then
- if VerifyStaff(staff) then
- net.Start("AdvAdminSyst:AdminMenu:Open")
- net.Send(staff)
- DarkRP.notify(staff, 0, 5, "Ouverture du menu d'administration...")
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement