--[[
	GScript.lua
	Tyler | (STEAM_0:0:40143824)
	===DStream===
]]

-- Gscript. A clientside helpful script by Tyler
local Version = "1.0"
local Author = "Tyler"
local MySteamID = LocalPlayer():SteamID()
local MyName = LocalPlayer():Nick()
local TeamColor = team.GetColor(LocalPlayer():Team())
local GREY = Color(100,100,100,255)
local RED = Color(255,0,0,255)
local AllNames = {}

local function PlayerConnect( name )
	surface.PlaySound("ambient/levels/canals/drip4.wav")
	chat.AddText(
	Color(0,0,0,255),"[",
	Color(0,255,0,255),"GScript",
	Color(0,0,0,255),"]: ",
	GREY,"Player: ",
	GREY,""..name.." ",
	GREY,"Has Joined The Game")
end
hook.Add("PlayerConnect","PlayerConnect",PlayerConnect)

chat.AddText(
Color(0,0,0,255),"[",
Color(0,255,0,255),"GScript",
Color(0,0,0,255),"]: ",
Color(100,100,100,255),"Hello, ",
TeamColor,""..MyName.." ",
Color(255,0,0,255),"("..MySteamID..") ",
Color(100,100,100,255),"Thank you for using GScript, Bind a key to '+g_menu' To start using the script")

concommand.Add("g_ShowSteamID",function()
chat.AddText(
TeamColor,""..MyName.."'s ",
GREY,"SteamID Is: ",
RED,""..MySteamID.."")
end)

concommand.Add("g_ShowAllSteamID",function()
end)

-- I didn't make this whole part, I just fixed it a bit. 
local frame
local function info()
	frame = vgui.Create("DFrame")
	frame:SetPos(5, 5)
	frame:SetSize(1300,500)
	frame:SetTitle("GScript DarkRP Info")
	frame:SetVisible(true)
	frame:SetDraggable(true)
	frame:ShowCloseButton(true)
	frame:MakePopup()
	frame:SetSkin("DarkRP")
	frame:SetSizable(true)
	frame:SetBackgroundBlur(false)

	local infolist = vgui.Create("DListView", frame)
	infolist:SetPos(5, 25)
	infolist:SetSize(frame:GetWide() -10, frame:GetTall() -30)
	infolist:AddColumn("Steam Name")
	infolist:AddColumn("Nick Name")
	infolist:AddColumn("Health")
	infolist:AddColumn("Armor")
	infolist:AddColumn("Money")
	infolist:AddColumn("Salary")
	infolist:AddColumn("Job name")
	infolist:AddColumn("Kills")
	infolist:AddColumn("Deaths")
	infolist:AddColumn("Ping")
	infolist:AddColumn("Rank")
	infolist:AddColumn("SteamID")
	local Rank = "Guest"
	local Money,Job,Salary
	for k,v in pairs(player.GetAll()) do
		if v:IsSuperAdmin()  then
			Rank = "Super Admin"
		elseif v:IsAdmin() and !v:IsSuperAdmin() then
			Rank = "Admin"
				elseif !v:IsAdmin() and !v:IsSuperAdmin() then
				Rank = "Guest"
		end
		Money = v.DarkRPVars.money or 0
		Job = v.DarkRPVars.job or "Citizen"
		Salary = v.DarkRPVars.salary or 0
		infolist:AddLine(
		v:SteamName(),
		v:Nick(),
		v:Health(),
		v:Armor(),
		"$"..Money,
		"$"..Salary,
		Job,
		v:Frags(),
		v:Deaths(),
		v:Ping(),
		Rank,
		v:SteamID()
		)
	end
end
concommand.Add("g_DarkRPInfo", info)


