HelpE2 folder?

Posts 1–13 of 13 · Page 1 of 1
E2 folder?
does anyone have some kind of addon or hack to download a players E2 folder for server owners? i have a addon called E2Tracker from scriptfodder but it lags the player out with "send reliable stream overflow"



here is 2 of the lua files from the addon and i can't seem to figure out why it causes the send Reliable stream overflow error to happen


cl_init.lua
Code:
AddCSLuaFile()

local function e2Menu_e2(Ents)
  local MainMenuFrame = vgui.Create( "DFrame" )
  MainMenuFrame:SetSize( 900, 500 )
  MainMenuFrame:SetTitle("E2 Tracker - E2")
  MainMenuFrame:Center()
  MainMenuFrame:SetVisible( true )
  MainMenuFrame:SetDraggable( true )
  MainMenuFrame:MakePopup()

  local button = vgui.Create( "DButton", MainMenuFrame )
  button:SetSize( 900, 30 )
  button:SetPos( 0, 470 )
  button:SetText( "Refresh" )
  button.DoClick = function( button )
  net.Start("RequestE2Table_e2track")
  net.SendToServer()
  MainMenuFrame:Close()
end

local players = vgui.Create("DListView", MainMenuFrame)
players:SetPos(0, 30)
players:SetSize(MainMenuFrame:GetWide(), MainMenuFrame:GetTall() - 60) 
players:AddColumn("Entity Index")
players:AddColumn("Owner")
players:AddColumn("E2 Name")
players:AddColumn("Ops")
players:AddColumn("CPU Time")
for k,v in pairs( Ents ) do
  players:AddLine(v[1], v[2], v[6], v[4], v[7])
end
players.OnRowSelected = function(self, row)
downloadE2(self:GetLine(row):GetValue(1))
MainMenuFrame:Close()
end
end

local function e2Menu_warning(plyid, called)
  local Form = vgui.Create( "DFrame" )
  Form:MakePopup()

  Form:SetSize( 270, 155 )
  Form:SetTitle( "E2 Tracker - Warning!" )
  Form:SetBackgroundBlur( true )
  Form:Center()
  Form:SetVisible( true )
  Form:SetDraggable( false )
  Form:ShowCloseButton( false )
  Form:MakePopup()
  
  Label1 = vgui.Create( "DLabel", Form )
  Label1:SetText( "Are you sure you wish to download this players E2 folder?" )
  Label1:SetPos( 10, 25 )  
  Label1:SetSize( 250, 30 )              
  Label1:SetWrap(true)

  Label = vgui.Create( "DLabel", Form )
  Label:SetText( "Warning: Doing this is a very intrusive action and should not be taken lightly" )
  Label:SetPos( 10, 50 )  
  Label:SetSize( 250, 30 )              
  Label:SetWrap(true)
  local YesButton = vgui.Create( "DButton", Form )
  YesButton:SetText( "Do it" )               
  YesButton:SetPos( 10, 115 )    
  YesButton:SetSize( 250, 30 )              
  YesButton.DoClick = function()
  net.Start("RequestPlayerE2Folder_e2track")
  net.WriteString(plyid)          
  net.SendToServer()    
  Form:Close()
  called:Close()
end

local NoButton = vgui.Create( "DButton", Form )  
NoButton:SetText( "Cancel" )               
NoButton:SetPos( 10, 85 )    
NoButton:SetSize( 250, 30 )              
NoButton.DoClick = function()              
Form:Close()
end

end

local function e2Menu_players(Ents)
  local MainMenuFrame = vgui.Create( "DFrame" )
  MainMenuFrame:SetSize( 900, 500 )
  MainMenuFrame:SetTitle("E2 Tracker - Players")
  MainMenuFrame:Center()
  MainMenuFrame:SetVisible( true )
  MainMenuFrame:SetDraggable( true )
  MainMenuFrame:MakePopup()

  local button = vgui.Create( "DButton", MainMenuFrame )
  button:SetSize( 900, 30 )
  button:SetPos( 0, 470 )
  button:SetText( "Refresh" )
  button.DoClick = function( button )
  net.Start("RequestPlayerTable_e2track")
  net.SendToServer()
  MainMenuFrame:Close()
