CSMultiplayerRules: When players die, they'll always drop their primary weapon if they have one. Thanks /alpha/
This commit is contained in:
parent
339a003583
commit
125550e4c3
2 changed files with 20 additions and 0 deletions
|
@ -84,6 +84,9 @@ CSMultiplayerRules::PlayerDeath(NSClientPlayer pl)
|
|||
if (targ.g_items & ITEM_C4BOMB) {
|
||||
targ.activeweapon = WEAPON_C4BOMB;
|
||||
Weapon_DropCurrentWeapon(targ);
|
||||
} else {
|
||||
targ.activeweapon = Cstrike_WeaponToDropUponDeath(targ);
|
||||
Weapon_DropCurrentWeapon(targ);
|
||||
}
|
||||
|
||||
/* clear all ammo and inventory... */
|
||||
|
|
|
@ -45,3 +45,20 @@ weapon_t g_weapons[] = {
|
|||
w_smokegrenade,
|
||||
w_c4bomb
|
||||
};
|
||||
|
||||
int
|
||||
Cstrike_WeaponToDropUponDeath(player pl)
|
||||
{
|
||||
int best_weapon = WEAPON_KNIFE; /* this will never drop, so an okay default */
|
||||
|
||||
for (int i = 0; i < g_weapons.length; i++) {
|
||||
if (pl.g_items & g_weapons[i].id) {
|
||||
if (g_weapons[i].slot == 0)
|
||||
return i; /* immediately choose this primary weapon */
|
||||
|
||||
best_weapon = i;
|
||||
}
|
||||
}
|
||||
|
||||
return best_weapon;
|
||||
}
|
Loading…
Reference in a new issue