• Undoing the player being invisible
    0 replies, posted
Hi, I made a swep that makes you invisible when you take it out, and takes away your invisibility when you holster it, that works and all, but if you die while invisible, you stay invisible, until you take the swep, and switch to something else again, I even tried putting the SetColor( 255, 255, 255, 255) in GM:PlayerSpawn() and GM:PlayerDeath(), it didn't work, the player was still invisible, and without errors. [editline]21st January 2011[/editline] nvm it was cause I didn't set the material back from an invisible material, silly me [editline]21st January 2011[/editline] nvm it still doesnt work [editline]21st January 2011[/editline] This is part of the swep's shared.lua [lua] function SWEP:Holster() if CLIENT then return end self.Owner:DrawViewModel( true ) self.Owner:DrawWorldModel( true ) self.Owner:SetColor( 255, 255, 255, 255 ) self.Owner:SetMaterial( "" ) return true end function SWEP:Deploy() if CLIENT then return end self.Owner:DrawViewModel( true ) self.Owner:DrawWorldModel( false ) self.Owner:SetColor( 255, 255, 255, 3 ) self.Owner:SetMaterial( "sprites/heatwave" ) self.Owner:SetModel( "models/player/charple01.mdl" ) return true end [/lua] This is part of the gamemode's init.lua [lua] function GM:PlayerDeath( ply ) ply:SetColor( 255, 255, 255, 255 ) ply:SetMaterial( "" ) end [/lua] WHY DOESN'T THIS WORK EDIT: I got this to work by putting [lua] ply:SetColor( 255, 255, 255, 255 ) ply:SetMaterial( "" )[/lua] in GM:Think(), but I sense its very inefficient
Sorry, you need to Log In to post a reply to this thread.