• Request System
    3 replies, posted
I was wondering if someone could send me in the right direction if I wanted to create a Administration request system? Its a very useful tool but if anyone could kindly help then I'd appreciate it greatly. Thanks!
[CODE]local AdminHelp_List = {"There is a spammer!", "People are harrassing me!", "I found a bug!", "d", "dw", "wd", "dwew", "dwe", "weefd", "weed"} if CLIENT then function CreateAdminHelpMenu() AH_Frame = vgui.Create( "DFrame" ) AH_Frame:SetSize( ScrW()/2, ScrH()/2 ) AH_Frame:Center() AH_Frame:SetTitle( "Admin help menu" ) AH_Frame:SetDraggable( false ) AH_Frame:ShowCloseButton( true ) AH_Frame.List = vgui.Create( "DPanelList" ) AH_Frame.List:SetParent( AH_Frame ) AH_Frame.List:SetPos( 5, 30 ) AH_Frame.List:SetSize( AH_Frame:GetWide()-10, AH_Frame:GetTall()-35 ) AH_Frame.List:SetSpacing( 5 ) AH_Frame.List:SetPadding( 10 ) AH_Frame.List:EnableHorizontal( false ) AH_Frame.List:EnableVerticalScrollbar( true ) AH_Frame.Populate = function() AH_Frame.List:Clear() for k, v in pairs( AdminHelp_List ) do AH_Frame.List[k] = vgui.Create( "DPanel" ) AH_Frame.List[k]:SetSize( AH_Frame:GetWide()-43, 30 ) AH_Frame.List[k].Paint = function() surface.SetDrawColor( 50, 50, 50, 255 ) surface.DrawRect( 0, 0, AH_Frame.List[k]:GetWide(), AH_Frame.List[k]:GetTall() ) draw.SimpleText( v, "Default", 5, 15, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) end AH_Frame.List:AddItem( AH_Frame.List[k] ) AH_Frame.List[k].button = vgui.Create( "DButton", AH_Frame.List[k] ) AH_Frame.List[k].button:SetSize( 35, 20 ) AH_Frame.List[k].button:SetPos( AH_Frame.List[k]:GetWide()-40, 5 ) AH_Frame.List[k].button:SetText( "Go" ) AH_Frame.List[k].button.DoClick = function( button ) if !AH_Frame then return end if AH_Frame:IsVisible() then AH_Frame:Close() end RunConsoleCommand("AdminHelp", LocalPlayer():Nick(), k) end end end AH_Frame.Open = function() AH_Frame:SetVisible( true ) AH_Frame:Populate() RestoreCursorPosition() gui.EnableScreenClicker(true) end AH_Frame.Close = function() AH_Frame:SetVisible( false ) RememberCursorPosition() gui.EnableScreenClicker(false) end end function Adminhelp_ChatFunction( ply, text) if string.lower( string.Left(text, 10) ) == "!adminhelp" then if !AH_Frame then CreateAdminHelpMenu() AH_Frame:Open() elseif AH_Frame:IsVisible() then AH_Frame:Close() elseif !AH_Frame:IsVisible() then AH_Frame:Open() end end end hook.Add( "OnPlayerChat", "ChatCommand_Adminhelp", Adminhelp_ChatFunction ) else function InformPeople( pl, cmd, arg ) if !arg[1] then return end if !arg[2] then return end local nick = arg[1] local key = tonumber(arg[2]) if !AdminHelp_List[key] then return end local Real = false for k, v in pairs(player.GetAll()) do if v:Nick() == nick then Real = true end end if Real then for k, v in pairs(player.GetAll()) do v:ChatPrint(nick..": "..AdminHelp_List[key]) end end end concommand.Add( "AdminHelp", InformPeople ) end[/CODE] Edit it to your needs I guess.
[QUOTE=Liam98;42103511][CODE]local AdminHelp_List = {"There is a spammer!", "People are harrassing me!", "I found a bug!", "d", "dw", "wd", "dwew", "dwe", "weefd", "weed"} if CLIENT then function CreateAdminHelpMenu() AH_Frame = vgui.Create( "DFrame" ) AH_Frame:SetSize( ScrW()/2, ScrH()/2 ) AH_Frame:Center() AH_Frame:SetTitle( "Admin help menu" ) AH_Frame:SetDraggable( false ) AH_Frame:ShowCloseButton( true ) AH_Frame.List = vgui.Create( "DPanelList" ) AH_Frame.List:SetParent( AH_Frame ) AH_Frame.List:SetPos( 5, 30 ) AH_Frame.List:SetSize( AH_Frame:GetWide()-10, AH_Frame:GetTall()-35 ) AH_Frame.List:SetSpacing( 5 ) AH_Frame.List:SetPadding( 10 ) AH_Frame.List:EnableHorizontal( false ) AH_Frame.List:EnableVerticalScrollbar( true ) AH_Frame.Populate = function() AH_Frame.List:Clear() for k, v in pairs( AdminHelp_List ) do AH_Frame.List[k] = vgui.Create( "DPanel" ) AH_Frame.List[k]:SetSize( AH_Frame:GetWide()-43, 30 ) AH_Frame.List[k].Paint = function() surface.SetDrawColor( 50, 50, 50, 255 ) surface.DrawRect( 0, 0, AH_Frame.List[k]:GetWide(), AH_Frame.List[k]:GetTall() ) draw.SimpleText( v, "Default", 5, 15, color_white, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) end AH_Frame.List:AddItem( AH_Frame.List[k] ) AH_Frame.List[k].button = vgui.Create( "DButton", AH_Frame.List[k] ) AH_Frame.List[k].button:SetSize( 35, 20 ) AH_Frame.List[k].button:SetPos( AH_Frame.List[k]:GetWide()-40, 5 ) AH_Frame.List[k].button:SetText( "Go" ) AH_Frame.List[k].button.DoClick = function( button ) if !AH_Frame then return end if AH_Frame:IsVisible() then AH_Frame:Close() end RunConsoleCommand("AdminHelp", LocalPlayer():Nick(), k) end end end AH_Frame.Open = function() AH_Frame:SetVisible( true ) AH_Frame:Populate() RestoreCursorPosition() gui.EnableScreenClicker(true) end AH_Frame.Close = function() AH_Frame:SetVisible( false ) RememberCursorPosition() gui.EnableScreenClicker(false) end end function Adminhelp_ChatFunction( ply, text) if string.lower( string.Left(text, 10) ) == "!adminhelp" then if !AH_Frame then CreateAdminHelpMenu() AH_Frame:Open() elseif AH_Frame:IsVisible() then AH_Frame:Close() elseif !AH_Frame:IsVisible() then AH_Frame:Open() end end end hook.Add( "OnPlayerChat", "ChatCommand_Adminhelp", Adminhelp_ChatFunction ) else function InformPeople( pl, cmd, arg ) if !arg[1] then return end if !arg[2] then return end local nick = arg[1] local key = tonumber(arg[2]) if !AdminHelp_List[key] then return end local Real = false for k, v in pairs(player.GetAll()) do if v:Nick() == nick then Real = true end end if Real then for k, v in pairs(player.GetAll()) do v:ChatPrint(nick..": "..AdminHelp_List[key]) end end end concommand.Add( "AdminHelp", InformPeople ) end[/CODE] Edit it to your needs I guess.[/QUOTE] Wow. I'm shocked aha! Amazing! Many many thanks :D P.S. If you didn't already guess I'm over the moon.
No problem.
Sorry, you need to Log In to post a reply to this thread.