concommand.Add("+g_menu", function()
	Menu = vgui.Create( "DFrame")
	Menu:SetSize( 450, 340 )
	Menu:SetTitle("GScript "..Version.."")
	Menu:Center()
	Menu:MakePopup()
		
	local AdvTab = vgui.Create( "DPropertySheet", Menu)
	AdvTab:SetPos( 5, 25 )
	AdvTab:SetSize( 440, 310 )
	
	Menu.Image = "models/gibs/metalgibs/metal_gibs"

	local Page1 = vgui.Create( "DImage" )
	Page1:SetImage( Menu.Image )
	AdvTab:AddSheet( "Info", Page1, "gui/silkicons/information", false, false, "Information" )
	
	local GScriptInfoPage
	http.Get( "http://dl.dropbox.com/u/28497094/GScript/Info.txt","",function(data)
	GScriptInfoPage = vgui.Create("DLabel")
	GScriptInfoPage:SetPos( 10, 5 )
	GScriptInfoPage:SetParent( Page1 )
	GScriptInfoPage:SetText( data )
	GScriptInfoPage:SizeToContents()
	GScriptInfoPage:SetTextColor(Color(255,255,255,255))
	end )

	local Page2 = vgui.Create( "DImage" )
	Page2:SetImage( Menu.Image )
	AdvTab:AddSheet( "My Info", Page2, "gui/silkicons/bomb", false, false, "Info About LocalPlayer() [You]" )
	
	local Info1 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info1:SetPos( 10, 10 )
	Info1:SetText( "Infobot Toggle" )
	Info1:SetConVar("GScript_Info_toggle")
	Info1:SetValue(GetConVarNumber("GScript_Info_toggle"))
	Info1:SizeToContents()
	
	local Info2 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info2:SetPos( 10, 30 )
	Info2:SetText( "Autoshoot" )
	Info2:SetConVar("GScript_Info_AutoShoot")
	Info2:SetValue(GetConVarNumber("GScript_Info_AutoShoot"))
	Info2:SizeToContents()
	
	local Info3 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info3:SetPos( 10, 50 )
	Info3:SetText( "Friendly Fire" )
	Info3:SetConVar("GScript_Info_Friendlyfire")
	Info3:SetValue(GetConVarNumber("GScript_Info_Friendlyfire"))
	Info3:SizeToContents()
	
	local Info4 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info4:SetPos( 10, 70 )
	Info4:SetText( "Ignore Steam Friends" )
	Info4:SetConVar("GScript_Info_IgnoreSteam")
	Info4:SetValue(GetConVarNumber("GScript_Info_IgnoreSteam"))
	Info4:SizeToContents()
	
	local Info5 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info5:SetPos( 10, 90 )
	Info5:SetText( "No Spread" )
	Info5:SetConVar("GScript_Info_NoSpread")
	Info5:SetValue(GetConVarNumber("GScript_Info_NoSpread"))
	Info5:SizeToContents()
	
	local Info6 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info6:SetPos( 10, 110 )
	Info6:SetText( "No Recoil" )
	Info6:SetConVar("GScript_Info_NoRecoil")
	Info6:SetValue(GetConVarNumber("GScript_Info_NoRecoil"))
	Info6:SizeToContents()

	local Info7 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info7:SetPos( 10, 130 )
	Info7:SetText( "Silent Info" )
	Info7:SetConVar("GScript_Info_silent")
	Info7:SetValue(GetConVarNumber("GScript_Info_silent"))
	Info7:SizeToContents()
	
	local Info8 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info8:SetPos( 10, 150 )
	Info8:SetText( "Spinbot" )
	Info8:SetConVar("GScript_Info_spinbot")
	Info8:SetValue(GetConVarNumber("GScript_Info_spinbot"))
	Info8:SizeToContents()
	
	local Info9 = vgui.Create( "DCheckBoxLabel", Page2 )
	Info9:SetPos( 10, 170 )
	Info9:SetText( "Anti-Info" )
	Info9:SetConVar("GScript_Info_anti")
	Info9:SetValue(GetConVarNumber("GScript_Info_anti"))
	Info9:SizeToContents()
	
	local TextInfo1 = vgui.Create("DLabel")
	TextInfo1:SetText( "Infospot" )
	TextInfo1:SetParent( Page2 )
	TextInfo1:SetWide(100)
	TextInfo1:SetPos(265,340)
	TextInfo1:SetTextColor(Color(255,69,0,255))
	
	
	local FixView = vgui.Create("DButton")
	FixView:SetPos( 132, 350 )
	FixView:SetParent( Page2 )
	FixView:SetSize( 95, 25 )
	FixView:SetText( "Reset Info Position" )
	FixView.DoClick = function()
	RunConsoleCommand( "FixView" )
	end
	
	local Page3 = vgui.Create( "DImage" )
	Page3:SetImage( Menu.Image )
	AdvTab:AddSheet( "Acts", Page3, "gui/silkicons/group", false, false, "Actions" )

	local Act1 = vgui.Create("DButton")
	Act1:SetPos( 10, 10 )
	Act1:SetParent( Page3 )
	Act1:SetSize( 410, 25 )
	Act1:SetText( "Bow" )
	Act1.DoClick = function()
	RunConsoleCommand("act","bow")
	end
	
	local Act2 = vgui.Create("DButton")
	Act2:SetPos( 10, 40 )
	Act2:SetParent( Page3 )
	Act2:SetSize( 410, 25 )
	Act2:SetText( "Wave" )
	Act2.DoClick = function()
	RunConsoleCommand("act","wave")
	end
	
	local Act3 = vgui.Create("DButton")
	Act3:SetPos( 10, 70 )
	Act3:SetParent( Page3 )
	Act3:SetSize( 410, 25 )
	Act3:SetText( "Becon" )
	Act3.DoClick = function()
	RunConsoleCommand("act","becon")
	end
	
	local Act4 = vgui.Create("DButton")
	Act4:SetPos( 10, 100 )
	Act4:SetParent( Page3 )
	Act4:SetSize( 410, 25 )
	Act4:SetText( "Agree" )
	Act4.DoClick = function()
	RunConsoleCommand("act","agree")
	end
	
	local Act5 = vgui.Create("DButton")
	Act5:SetPos( 10, 130 )
	Act5:SetParent( Page3 )
	Act5:SetSize( 410, 25 )
	Act5:SetText( "Disagree" )
	Act5.DoClick = function()
	RunConsoleCommand("act","disagree")
	end
	
	local Act6 = vgui.Create("DButton")
	Act6:SetPos( 10, 160 )
	Act6:SetParent( Page3 )
	Act6:SetSize( 410, 25 )
	Act6:SetText( "Salute" )
	Act6.DoClick = function()
	RunConsoleCommand("act","salute")
	end
	
	local Act7 = vgui.Create("DButton")
	Act7:SetPos( 10, 190 )
	Act7:SetParent( Page3 )
	Act7:SetSize( 410, 25 )
	Act7:SetText( "Forward" )
	Act7.DoClick = function()
	RunConsoleCommand("act","forward")
	end
	
	local Act8 = vgui.Create("DButton")
	Act8:SetPos( 10, 220 )
	Act8:SetParent( Page3 )
	Act8:SetSize( 410, 25 )
	Act8:SetText( "Group" )
	Act8.DoClick = function()
	RunConsoleCommand("act","group")
	end
	
	local Act9 = vgui.Create("DButton")
	Act9:SetPos( 10, 250 )
	Act9:SetParent( Page3 )
	Act9:SetSize( 410, 25 )
	Act9:SetText( "Halt" )
	Act9.DoClick = function()
	RunConsoleCommand("act","halt")
	end
	
	local Page4 = vgui.Create( "DImage" )
	Page4:SetImage( Menu.Image )
	AdvTab:AddSheet( "Miscellaneous", Page4, "gui/silkicons/world", false, false, "Misc Settings" )
	
	local Misc1 = vgui.Create( "DButton", Page4 )
	Misc1:SetPos( 10,10 )
	Misc1:SetSize( 150, 25 )
	Misc1:SetText( "Mute All" )
	Misc1.DoClick = function()
	muteall = !muteall
	for k, v in pairs( player.GetAll() ) do
	if v ~= LocalPlayer() then
	if v:GetFriendStatus() ~= "friend" then
	if muteall then
	v:SetMuted( true )
	else
	end
	end
	end
	end
	end
	
	local Misc1 = vgui.Create( "DButton", Page4 )
	Misc1:SetPos( 10, 40 )
	Misc1:SetSize( 150, 25 )
	Misc1:SetText( "Unmute All" )
	Misc1.DoClick = function()
	unmuteall = !unmuteall
	for k, v in pairs( player.GetAll() ) do
	if v ~= LocalPlayer() then
	if v:GetFriendStatus() ~= "friend" then
	if unmuteall then
	v:SetMuted( false )
	end
	end
	end
	end
	end
	
	
	local Page5 = vgui.Create( "DImage" )
	Page5:SetImage( Menu.Image )
	AdvTab:AddSheet( "DarkRP", Page5, "gui/silkicons/wrench", false, false, "DarkRP" )
	
	local DarkRP1 = vgui.Create("DButton")
	DarkRP1:SetPos( 10, 10 )
	DarkRP1:SetParent( Page5 )
	DarkRP1:SetSize( 410, 260 )
	DarkRP1:SetText( "DarkRP Player Information" )
	DarkRP1.DoClick = function()
	RunConsoleCommand("g_darkrpinfo")
	end
	
	
end )	
concommand.Add( "-g_menu", function()
Menu:Remove()						
end )