Zedkays Dont mind messy code but here's how you would do barrel stuff protection, snipers only, and Last Cooldown.
On your init, put level.onPlayerDamage = ::onPlayerDamage;
Then, somewhere in your script, put this.
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
weaponClass = self getWeaponClass( sweapon );
if(weaponClass == "weapon_sniper")
{
if((int(distance(self.origin, eattacker.origin)*0.0254) < 20 ) && eattacker.pers["kills"] == 9 ) // barrel stuff protection
{
iDamage = 0; // barrel stuff protection ON and last = true
}
else
{
self.health = 1;
/* ^^ It's a Barrel Stuff but since Person isn't on last,
we are going to make the Victim's health still 1 so they
can get to last. */
if (smeansofdeath != "MOD_SUICIDE" && smeansofdeath != "MOD_TRIGGER_HURT" && ((level.scorelimit - eattacker.pers["kills"]) == 2) )
{
eattacker thread onLastReached();
}
/* ^^ If Suicide or Trigger_Hurt, the Last Reached thread
will not be called. But, if not Suicide or Trigger_Hurt and
Person is 1 kill away from last, lets thread the onlastreach
(Last Cooldown) to let them know they are at last. */
}
}
return iDamage;
}
onLastReached()
{
self endon( "disconnect" );
self endon( "cooldownSet" );
for(;;)
{
self freezeControls( true );
self iprintlnbold("Last ^2Cooldown");
wait 1.5;
self freezeControls( false );
self notify( "cooldownSet" );
}
}