-
Notifications
You must be signed in to change notification settings - Fork 0
/
Callback
35 lines (31 loc) · 1.33 KB
/
Callback
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
void function OnPlayerKilled( entity victim, entity attacker, var damageInfo )
{
print(victim)
print(attacker)
if ( !victim.IsPlayer() || !attacker.IsPlayer() || GetGameState() != eGameState.Playing )
{
return
}
if ( attacker == victim ) // suicide
{
string message = victim.GetPlayerName() + " committed suicide."
foreach ( entity player in GetPlayerArray() )
SendHudMessage( player, message, -1, 0.4, 255, 0, 0, 0, 0, 3, 0.15 )
}
else
{
AddTeamScore( attacker.GetTeam(), 1 )
attacker.AddToPlayerGameStat( PGS_ASSAULT_SCORE, 1 )
foreach ( entity weapon in attacker.GetMainWeapons() )
attacker.TakeWeaponNow( weapon.GetWeaponClassName() )
foreach ( entity weapon in attacker.GetOffhandWeapons() )
attacker.TakeWeaponNow( weapon.GetWeaponClassName() )
attacker.GiveOffhandWeapon( victim.GetOffhandWeapon( OFFHAND_MELEE ).GetWeaponClassName(), OFFHAND_MELEE )
attacker.GiveOffhandWeapon( victim.GetOffhandWeapon( OFFHAND_LEFT ).GetWeaponClassName(), OFFHAND_LEFT )
attacker.GiveOffhandWeapon( victim.GetOffhandWeapon( OFFHAND_RIGHT ).GetWeaponClassName(), OFFHAND_RIGHT )
foreach ( entity weapon in victim.GetMainWeapons() )
{
attacker.GiveWeapon( weapon.GetWeaponClassName(), weapon.GetMods() )
}
}
}