end

local players = vgui.Create("DListView", MainMenuFrame)
players:SetPos(0, 30)
players:SetSize(MainMenuFrame:GetWide(), MainMenuFrame:GetTall() - 60) 
players:AddColumn("Entity Index")
players:AddColumn("Name")
for k,v in pairs( Ents ) do
  players:AddLine(v[1], v[2])
end
players.OnRowSelected = function(self, row)
e2Menu_warning(self:GetLine(row):GetValue(1), MainMenuFrame)
end
end

function downloadE2(id)
  net.Start("RequestE2Code_e2track")
  net.WriteString(id)
  net.SendToServer()
end

net.Receive( "ReceiveE2Table_e2track", function( len )
 Ents = net.ReadTable()
 e2Menu_e2(Ents)
end )

net.Receive( "ReceiveE2Code_e2track", function( len )
 Code = net.ReadString()
end )

net.Receive( "ReceivePlayerTable_e2track", function( len )
 Ents = net.ReadTable()
 e2Menu_players(Ents)
end )

net.Receive( "SendE2Request_e2track", function( len )
  CopyDir("expression2", "DATA")
end )

  function CopyDir(dir,src) --copypasta from gmod wiki.
    local files = file.Find(dir.."/*", src)
    for k,v in pairs(files) do
      if v and  v ~= "" then
        SendFileToServer(dir,v)
      end
    end 
    local files,directories = file.Find(dir.."/*", src)
    for _, fdir in pairs(directories) do
      if fdir ~= ".svn" then
        CopyDir(dir.."/"..fdir, src)
      end
    end
  end
  


  function SendFileToServer(dir,filename)
  local filedata = file.Read(dir .."/" .. filename)
  net.Start("SendE2File_e2track")
  net.WriteString(dir)
  net.WriteString(filename)
  net.WriteString(filedata)
  net.SendToServer()
end


concommand.Add( "e2tracker_e2s",function( ply )
  net.Start("RequestE2Table_e2track")
  net.SendToServer()
end )

concommand.Add( "e2tracker_players",function( ply )
  net.Start("RequestPlayerTable_e2track")
  net.SendToServer()
end )
#

sv_init.lua
Code:
AddCSLuaFile( "autorun/client/cl_init.lua" )
util.AddNetworkString("RequestE2Table_e2track") //Send the list of E2s to the player as a table
util.AddNetworkString("ReceiveE2Table_e2track") //Sent by the server to the client with the E2 Table

util.AddNetworkString("RequestE2Code_e2track") // Sent by the client requesting a specific E2
util.AddNetworkString("ReceiveE2Code_e2track") // Sent by the server sending a specific E2

util.AddNetworkString("RequestPlayerTable_e2track") // Sent by the client requesting a list of players
util.AddNetworkString("ReceivePlayerTable_e2track") // Sent by the server sending a list of players

util.AddNetworkString("SendE2Request_e2track") // Sent by the server to the client specified by the previous RequestPlayerE2Folder_e2track request
util.AddNetworkString("SendE2File_e2track") // Sent by the client receiving a file to save to the server

util.AddNetworkString("RequestPlayerE2Folder_e2track")


MsgN("Loaded E2 Tracker server...")

local function logAdd(text)
	file.Append("E2Tracker/log_" .. os.date("%A %d-%m-%y")..".txt","["..os.date("%H:%M:%S %p").."] "..text.."\n")
end



