Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- util.AddNetworkString("openrulepage")
- util.AddNetworkString("closerulepage")
- end
- if CLIENT then
- net.Receive("openrulepage", function()
- local time = net.ReadFloat(32)
- ulx.openrulespanel(time)
- end)
- local rulepanel
- net.Receive("closerulepage", function()
- if IsValid(rulepanel) then
- rulepanel:Remove()
- end
- end)
- function ulx.openrulespanel(time)
- if IsValid(rulepanel) then rulepanel:Remove() return end
- rulepanel = vgui.Create("DFrame")
- rulepanel:SetSize(ScrW() * 0.95, ScrH() * 0.95)
- rulepanel:Center()
- rulepanel:SetVisible(true)
- rulepanel:SetDraggable(false)
- rulepanel:ShowCloseButton(false)
- rulepanel:SetKeyboardInputEnabled(false)
- rulepanel:SetTitle("Bitte lese dir unsere Regeln erneut durch, um dein Regelverständnis aufzufrischen. Diese Seite verschwindet in "..string.ToMinutesSeconds(time - CurTime()).." min automatisch.")
- rulepanel:MakePopup()
- rulepanel.Think = function()
- rulepanel:SetTitle("Bitte lese dir unsere Regeln erneut durch, um dein Regelverständnis aufzufrischen. Diese Seite verschwindet in "..string.ToMinutesSeconds(time - CurTime()).." min automatisch.")
- if time - CurTime() <= 0 then
- rulepanel:Close()
- end
- end
- local page = vgui.Create("HTML", rulepanel)
- page:SetPos(10, 30)
- page:SetSize(rulepanel:GetWide() - 20, rulepanel:GetTall() - 40)
- page:OpenURL(ulx.rulesLink)
- end
- end
- function ulx.openrules(calling_ply, target_ply, length)
- net.Start("openrulepage")
- net.WriteFloat(CurTime() + length + 1, 32)
- net.Send(target_ply)
- ulx.fancyLogAdmin(calling_ply, "#A opened the rules for #T for #i seconds", target_ply, length)
- end
- local rules = ulx.command("Utility", "ulx openrules", ulx.openrules, "!openrules")
- rules:addParam{type=ULib.cmds.PlayerArg}
- rules:addParam{type=ULib.cmds.NumArg, min=60, max=600, default=300, hint="length"}
- rules:defaultAccess(ULib.ACCESS_ADMIN)
- rules:help("Opens a un-closable rules page for target.")
- function ulx.closerules(calling_ply, target_plys)
- local affected_plys = {}
- for i=1, #target_plys do
- local v = target_plys[i]
- net.Start("closerulepage")
- net.Send(v)
- table.insert(affected_plys, v)
- end
- ulx.fancyLogAdmin(calling_ply, "#A closed the rules of #T", affected_plys)
- end
- local closerules = ulx.command("Utility", "ulx closerules", ulx.closerules, "!closerules")
- closerules:addParam{type=ULib.cmds.PlayersArg}
- closerules:defaultAccess(ULib.ACCESS_ADMIN)
- closerules:help("Closes the rules page of target(s) early.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement