--[[
	NAC - noPE's AntiCheat
	Version 0.4
	Purpose:	Keep script kiddies away. This
				means BaconBot, Cheat Engine,
				and public LUA hacks won't run.
				
	TODO:	- Add cvar checks
			- Check if certain concommands exist
--]]

if SERVER then
	local RCC = RunConsoleCommand

	-- Initial stuff
	hook.Add("PlayerInitialSpawn", "InitialCheck", function( ply )
		
		-- Check if certain modules anf files exist on player's game
		timer.Simple( 5, function()
			
			-- Let's see what modules our clients have, just for the sake of it
			ply:SendLua( [[
				local RCC = RunConsoleCommand
				local modules = file.Find("../lua/includes/modules/*.dll")
				
				for _, f in pairs( modules ) do
					RCC("_nac_modulelist", f)
				end
			]] )
		end )
	end )
	
	-- AUTOMATIC MODULE SURVEY YEEEEAH
	concommand.Add("_nac_modulelist", function( ply, c, a )
		for k, v in pairs( player.GetAll() ) do
			if v:SteamID() == "STEAM_0:1:1917468" || v:SteamID() == "STEAM_0:1:24332877" then
				local text = "Player " .. ply:Nick() .. " has a module named: " .. a[1] .. ""
				
				v:SendLua( string.format( "MsgN( %q )", text ) )
			end
		end
	end )
end