• Why is this making everything black?
    3 replies, posted
[CODE] hook.Add("RenderScreenspaceEffects", "DrawMonsters", function() ChamsMat = CreateMaterial("Material", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 }) for k,v in pairs(player.GetAll()) do if v != LocalPlayer() and (1000 == 0 or v:GetPos():Distance(LocalPlayer():GetPos()) < 1000) and table.HasValue(Monsters, v) then cam.Start3D(EyePos(), EyeAngles()) if (v:IsPlayer() and v:Alive() and v:Team() != TEAM_SPECTATOR) then if v:IsPlayer() then color = team.GetColor(v:Team()) end render.SuppressEngineLighting(true) render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1) render.MaterialOverride(ChamsMat) v:DrawModel() render.SetColorModulation((color.r + 150)/250, (color.g + 150)/250, (color.b + 150)/255, 1) end cam.End3D() end end end)[/CODE] I ripped this from aHack and plan to use it in my server so players can see certain players through walls but as soon as the hook runs all entities turn black even if I remove the hook/join another server. Any way I can make it not do that? (The table is established earlier in the code)
[del]Let me guess, are you running under sandbox? [editline]27th November 2015[/editline] or at the very least a sandbox derived gamemode?[/del] [editline]27th November 2015[/editline] whoops, ignore that. I thought you were using stencils.
[QUOTE=TheTechPony;49202114][CODE] hook.Add("RenderScreenspaceEffects", "DrawMonsters", function() ChamsMat = CreateMaterial("Material", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 }) for k,v in pairs(player.GetAll()) do if v != LocalPlayer() and (1000 == 0 or v:GetPos():Distance(LocalPlayer():GetPos()) < 1000) and table.HasValue(Monsters, v) then cam.Start3D(EyePos(), EyeAngles()) if (v:IsPlayer() and v:Alive() and v:Team() != TEAM_SPECTATOR) then if v:IsPlayer() then color = team.GetColor(v:Team()) end render.SuppressEngineLighting(true) render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1) render.MaterialOverride(ChamsMat) v:DrawModel() render.SetColorModulation((color.r + 150)/250, (color.g + 150)/250, (color.b + 150)/255, 1) end cam.End3D() end end end)[/CODE] I ripped this from aHack and plan to use it in my server so players can see certain players through walls but as soon as the hook runs all entities turn black even if I remove the hook/join another server. Any way I can make it not do that? (The table is established earlier in the code)[/QUOTE] [CODE] hook.Add("RenderScreenspaceEffects", "DrawMonsters", function() ChamsMat = CreateMaterial("Material", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 }) for k,v in pairs(player.GetAll()) do if v != LocalPlayer() and (1000 == 0 or v:GetPos():Distance(LocalPlayer():GetPos()) < 1000) and table.HasValue(Monsters, v) then cam.Start3D(EyePos(), EyeAngles()) if (v:IsPlayer() and v:Alive() and v:Team() != TEAM_SPECTATOR) then if v:IsPlayer() then color = team.GetColor(v:Team()) end render.SuppressEngineLighting(true) render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1) render.MaterialOverride(ChamsMat) v:DrawModel() render.SetColorModulation((color.r + 150)/250, (color.g + 150)/250, (color.b + 150)/255, 1) render.SuppressEngineLighting(false) end cam.End3D() end end end)[/CODE]
[QUOTE=Kevlon;49202244][CODE] hook.Add("RenderScreenspaceEffects", "DrawMonsters", function() ChamsMat = CreateMaterial("Material", "VertexLitGeneric", { ["$basetexture"] = "models/debug/debugwhite", ["$model"] = 1, ["$ignorez"] = 1 }) for k,v in pairs(player.GetAll()) do if v != LocalPlayer() and (1000 == 0 or v:GetPos():Distance(LocalPlayer():GetPos()) < 1000) and table.HasValue(Monsters, v) then cam.Start3D(EyePos(), EyeAngles()) if (v:IsPlayer() and v:Alive() and v:Team() != TEAM_SPECTATOR) then if v:IsPlayer() then color = team.GetColor(v:Team()) end render.SuppressEngineLighting(true) render.SetColorModulation(color.r/255, color.g/255, color.b/255, 1) render.MaterialOverride(ChamsMat) v:DrawModel() render.SetColorModulation((color.r + 150)/250, (color.g + 150)/250, (color.b + 150)/255, 1) render.SuppressEngineLighting(false) end cam.End3D() end end end)[/CODE][/QUOTE] Thanks a ton!
Sorry, you need to Log In to post a reply to this thread.