Permalink
Browse files

Award vehicle run-over kills to the driver

Instead of the vehicle itself
  • Loading branch information...
1 parent 267608d commit 9d8462881612f10e3a665e649eba0e0031827c23 @robotboy655 robotboy655 committed Sep 21, 2013
Showing with 10 additions and 2 deletions.
  1. +4 −0 garrysmod/gamemodes/base/gamemode/npc.lua
  2. +6 −2 garrysmod/gamemodes/base/gamemode/player.lua
@@ -21,6 +21,10 @@ function GM:OnNPCKilled( ent, attacker, inflictor )
AttackerClass = attacker:GetClass()
+ if ( attacker:IsVehicle() && IsValid( attacker:GetDriver() ) ) then
+ attacker = attacker:GetDriver()
+ end
+
if ( attacker:IsPlayer() ) then
umsg.Start( "PlayerKilledNPC" )
@@ -137,6 +137,10 @@ function GM:PlayerDeath( Victim, Inflictor, Attacker )
Victim.NextSpawnTime = CurTime() + 2
Victim.DeathTime = CurTime()
+ if ( IsValid( Attacker ) && Attacker:IsVehicle() && IsValid( Attacker:GetDriver() ) ) then
+ Attacker = Attacker:GetDriver()
+ end
+
if ( !IsValid( Inflictor ) && IsValid( Attacker ) ) then
Inflictor = Attacker
end
@@ -148,9 +152,9 @@ function GM:PlayerDeath( Victim, Inflictor, Attacker )
Inflictor = Inflictor:GetActiveWeapon()
if ( !IsValid( Inflictor ) ) then Inflictor = Attacker end
-
+
end
-
+
if (Attacker == Victim) then
umsg.Start( "PlayerKilledSelf" )

0 comments on commit 9d84628

Please sign in to comment.