net.Receive("RequestPlayerE2Folder_e2track", function (len, ply)
	if ply:IsSuperAdmin() then

		local cid = net.ReadString()
		if IsValid(Entity(tonumber(cid))) then

			local client = Entity(tonumber(cid))
			logAdd("User " .. ply:GetName() .. " | " .. ply:SteamID() .. " has requested " .. client:Nick() .. " | " .. client:SteamID() .. " s E2 folder")
			client.FileDir = string.Replace(client:SteamID(), ":", "_")
			if not file.Exists( "E2Tracker", "DATA" ) then 
			  file.CreateDir("E2Tracker")
			  file.CreateDir("E2Tracker/"..client.FileDir)
		  end
		  net.Start("SendE2Request_e2track")
		  net.Send(client)
	  end
  end
end)



net.Receive("SendE2File_e2track", function(ln, ply)
	if not ply.FileDir then ply.FileDir = string.Replace(ply:SteamID(), ":", "_") end

	local dir, filename, filedata = net.ReadString(), net.ReadString(), net.ReadString()
	logAdd("User " .. ply:GetName() .. " | " .. ply:SteamID() .. " has sent an E2 file named: ".. filename.." in folder "..dir)

	local dir = "E2Tracker/"..ply.FileDir.."/"..dir
	if not file.Exists(dir, "DATA") then
	  file.CreateDir(dir)
  end
  if not file.Exists(dir.."/"..string.Replace(filename, ".lua", ".txt"), "DATA")then
	  file.Write(dir.."/"..string.Replace(filename, ".lua", ".txt"), filedata)
  else
	  local sep = "\n-------------------------------------\n"
	  file.Append(dir.."/"..string.Replace(filename, ".lua", ".txt"), sep .. filedata)
  end
end)



net.Receive("RequestE2Table_e2track", function (len, ply)
	if ply:IsSuperAdmin() then
		logAdd("User " .. ply:GetName() .. " | " .. ply:SteamID() .. " has requested a list of E2s")

		local e2sTable = ents.FindByClass("gmod_wire_expression2")

		local TableE2 = {}


		for k, v in pairs(e2sTable) do
			local timebench = 0
			if v.context.timebench != nil then timebench = v.context.timebench end //old wiremod fix

			table.insert(TableE2, {
				v:EntIndex(),
				v.player:Nick(),
				v.PrintName,
				math****und(v.context.prfbench,0) or 0,
				v.player:GetName(),
				v.name,
				math****und(timebench*1000000,0) or 0
			})
		end
		net.Start("ReceiveE2Table_e2track")

		net.WriteTable(TableE2)
		net.Send(ply)
	end
end)

net.Receive("RequestE2Code_e2track", function (len, ply)
	if ply:IsSuperAdmin() then
		EntsID = net.ReadString()
		
		logAdd("User " .. ply:GetName() .. " | " .. ply:SteamID() .. " requested " .. Entity(tonumber(EntsID)).player:GetName() .. " | " .. Entity(tonumber(EntsID)).player:SteamID() .. " s E2 called " .. Entity(tonumber(EntsID)).name)

		net.Start("ReceiveE2Code_e2track")
		net.WriteString(Entity(tonumber(EntsID)).buffer)
		net.Send(ply)
		net.Start("WireExpression2_OpenEditor")
		Expression2Download(ply, Entity(EntsID))
	end
end)

net.Receive("RequestPlayerTable_e2track", function (len, ply)
	if ply:IsSuperAdmin() then
		logAdd("User " .. ply:GetName() .. " | " .. ply:SteamID() .. " has requested a list of Players")
		local Players = ents.FindByClass("player")
		local PlayerTable = {}

		for k, v in pairs(Players) do
			table.insert(PlayerTable, {
				v:EntIndex(),
				v:Nick()
			})
		end
		net.Start("ReceivePlayerTable_e2track")
		net.WriteTable(PlayerTable)
		net.Send(ply)
	end
end)


