Skip to content

Commit

Permalink
Award vehicle run-over kills to the driver
Browse files Browse the repository at this point in the history
Instead of the vehicle itself
  • Loading branch information
robotboy655 committed Sep 21, 2013
1 parent 267608d commit 9d84628
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions garrysmod/gamemodes/base/gamemode/npc.lua
Expand Up @@ -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" )
Expand Down
8 changes: 6 additions & 2 deletions garrysmod/gamemodes/base/gamemode/player.lua
Expand Up @@ -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
Expand All @@ -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" )
Expand Down

0 comments on commit 9d84628

Please sign in to comment.