Still learning…someone helped me with creating this:
local function InvisibleThink()
for k, v in pairs(player.GetAll()) do
local ActiveWeapon = v:GetActiveWeapon()
if v.Invisible and IsValid(ActiveWeapon) and ActiveWeapon ~= v.CloakedWeapon then
v.CloakedWeapon = ActiveWeapon
ActiveWeapon:SetNoDraw(true)
if ActiveWeapon:GetClass() == "weapon_physgun" then
for a, b in pairs(ents.FindByClass("physgun_beam")) do
if b:GetParent() == v then
b:SetNoDraw(true)
end
end
end
end
end
end
hook.Add("Think", "InvisiblePlayer", InvisibleThink)
function InvisiblePlayer(ply, invis)
ply.Invisible = invis
ply:SetNoDraw(invis)
for k, v in pairs(ply:GetWeapons()) do
v:SetNoDraw(invis)
end
for k,v in pairs(ents.FindByClass("physgun_beam")) do
if v:GetParent() == target then
v:SetNoDraw(invis)
end
end
if not invis then
ply.CloakedWeapon = nil
end
end
concommand.Add ("hidemenow", InvisiblePlayer)
sta
What is the most effective way to make a function that undoes this. Do I need to make a brand new function and reverse everything. (which is probably beyond me, simply because there are a lot of variables switching back and forth here and I’d have to get them all right…I’d prefer to not have to spend more hours staring blankly at this but I want to at least get started on the right path…