Uncloak a player when they die?

Hello, I have put together a nice little cloak swep for my server.

The cloak swep works by holding it out and right clicking to toggle cloak on or off.

The swep works fine apart from one issue, if a player has cloak active, dies and then respawns, the cloak is still active even if he does not have the weapon.

The current code, which works fine, to toggle the cloak is the following:


I have tried using the following to uncloak the player when they die:


I am not sure if I am approaching this the right way though.


Why are you using “models/glass” for uncloaking when you can just enter in ("") (the default material of any given entity)

Also, your remove code is basically saying “If the player is not concealed (you have the ! in front of the variable) then uncloak him” which makes no sense because the player is already uncloaked

So change it to

if ( self.conceal ) then


I’m a pootis :c

[editline]29th June 2013[/editline]

Your changes had no effect, the player is still cloaked when they respawn.

Add a PlayerSpawn hook to the swep.


It worked! Thank you very much!