Wallhack Help

Updated code, Still doesn’t work properly, but it’s better. Look at my last post for details:

So, yesterday I found Fptje’s scripts and I was especially interested in the esp or wallhack, unfortunately it was broken. So, I decided to edit and fix it up and so far I have (as far as I know) been able to optimize it and fix one or two problems. However, It still has the some very annoing issues that i have no idea how to fix:
–1) It cuts out near light sources.
–2) Other people’s weapons get colored properly, but I cant apply the material to them for some reason.
3) It does not update for newly spawned things.
4) Some times doesnt apply the material/find props that are under ground or in other buildings.
5) It also doest like showing the material through water.
If anyone could help me with this and give a short explanation, I would really appreciate it. Anyway, here is my code:


local RayOn = true
local AllMats = {}
local allcolors = {}
local SetColor = _R.Entity.SetColor
local SetMat = _R.Entity.SetMaterial
local GetMat = _R.Entity.GetMaterial
local wire1 = CreateMaterial("wire2", "VertexLitGeneric", {
		["$basetexture"] = "models/wireframe",
		["$nodecal"] = 1,
		["$ignorez"] = 1,
		})
local mat = CreateClientConVar("wire", "wire1", true, false)


local function Xray()
	if RayOn then
		surface.PlaySound("buttons/button19.wav") 
		for k,v in pairs(ents.GetAll()) do
			SetMat(v, AllMats[v])
			local z = allcolors[v]
			if z and type(z) == "table" then
				SetColor(v, z.r, z.g, z.b, z.a)
				hook.Remove("RenderScene","testhook-weapon")
				hook.Remove("RenderScene","testhook-hack")
				hook.Remove("OnEntityCreated","ent")
				render.SuppressEngineLighting(false)
			else 
				SetColor(v, 255,255,255,255)
			end
		end
		allcolors = {}
	else
		Index()
		surface.PlaySound("buttons/button1.wav")
		hook.Add("OnEntityCreated","ent", Index)
		hook.Add("RenderScene","testhook-weapon",Weapon)
		hook.Add("RenderScene","testhook-hack",Hack)
		render.SuppressEngineLighting(true)		
	end
	RayOn = not RayOn
end
concommand.Add("xray", Xray)

function Index()
	for l,v in pairs(ents.GetAll()) do
		Hack(v)
		Weapon()
	end
end


function Hack(v)
	local r,g,b,a = v:GetColor()
	local class = v:GetClass()
	local low = string.lower(class)
	if v:IsPlayer() and (r ~= 255 or g ~= 0 or b ~= 0 or a ~= 255) then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 255, 0, 0, 255)
		SetMat(v, mat:GetString())
	elseif v:IsNPC() and (r ~= 0 or g ~= 0 or b ~= 255 or a ~= 255) then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 0, 0, 255, 255)
		SetMat(v, mat:GetString())		
	elseif (class == "drug_lab" or class == "money_printer") and (r ~= 255 or g ~= 0 or b ~= 100 or a ~= 50) then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 255, 0, 100, 50)
		SetMat(v, mat:GetString())
	elseif not v:IsPlayer() and not v:IsNPC() and class ~= "prop_physics" and class ~= "prop" and class ~= "drug_lab" and class ~= "money_printer" and not v:IsWeapon() and class ~= "viewmodel" and not string.find(class, "ghost") and ( r ~= 255 or g ~= 200 or b ~= 0 or a ~= 100) then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 255, 200, 0, 100)
		SetMat(v, mat:GetString())
	elseif class ~= "viewmodel" and GetMat(v) ~= mat:GetString() and class ~= "func_door" and class ~= "func_door_rotating" and class ~= "prop_door_rotating" and not string.find(class, "ghost") then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 0, 255, 0, 255)
		SetMat(v, mat:GetString())
	elseif class ~= "viewmodel" and GetMat(v) ~= mat:GetString() and class ~= "func_door" and class ~= "func_door_rotating" and class ~= "prop_door_rotating" and not string.find(class, "ghost") then
		allcolors[v] = Color(r,g,b,a)
		SetColor(v, 0, 255, 0, 150)
		SetMat(v, mat:GetString())
	end
end
function Weapon()
	for _, ent in pairs(ents.GetAll()) do						  			
		if ent:IsWeapon() then
			ent:SetColor(140, 0, 255, 255)
			ent:SetMaterial(mat:GetString())	 
		end
	end
end

Note: I am pretty new to lua so ya…

If you’re new to lua, why did you go straight into hacks? start with something smaller.

What, me and many others too started from hacks. They’re fun to make and good for learning :v:

Well, I whanted to do something fun, ANd i really dont find print(“Hellow World”) entertaining. Besides, I’m already good with e2, so i figured it would not be to difficult.

I just don’t think hacks are a good thing to get into, it just makes people seem unpopular, which isn’t good if you plan on releasing all sorts of scripts.

[editline]07:45PM[/editline]

You can’t even spell “Hello” right what chance do you have of spelling all the functions in lua right?

The first thing i made was a really [SP] SHI* [/SP] advert mod, and a guy called bbgamer stole it from me and change all the text then claimed it as his own. If this is the first time you code lua, dont give it to otherpeople, speicially the other newbs at lua …

I’ts not like I’m making an aimbot is it? All i’m really doing is using for loops to apply material and color to things.

this

[editline]08:47PM[/editline]

WooT nearly 500 posts :smiley:

sigh, Can we get past my n00bishness, and help me out?

What are you talking about? I’m one of the more respected coders (Obviously not one of the most, I’m not that awesome) here. One of my two releases is an aimbot.

Setting materials on weapons is a very temperamental thing. So far the only way I’ve managed to do it successfully is using the render stencils, or drawing the model using cam.3D.

Good job; I sure respect your efforts.

But there are so many advanced wallhacks, why would someone steal one made by a newbe coder?

So… is anyone other then flapjack willing to actually give me any useful information?

cause nobody wouldl know the newb coder made it, therefor they could easily clame it as their own … or the person that did it to me was desperate …

anyway, if you see bbgamer on a game server, dis him for me please?

[editline]09:08PM[/editline]

i think you need to render a mesh on the hud draw

I’m a noob, so i have no idea what you just said. A small and brief explanation would be nice. Also, what about the cutting out near light sources, anyone have any ideas about that?

I totaly agree with you.

Hacks is a great place to start. I started with a basic hack, and since then it’s become something amazing, with features such as a full nospread aimbot, SE bypass, MD5 spoofing, wallhack, speedhack, and more. And all started from a simple ESP. :buddy:

So… Any suggestions?

Please, I really need help on this

Do what I did for my first wallhack, just mess around with **[Vector.ToScreen

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Vector.ToScreen)** and **[Draw.RoundedBox

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Draw.RoundedBox)** to draw dots over peoples heads then slowly build on the script.