Create disable_damages

This commit is contained in:
Resxt 2022-04-11 13:42:17 +02:00
parent e44219ea35
commit 1ee779097a
2 changed files with 18 additions and 8 deletions

View File

@ -6,16 +6,17 @@ Simple drag and drop scripts
Change the team names to custom names depending on the game mode
## disable_damages.gsc
Disable melee knifing damage.
Also prevents players from dying to their own grenades and rockets.
Note that if you shoot enough rockets (around 20/30) you can still kill yourself.
This also doesn't prevent players from killing themselves when they hold a frag grenade in their hands.
## disable_nuke_killstreak.gsc
Prevent players from obtaining the nuke/M.O.A.B killstreak when they have enough kills.
## disable_self_explosive_damage.gsc
Prevents players from dying to their own grenades and rockets.
Note that if you shoot enough rockets (around 20/30) you can still kill yourself.
This also doesn't prevent players from killing themselves when they hold a frag grenade in their hands.
## display_player_stats.gsc
Display the player's killstreak, total kills and deaths on top of the screen

View File

@ -1,10 +1,10 @@
Init()
{
level.callbackplayerdamagestub = level.callbackplayerdamage;
level.callbackplayerdamage = ::DisableSelfExplosiveDamage;
level.callbackplayerdamage = ::DisableDamages;
}
DisableSelfExplosiveDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset )
DisableDamages( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDeath, sWeapon, vPoint, vDir, sHitLoc, timeOffset )
{
if (isDefined(eAttacker))
{
@ -12,6 +12,7 @@ DisableSelfExplosiveDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDea
{
if (eAttacker.guid == self.guid)
{
// Disable explosive damage on self
switch (sMeansOfDeath)
{
case "MOD_PROJECTILE_SPLASH": iDamage = 0;
@ -22,6 +23,14 @@ DisableSelfExplosiveDamage( eInflictor, eAttacker, iDamage, iDFlags, sMeansOfDea
break;
}
}
else
{
// Disable melee knifing damage
if (sMeansOfDeath == "MOD_MELEE")
{
iDamage = 0;
}
}
}
}