Kill streak

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Kill streak

Post by Moustache » May 18th, 2010, 3:54 pm

@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?

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Re: Kill streak

Post by Drofder2004 » May 18th, 2010, 4:19 pm

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.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Moustache
CJ Worshipper
CJ Worshipper
Posts: 476
Joined: August 18th, 2008, 9:30 am

Re: Kill streak

Post by Moustache » May 18th, 2010, 5:50 pm

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

Post Reply

Who is online

Users browsing this forum: No registered users and 30 guests