Page 2 of 2

Re: Kill streak

Posted: May 18th, 2010, 3:54 pm
by Moustache
@liam
I don't know.

Code: Select all

onPlayerSpawned()
{
   for(;;)
   {
      self waittill("spawned_player");
      self thread monitorKills();
   }
}

onPlayerConnect()
{
   for(;;)
   {
      level waittill("connected", player);
      player thread onPlayerSpawned();
   }
}

monitorKills()
{
   self endon("disconnect");
   self endon("killed_player");
   self endon("joined_spectators");
   
   streak = 0;
   before = self.kills;

	IPrintLnBold( "^1TEST" );   

   for(;;)
   {
      current = self.kills;
      while(current == self.kills)
         wait 0.05;
      
      streak = self.kills - before;
      
      if((streak % 5) == 0)
         iprintln( &"RANK_KILL_STREAK_N", self, streak);
	IPrintLnBold( "^6Kill Streak" );
   }
}
I have this script now.
It doesn't say how many kills you have. I went to 13 kills in a row but no killstreak message.
This message:
^6Kill Streak

Sometimes pops up. It looks like the player that has connected the first cant trigger the ^6Kill Streak message. So that is a bit strange.

Do I have to run this script as an player or lever thread?

Re: Kill streak

Posted: May 18th, 2010, 4:19 pm
by Drofder2004
The code I gave you works perfectly fine.

Open the custom_public.gsc and add all of my code to below the main function. Then, add

Code: Select all

thread onPlayerConnect();
just under "Main() {"

You will get a message every 5 kills.

Re: Kill streak

Posted: May 18th, 2010, 5:50 pm
by Moustache
Ow now I see.
In console I got this message:
Unknown client game command: RANK_KILL_STREAK_N[]Moustache[]5
[] = a little square

But I will change that line in the script to something else.

Thank you verry much. Again :D