Still learning...someone helped me with creating this: [CODE]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)[/CODE]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...
If you want to make them visible again, just set invis to true.
[QUOTE=Blakestr;48903550][CODE]
for k,v in pairs(ents.FindByClass("physgun_beam")) do
if v:GetParent() == target then
v:SetNoDraw(invis)
end
end[/CODE][/QUOTE]
Where is target being defined?
[QUOTE=roastchicken;48904126]If you want to make them visible again, just set invis to true.[/QUOTE]
Could you help me with the syntax and placement on that? Would this actually work? Seems too simple..
[CODE]
function ReAppear(ply)
ply.SetNoDraw = false
end [/CODE]
I keep getting nil errors on ply being local. I've tried running a loop with no luck.
[QUOTE=Blakestr;48904718]Could you help me with the syntax and placement on that? Would this actually work? Seems too simple..
[CODE]
function ReAppear(ply)
ply.SetNoDraw = false
end [/CODE]
I keep getting nil errors on ply being local. I've tried running a loop with no luck.[/QUOTE]
You already have a function there that takes invis as an argument. If you want it as a command, just create a new function and from within that function call InvisiblePlayer( ply, true )
[QUOTE=roastchicken;48904980]You already have a function there that takes invis as an argument. If you want it as a command, just create a new function and from within that function call InvisiblePlayer( ply, true )[/QUOTE]
[CODE]
function ReAppear()
InvisiblePlayer( ply, true )
end
[/CODE]
I still get ply local nil error with this...
[QUOTE=Blakestr;48907441][CODE]
function ReAppear()
InvisiblePlayer( ply, true )
end
[/CODE]
I still get ply local nil error with this...[/QUOTE]
That's because ply is not a defined variable.
Sorry, you need to Log In to post a reply to this thread.