function GPlayerDeath( ply, weapon, killer ) ply.DeathPos = ply:GetPos() if( ply ~= killer or ply:GetTable().Slayed ) then if( ply.currentWeapon ~= "keys" and ply.currentWeapon ~= "weapon_physcannon" and ply.currentWeapon ~= "weapon_physgun" and ply.currentWeapon ~= "gmod_tool") then if (ply:Team() == 2 or ply:Team() == 3 ) then DeathTable(ply) local ent = ents.Create( ply.currentWeapon ); ent:SetPos( ply.DeathPos ); ent:Spawn(); ply:GetTable().Arrested = false; ply:GetTable().DeathPos = nil; ply:GetTable().Slayed = false; else local ent = ents.Create( ply.currentWeapon ); ent:SetPos( ply.DeathPos ); ent:Spawn(); ply:GetTable().Arrested = false; ply:GetTable().DeathPos = nil; ply:GetTable().Slayed = false; end end end end hook.Add( "PlayerDeath", "GunDropOnDeath", GPlayerDeath ); function GThink() for _, ply in pairs(player.GetAll()) do if ( ply:Alive() ) then ply.currentWeapon = ply:GetActiveWeapon():GetClass() end end end hook.Add("Think", "GunDropThink", GThink)