lua chams
I didnt want to necro any old threads so I decided I would make a new one Im trying to figure out how to make lua chams where if you can see a player they are one color but if you cant see them they're a different color.
local R = debug.getregistry();
local VectorConversion = function(rgb) local tbl = rgb; for k,v in next, tbl do tbl[k] = v / 255; end return tbl; end
local chamsmat = CreateMaterial("debugwhite", "VertexLitGeneric",
{["$ignorez"] = 1,["$model"] = 1,["$basetexture"] = "models/debug/debugwhite",});
local chamsmat2 = CreateMaterial("debugwhite2", "VertexLitGeneric",
{["$ignorez"] = 0,["$model"] = 1,["$basetexture"] = "models/debug/debugwhite",});
local function Chams ()
if(features["chams"]) then
for k,v in next, player.GetAll() do
if(R.Entity.Health(v) < 1 || v == LocalPlayer() || !R.Entity.IsValid(v) || v:IsDormant()) then continue; end
local pColorVis = VectorConversion(Color(256, 0, 256));
local pColor = VectorConversion(Color(128, 0, 128));
local pColorGun = VectorConversion(Color(40, 40, 40));
cam.Start3D();
render.MaterialOverride(chamsmat);
render.SetColorModulation(pColorVis.r,pColorVis.g,pColorVis.b);
render.SetBlend(1);
R.Entity.DrawModel(v);
if (R.Entity.IsValid(R.Player.GetActiveWeapon(v))) then
render.SetColorModulation(pColorGun.r,pColorGun.g,pColorGun.b);
R.Entity.DrawModel(R.Player.GetActiveWeapon(v));
end
render.SetColorModulation(pColor.r,pColor.g,pColor.b);
render.MaterialOverride(chamsmat2);
render.SetBlend(1);
R.Entity.DrawModel(v);
if (R.Entity.IsValid(R.Player.GetActiveWeapon(v))) then
render.SetColorModulation(pColorGun.r,pColorGun.g,pColorGun.b);
R.Entity.DrawModel(R.Player.GetActiveWeapon(v));
end
render.SetColorModulation(1, 1, 1);
cam.End3D();
end
end
end
local function HUDPaint()
Chams();
end
hook.Add("HUDPaint", "", HUDPaint);