Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. if SERVER then
  2. util.AddNetworkString("openrulepage")
  3. util.AddNetworkString("closerulepage")
  4. end
  5.  
  6. if CLIENT then
  7. net.Receive("openrulepage", function()
  8. local time = net.ReadFloat(32)
  9. ulx.openrulespanel(time)
  10. end)
  11.  
  12. local rulepanel
  13. net.Receive("closerulepage", function()
  14. if IsValid(rulepanel) then
  15. rulepanel:Remove()
  16. end
  17. end)
  18.  
  19. function ulx.openrulespanel(time)
  20. if IsValid(rulepanel) then rulepanel:Remove() return end
  21. rulepanel = vgui.Create("DFrame")
  22. rulepanel:SetSize(ScrW() * 0.95, ScrH() * 0.95)
  23. rulepanel:Center()
  24. rulepanel:SetVisible(true)
  25. rulepanel:SetDraggable(false)
  26. rulepanel:ShowCloseButton(false)
  27. rulepanel:SetKeyboardInputEnabled(false)
  28. rulepanel:SetTitle("Bitte lese dir unsere Regeln erneut durch, um dein Regelverständnis aufzufrischen. Diese Seite verschwindet in "..string.ToMinutesSeconds(time - CurTime()).." min automatisch.")
  29. rulepanel:MakePopup()
  30. rulepanel.Think = function()
  31. rulepanel:SetTitle("Bitte lese dir unsere Regeln erneut durch, um dein Regelverständnis aufzufrischen. Diese Seite verschwindet in "..string.ToMinutesSeconds(time - CurTime()).." min automatisch.")
  32. if time - CurTime() <= 0 then
  33. rulepanel:Close()
  34. end
  35. end
  36. local page = vgui.Create("HTML", rulepanel)
  37. page:SetPos(10, 30)
  38. page:SetSize(rulepanel:GetWide() - 20, rulepanel:GetTall() - 40)
  39. page:OpenURL(ulx.rulesLink)
  40. end
  41. end
  42.  
  43. function ulx.openrules(calling_ply, target_ply, length)
  44. net.Start("openrulepage")
  45. net.WriteFloat(CurTime() + length + 1, 32)
  46. net.Send(target_ply)
  47. ulx.fancyLogAdmin(calling_ply, "#A opened the rules for #T for #i seconds", target_ply, length)
  48. end
  49. local rules = ulx.command("Utility", "ulx openrules", ulx.openrules, "!openrules")
  50. rules:addParam{type=ULib.cmds.PlayerArg}
  51. rules:addParam{type=ULib.cmds.NumArg, min=60, max=600, default=300, hint="length"}
  52. rules:defaultAccess(ULib.ACCESS_ADMIN)
  53. rules:help("Opens a un-closable rules page for target.")
  54.  
  55. function ulx.closerules(calling_ply, target_plys)
  56. local affected_plys = {}
  57. for i=1, #target_plys do
  58. local v = target_plys[i]
  59. net.Start("closerulepage")
  60. net.Send(v)
  61. table.insert(affected_plys, v)
  62. end
  63. ulx.fancyLogAdmin(calling_ply, "#A closed the rules of #T", affected_plys)
  64. end
  65. local closerules = ulx.command("Utility", "ulx closerules", ulx.closerules, "!closerules")
  66. closerules:addParam{type=ULib.cmds.PlayersArg}
  67. closerules:defaultAccess(ULib.ACCESS_ADMIN)
  68. closerules:help("Closes the rules page of target(s) early.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement