PlayerDeath - Help

Hello,
How would it be possible to get the owner of the prop that is used to kill a player?
I mean, on PlayerDeath hook if the killer (or weapon) is a prop_physics (a prop) get the owner of the prop?
[lua]
function playerDies( victim, weapon, killer )

end

hook.Add( “PlayerDeath”, “playerDeathTest”, playerDies )
[/lua]

Untested, and I’m sure there are infinitely better ways to do this.



local function OnPropSpawned( pl, _, ent )
	ent:SetNWEntity( "Owner", pl );
end
hook.Add( "PlayerSpawnedProp", "OnPropSpawned", OnPropSpawned );

local function PlayerDies( victim, inflictor, killer )
	local ent = inflictor:GetClass() == "prop_physics" && inflictor:GetNWEntity( "Owner" );
	if( IsValid( ent ) && IsValid( inflictor ) && ent:IsPlayer() && ent != victim ) then
		//Do stuff here.
		//Msg( Format( "
%s was killed by %s using %s
", victim:Name(), ent:Name(), inflictor:GetClass() ) );
	end
end
hook.Add( "PlayerDeath", "PlayerDies", PlayerDies );