//Removed owner check for Expression2Download from Wiremod lua/wire/stools/expression2.lua
function Expression2Download(ply, targetEnt, wantedfiles, uploadandexit)
		if not IsValid(targetEnt) or targetEnt:GetClass() ~= "gmod_wire_expression2" then
			WireLib.AddNotify(ply, "Invalid Expression chip specified.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
			return
		end
 
		if not IsValid(ply) or not ply:IsPlayer() then -- wtf
			error("Invalid player entity (wtf??). This should never happen. " .. tostring(ply), 0)
		end
 
		local main, includes = targetEnt:GetCode()
		if not includes or not next(includes) then -- There are no includes
 
			local datastr = von.serialize({ { targetEnt.name, main } })
			local numpackets = math.ceil(#datastr / 64000)
			
			local n = 0
			for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteString(datastr:sub(i, i + 63999))
					net.Send(ply)
				end)
				n = n + 1
			end
		elseif not wantedfiles then
			local data = {}
			for k, v in pairs(includes) do
				data[#data + 1] = k
			end
 
			local datastr = von.serialize(data)
			net.Start("wire_expression2_download_wantedfiles_list")
			net.WriteEntity(targetEnt)
			net.WriteBit(uploadandexit or false)
			net.WriteString(datastr)
			net.Send(ply)
		else
			local data = { {}, {} }
			if wantedfiles.main then
				data[1] = { targetEnt.name, main }
				wantedfiles.main = nil
			end
 
			for i = 1, #wantedfiles do
				local path = wantedfiles[i]
				if includes[path] then
					data[2][path] = includes[path]
				else
					WireLib.AddNotify(ply, "Nonexistant file requested ('" .. tostring(path) .. "'). File skipped.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
				end
			end
 
 
 
			local datastr = von.serialize(data)
			local numpackets = math.ceil(#datastr / 64000)
			local n = 0
			for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteString(datastr:sub(i, i + 63999))
					net.Send(ply)
				end)
				n = n + 1
			end
		end
	end
I'll add fileRequest and fileSend in my next hack, Thanks!
do you know how to fix send Reliable stream overflow??
Quote Originally Posted by noobster29 View Post
do you know how to fix send Reliable stream overflow??
Why would you want to fix it, This is a cheating forum, Unless you're making a backdoor.

Your overflow is coming from here:
Code:
for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteString(datastr:sub(i, i + 63999))
					net.Send(ply)
				end)
				n = n + 1
			end
Don't loop something so big you can put into a table and then unpack it from the client!
ik its a cheating forum i just wanted to get this problem fixed and i don't know much lua
Quote Originally Posted by noobster29 View Post
ik its a cheating forum i just wanted to get this problem fixed and i don't know much lua
Use net.WriteTable instead of looping net 64000 times!
how would i do that? since i don't know lua
Quote Originally Posted by noobster29 View Post
how would i do that? since i don't know lua
you learn lua to do it
Code:
for i = 1, #datastr, 64000 do
Instead do 1000
tried 1000 but seems to still cause it send reliable stream overflow
Quote Originally Posted by noobster29 View Post
how would i do that? since i don't know lua
Code:
function Expression2Download(ply, targetEnt, wantedfiles, uploadandexit)
		if not IsValid(targetEnt) or targetEnt:GetClass() ~= "gmod_wire_expression2" then
			WireLib.AddNotify(ply, "Invalid Expression chip specified.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
			return
		end
 
		if not IsValid(ply) or not ply:IsPlayer() then -- wtf
			error("Invalid player entity (wtf??). This should never happen. " .. tostring(ply), 0)
		end
 
		local main, includes = targetEnt:GetCode()
		if not includes or not next(includes) then -- There are no includes
 
			local datastr = von.serialize({ { targetEnt.name, main } })
			local numpackets = math.ceil(#datastr / 64000)
			
			local datatotable = {}
			
			for i = 1, #datastr, 64000 do
				table.insert(datatotable, datastr:sub(i, i + 63999))
			end
			
			local n = 0
			--for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteTable(datatotable)
					net.Send(ply)
				end)
				--n = n + 1
			--end
		elseif not wantedfiles then
			local data = {}
			for k, v in pairs(includes) do
				data[#data + 1] = k
			end
 
			local datastr = von.serialize(data)
			net.Start("wire_expression2_download_wantedfiles_list")
			net.WriteEntity(targetEnt)
			net.WriteBit(uploadandexit or false)
			net.WriteString(datastr)
			net.Send(ply)
		else
			local data = { {}, {} }
			if wantedfiles.main then
				data[1] = { targetEnt.name, main }
				wantedfiles.main = nil
			end
 
			for i = 1, #wantedfiles do
				local path = wantedfiles[i]
				if includes[path] then
					data[2][path] = includes[path]
				else
					WireLib.AddNotify(ply, "Nonexistant file requested ('" .. tostring(path) .. "'). File skipped.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
				end
			end
 
 
 
			local datastr = von.serialize(data)
			local numpackets = math.ceil(#datastr / 64000)
			local n = 0
			--for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteTable(datatotable)
					net.Send(ply)
				end)
				--n = n + 1
			--end
		end
	end
Client you'll have to do your self and read net.ReadTable()!

- - - Updated - - -

For the table you can copy and paste from -> ReceivePlayerTable_e2track
64000

times, cool codez
Quote Originally Posted by D3M0L1T10N View Post
64000

times, cool codez
not helping

Quote Originally Posted by suchisgood View Post
Code:
function Expression2Download(ply, targetEnt, wantedfiles, uploadandexit)
		if not IsValid(targetEnt) or targetEnt:GetClass() ~= "gmod_wire_expression2" then
			WireLib.AddNotify(ply, "Invalid Expression chip specified.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
			return
		end
 
		if not IsValid(ply) or not ply:IsPlayer() then -- wtf
			error("Invalid player entity (wtf??). This should never happen. " .. tostring(ply), 0)
		end
 
		local main, includes = targetEnt:GetCode()
		if not includes or not next(includes) then -- There are no includes
 
			local datastr = von.serialize({ { targetEnt.name, main } })
			local numpackets = math.ceil(#datastr / 64000)
			
			local datatotable = {}
			
			for i = 1, #datastr, 64000 do
				table.insert(datatotable, datastr:sub(i, i + 63999))
			end
			
			local n = 0
			--for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteTable(datatotable)
					net.Send(ply)
				end)
				--n = n + 1
			--end
		elseif not wantedfiles then
			local data = {}
			for k, v in pairs(includes) do
				data[#data + 1] = k
			end
 
			local datastr = von.serialize(data)
			net.Start("wire_expression2_download_wantedfiles_list")
			net.WriteEntity(targetEnt)
			net.WriteBit(uploadandexit or false)
			net.WriteString(datastr)
			net.Send(ply)
		else
			local data = { {}, {} }
			if wantedfiles.main then
				data[1] = { targetEnt.name, main }
				wantedfiles.main = nil
			end
 
			for i = 1, #wantedfiles do
				local path = wantedfiles[i]
				if includes[path] then
					data[2][path] = includes[path]
				else
					WireLib.AddNotify(ply, "Nonexistant file requested ('" .. tostring(path) .. "'). File skipped.", NOTIFY_ERROR, 7, NOTIFYSOUND_DRIP3)
				end
			end
 
 
 
			local datastr = von.serialize(data)
			local numpackets = math.ceil(#datastr / 64000)
			local n = 0
			--for i = 1, #datastr, 64000 do
				timer.Simple( n, function()
					if not IsValid( targetEnt ) then return end
					net.Start("wire_expression2_download")
						net.WriteEntity(targetEnt)
						net.WriteBit(uploadandexit or false)
						net.WriteUInt(numpackets, 16)
						net.WriteTable(datatotable)
					net.Send(ply)
				end)
				--n = n + 1
			--end
		end
	end
Client you'll have to do your self and read net.ReadTable()!

- - - Updated - - -

For the table you can copy and paste from -> ReceivePlayerTable_e2track
still having the same problem it will Create the Folder then after that it i wll Cause the overflow problem on the player
Posts 1–13 of 13 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us