Official Soldat Forums

Server Talk => Scripting Releases => Topic started by: mikembm on January 12, 2007, 10:25:17 am

Title: Killing Sprees
Post by: mikembm on January 12, 2007, 10:25:17 am
Script Name: Killing Sprees
Script Description: Shows who is on killing sprees and who ends their spree
Original Author(s): Bmekim (Remake of EnEsCe's script)
Core Version: 2.6.1
Code: 
Code: [Select]
var
kills: array[1..32] of byte;

procedure OnJoinTeam(ID, Team: byte);
begin
kills[ID] := 0;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
kills[ID] := 0;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
var
spree: array[1..17] of string;
killsNeeded: byte;
begin
killsNeeded := 5; //number of kills needed to count as a killing spree
//spree[x] where x represents the current number of spree kills player has
//more can be added just be sure to change the spree array size
spree[killsNeeded] := ' is on a Killing Spree!';
spree[8] := ' is on a Rampage!';
spree[11] := ' is Dominating!';
spree[14] := ' is Unstoppable!';
spree[17] := ' is Godlike!';
if killer <> victim then begin
if (GetPlayerStat(killer,'team') <> GetPlayerStat(victim,'team')) then begin
kills[killer] := kills[killer] + 1;
if (kills[victim] >= killsNeeded) then begin
Command('/say ' + GetplayerStat(victim,'name') + '''s ' + inttostr(kills[victim]) + ' kills spree ended by ' + GetPlayerStat(killer,'name'));
end;
kills[victim] := 0;
if (kills[killer] <= Arrayhigh(spree) + 1) then begin
if (spree[kills[killer]] <> '') then Command('/say ' + GetPlayerStat(killer,'name') + spree[kills[killer]]);
end;
end
else begin
if (kills[killer] > 0) then SayToPlayer(killer, 'Your spree kills have been reset for team killing');
kills[killer] := 0;
end;
end;
end;
Title: Re: Killing Sprees
Post by: EnEsCe on January 12, 2007, 10:45:57 am
New spree names are done every 5 kills, not every 2.
Title: Re: Killing Sprees
Post by: mikembm on January 12, 2007, 10:48:26 am
Well obviously its changeable per your wants...
When I made it, it was for a R/S server where continuous kills are harder to get.
So it's basically just up to the server owner on what he thinks is right.
Title: Re: Killing Sprees
Post by: Avarax on January 14, 2007, 03:26:14 pm
actually continuous kills are easier to get in R/S o_O

cool idea nevertheless
Title: Re: Killing Sprees
Post by: mikembm on February 11, 2007, 09:13:52 pm
Fixed a small bug in script.
Title: Re: Killing Sprees
Post by: xtishereb on February 13, 2007, 05:59:52 pm
It's the bug where if someone leaves, and then someone joins and has the same number as them, they continue their spree, right?

Anyway, this script is great. I use it on my dedicated server I sometimes use for zombie matches.
Title: Re: Killing Sprees
Post by: Mercury92 on February 25, 2007, 03:18:30 am
Hi! How actaully i add them to my server. Open textfile. Paste, save as name.pas , add to includes script name, Run server and oops server is shutting down. Can anyone tell me how actually these things are done?
Title: Re: Killing Sprees
Post by: rumpel on February 25, 2007, 11:39:54 am
how i can use this script?
Title: Re: Killing Sprees
Post by: Underworld on March 03, 2007, 03:44:09 pm
i want to know the same thing...
Title: Re: Killing Sprees
Post by: xtishereb on March 03, 2007, 04:18:35 pm
If you want to run a script, you need to combine it with the other scripts your server runs. See this topic (http://forums.soldat.pl/index.php?topic=7516.0) for information on how to combine scripts.
Title: Re: Killing Sprees
Post by: Teh Leet on March 03, 2007, 09:52:15 pm
avarax is right about continuous kills but good job keep up good owrk m8
Title: Re: Killing Sprees
Post by: Therier on March 06, 2007, 04:09:08 am
Does this server script work on Linux servers? I ask because my server is on Linux.
Title: Re: Killing Sprees
Post by: Clawbug on March 06, 2007, 08:41:05 am
It seems it should work. If I recall right, there is a bug in split()-function, which does not work like it should in Linux machines, because Linux handles it in different way. It seems there is no split(), thus I assume it works.

Title: Re: Killing Sprees
Post by: Mikeman on March 10, 2007, 03:48:30 pm
nice script, after a few tries I got it working. Thanks  ;)
Title: Re: Killing Sprees
Post by: n0fx on March 12, 2007, 05:07:12 pm
i tried to combine this code with the networkcore.pas .. i really dunno whats wrongs ;x

Quote
var
kills: array[1..32] of integer;

function OnRequestGame(IP: string;State: integer):integer;
begin
Result := State;
end;

procedure OnJoinGame(IP, Nickname: string;Team: byte);
begin
end;

procedure OnJoinTeam(IP, Nickname: string;Team: byte);
begin
kills[NameToId(Nickname)] := 0;
end;

procedure OnLeaveGame(IP, Nickname: string;Team: byte);
begin
kills[NameToId(Nickname)] := 0;
end;

procedure OnFlagGrab(ID: integer;TeamFlag: byte;GrabbedInBase: boolean);
begin
end;

procedure OnFlagReturn(ID: integer;TeamFlag: byte);
begin
end;

procedure OnFlagScore(ID: integer;TeamFlag: byte);
begin
end;

procedure OnPlayerKill(Killer,Victim,Weapon: string);
var
spree: array[1..11] of string;
i: integer;
j: integer;
killsNeeded: integer;

begin
killsNeeded := 3; //number of kills needed to count as a killing spree
//spree
  • where x represents the current number of spree kills player has

//more can be added just be sure to change the spree array size
spree[killsNeeded] := ' is on a Killing Spree!';
spree[5] := ' is on a Rampage!';
spree[7] := ' is Dominating!';
spree[9] := ' is Unstoppable!';
spree[11] := ' is Godlike!';
i := NameToId(killer);
j := NameToId(victim);

if (killer <> victim) then begin //needed for servers with survival mode
   kills := kills + 1;

   if (kills[j] >= killsNeeded) then begin
      Command('/say ' + victim + '''s ' + inttostr(kills[j]) + ' kills spree ended by ' + killer);
   end;
   kills[j] := 0;
   
   if (kills <= Arrayhigh(spree) + 1) then begin
      if (spree[kills] <> '') then Command('/say ' + killer + spree[kills]);
   end;
   
end;
end;

procedure OnPlayerRespawn(ID: integer);
begin
end;

procedure OnPlayerSpeak(Name,Text: string);
begin
end;

(http://img451.imageshack.us/img451/6141/serverdu3.th.png) (http://img451.imageshack.us/my.php?image=serverdu3.png)
Title: Re: Killing Sprees
Post by: n0fx on March 12, 2007, 06:38:15 pm
ty .. now everything works fine ;q
Title: Re: Killing Sprees
Post by: mikembm on March 12, 2007, 06:57:21 pm
Modified script to not increment a player's spree kills amount if it was a team kill.
Also if it is a team kill it will reset their spree kills to 0 and send them a message.
All information is in my first post.
Title: Re: Killing Sprees
Post by: Mikeman on March 14, 2007, 01:52:55 am
There's is some bug, when FF is off and I kill enemy it tells ''Your spree kills have been reset for team killing'' etc.

EDIT: Doesn't happen always, I think it has something to do with autobalance.. when teammate goes to enemy team..
Title: Re: Killing Sprees
Post by: mikembm on March 14, 2007, 02:07:54 am
There's is some bug, when FF is off and I kill enemy it tells ''Your spree kills have been reset for team killing'' etc.

EDIT: Doesn't happen always, I think it has something to do with autobalance.. when teammate goes to enemy team..

You sure about that...? Because if you look at the code you will see that the only way it can show that message is if people are on the same team. Also note that the IDtoTeam function will not work with bots.


EDIT: Posted older script after new one in first post if your server has FF off.
Title: Re: Killing Sprees
Post by: Mikeman on March 14, 2007, 02:23:51 am
I'm sure, because few players in the server was saying about it too.. and I didn't use bots, it was my public 14 slot realistic server. I can post screen next time I get the message of killing enemy  :)
Title: Re: Killing Sprees
Post by: mikembm on March 14, 2007, 07:59:00 pm
Lol. Had a line in there that was for testing purposes only.
Command('/say ' + killer + ' - ' + inttostr(kills));
Find and remove that line if you are using script.

Also updated first post.
Title: Re: Killing Sprees
Post by: Mikeman on March 15, 2007, 02:53:28 am
Yeah I was thinking why there's that :D I deleted it when I noticed it ingame  :P
Title: Re: Killing Sprees
Post by: xJapx on April 03, 2007, 07:28:07 am
I've changed mikembm's script a bit, so now it resets the kill count when map changes, and also after the map it says who made the longest spree. Admin can also use the /spree command to see who has made the highest spree so far in that map. (Using EnEsCe's, improved by Yako's OnMapChange script!)

Code: [Select]
var
kills: array[1..32] of integer;
CurMap,NexMap: string;
HKills: integer;
HName: string;

procedure ResetKills();
var
i: integer;
begin
for i := 1 to 32 do begin
kills[i] := 0;
end;
end;

procedure HighestSpree();
begin
if HKills > 1 then begin
Command('/say Highest spree by: ' + HName + ' with ' + IntToStr(HKills) + ' kills!');
HName := '';
HKills := 0;
end;
end;

procedure OnMapChange();
begin
ResetKills();
HighestSpree();
end;

procedure ActivateServer();
begin
CurMap := CurrentMap;
NexMap := NextMap;
end;

procedure AppOnIdle(Ticks: integer);
begin
 if Ticks mod 2 = 0 then begin //Every 2 seconds
  if ((CurMap <> CurrentMap) and (TimeLeft > 0)) then
  begin
  OnMapChange; //Map has changed!
  CurMap := CurrentMap;
  end;
 end;
end;

procedure OnCommand(ID: integer;Text: string);
var
i: integer;
begin
if GetPiece(Text, ' ', 1) = '/map' then
 begin
 if GetPiece(Text, ' ', 2) = CurrentMap then
  begin
  ResetKills();
  HighestSpree();
  end;
 end;
 if GetPiece(Text, ' ', 1) = '/restart' then
 begin
  ResetKills();
  HighestSpree();
 end;
 if GetPiece(Text, ' ', 1) = '/spree' then
begin
if HKills > 1 then begin
Command('/say Highest spree by: ' + HName + ' with ' + IntToStr(HKills) + ' kills!');
end;
end
end;

procedure OnJoinTeam(IP, Nickname: string;Team: byte);
begin
kills[NameToId(Nickname)] := 0;
end;

procedure OnLeaveGame(IP, Nickname: string;Team: byte);
begin
kills[NameToId(Nickname)] := 0;
end;

procedure OnPlayerKill(Killer,Victim,Weapon: string);
var
spree: array[1..25] of string;
i: integer;
j: integer;
killsNeeded: integer;

begin
killsNeeded := 5; //number of kills needed to count as a killing spree
//spree[x] where x represents the current number of spree kills player has
//more can be added just be sure to change the spree array size
spree[killsNeeded] := ' is on a Killing Spree!';
spree[8] := ' is on a Rampage!';
spree[11] := ' is Dominating!';
spree[14] := ' is Unstoppable!';
spree[17] := ' is Wicked Sick!';
spree[20] := ' is Godlike!';
spree[25] := ' is Beyond Godlike!';
i := NameToId(killer);
j := NameToId(victim);

if killer <> victim then begin //needed for servers with survival mode
kills[i] := kills[i] + 1
if kills[i] > HKills then begin
HKills := kills[i];
HName := killer;
end;

if (kills[j] >= killsNeeded) then begin
Command('/say ' + victim + '''s ' + inttostr(kills[j]) + ' kills spree ended by ' + killer);
end;
kills[j] := 0;

if (kills[i] <= Arrayhigh(spree) + 1) then begin
if (spree[kills[i]] <> '') then Command('/say ' + killer + spree[kills[i]]);
end;
end;
end;

This should work. If I did something wrong please tell me.
Title: Re: Killing Sprees
Post by: Stealth on April 12, 2007, 12:44:40 pm
Would it be possible to add a bit so if a player gets a Triple Kill, Multi Kill, + it will announce it also?
Title: Re: Killing Sprees
Post by: chrisgbk on April 12, 2007, 08:35:53 pm
Would it be possible to add a bit so if a player gets a Triple Kill, Multi Kill, + it will announce it also?

Possible; but that involves all sorts of timing crap. That becomes quite intensive to check every player.
Title: Re: Killing Sprees
Post by: Stealth on April 13, 2007, 08:56:27 am
Oh. I would think it'd be easier, unless Soldat is not reporting those time of variables. I would think there's something on each Soldat like: multikill =0 and the Soldat engine itself is the one that checks the timing and what not. And then once that person reaches "double kill", the multikill variable goes up. Then all this script would have to do is check after each kill if that player's "multikill" is > 1 and announce it on server, so other people can see it as well.
Title: Re: Killing Sprees
Post by: EnEsCe on April 13, 2007, 09:28:46 am
Multi-kills are client side, the server has no idea of it happening; so its not easy. You would have to make a script to count the time between the players kills and if its within xxx seconds, then it counts as a multi-kill.
Title: Re: Killing Sprees
Post by: xJapx on April 13, 2007, 11:51:04 am
Yea true, it's a different script. And it is not really practical to use it, could get spammed too much, and seeing it in 2 places would look a bit weird.
Title: Re: Killing Sprees
Post by: mikembm on June 18, 2007, 08:51:17 pm
Script has been updated for new server version
Title: Re: Killing Sprees
Post by: K_Sparkz on June 25, 2007, 10:52:04 am
I can't make it work on the new server version.... rly dont know whats wrong, the compiling completes perfect, and shows no errors.. but there is simply no killing spree on the server! I Combined them manually, and with your script combiner, and everything seems in order.. but. just doesnt show anything ingame??
Title: Re: Killing Sprees
Post by: kornsick on June 25, 2007, 03:09:06 pm
I can't make it work on the new server version.... rly dont know whats wrong, the compiling completes perfect, and shows no errors.. but there is simply no killing spree on the server! I Combined them manually, and with your script combiner, and everything seems in order.. but. just doesnt show anything ingame??
Your game mode must be with teams, for death match you'll have to edit the script like i did.
Title: Re: Killing Sprees
Post by: K_Sparkz on June 25, 2007, 04:04:47 pm
oh... ofcourse!! thx m8
Title: Re: Killing Sprees
Post by: Mikeman on June 26, 2007, 12:45:58 am
Can someone edit the script for DM server, or does it work in it?
Title: Re: Killing Sprees
Post by: kornsick on June 26, 2007, 04:20:57 am
Code: [Select]
var
kills: array[1..32] of byte;

procedure OnJoinGame(ID, Team: byte);
begin
kills[ID] := 0;
end;

procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
kills[ID] := 0;
end;

procedure OnPlayerKill(Killer, Victim: byte; Weapon: string);
var
spree: array[1..17] of string;
killsNeeded: byte;
begin
killsNeeded := 5; //number of kills needed to count as a killing spree
//spree[x] where x represents the current number of spree kills player has
//more can be added just be sure to change the spree array size
spree[killsNeeded] := ' is on a Killing Spree!';
spree[8] := ' is on a Rampage!';
spree[11] := ' is Dominating!';
spree[14] := ' is Unstoppable!';
spree[17] := ' is Godlike!';
if killer <> victim then begin
if (GetPlayerStat(killer,'name') <> GetPlayerStat(victim,'name')) then begin
kills[killer] := kills[killer] + 1;
if (kills[victim] >= killsNeeded) then begin
Command('/say ' + GetplayerStat(victim,'name') + '''s ' + inttostr(kills[victim]) + ' kills spree ended by ' + GetPlayerStat(killer,'name'));
end;
kills[victim] := 0;
if (kills[killer] <= Arrayhigh(spree) + 1) then begin
if (spree[kills[killer]] <> '') then Command('/say ' + GetPlayerStat(killer,'name') + spree[kills[killer]]);
end;
end
else begin
if (kills[killer] > 0) then SayToPlayer(killer, 'Your spree kills have been reset for team killing');
kills[killer] := 0;
end;
end;
end;

i think this would work.
Title: Re: Killing Sprees
Post by: Spasm on August 14, 2007, 12:50:29 pm
there a zip file for this?
Title: Re: Killing Sprees
Post by: Iq Unlimited on August 14, 2007, 01:39:54 pm
I can make one really quick:
...here.

(Zipped file is the xJapx version)
Title: Re: Killing Sprees
Post by: miketh2005 on August 14, 2007, 02:42:41 pm
ty since 2.6.2 all posts should be modified
Title: Re: Killing Sprees
Post by: Spasm on August 17, 2007, 06:24:12 am
Hmm.. is this compatible with 2.6.2?  Maybe I made an error.
Title: Re: Killing Sprees
Post by: Freedom on August 17, 2007, 06:40:40 am
Yes, it is.
Title: Re: Killing Sprees
Post by: DorkeyDear on August 17, 2007, 11:21:50 am
Code: [Select]
if killer <> victim then begin
  if (GetPlayerStat(killer,'team') <> GetPlayerStat(victim,'team')) then begin
  ...
  end;
end;
Wouldn't "GetPlayerStat(killer,'team') <> GetPlayerStat(victim,'team')" already rule out that Killer <> Victim?
Title: Re: Killing Sprees
Post by: mikembm on August 17, 2007, 01:27:26 pm
Code: [Select]
if killer <> victim then begin
  if (GetPlayerStat(killer,'team') <> GetPlayerStat(victim,'team')) then begin
  ...
  end;
end;

Wouldn't "GetPlayerStat(killer,'team') <> GetPlayerStat(victim,'team')" already rule out that Killer <> Victim?

If you look at it better you will see that there is an else statement after it checks if teams are equal. I just accidentally indented it so you probably missed it. Anyways it does rule it out but it doesn't allow you to know if the killer was the victim - which is needed.
Title: Re: Killing Sprees
Post by: Norbo on October 30, 2007, 12:45:55 pm
ll 0 ll? Where is the download link? -_-
Title: Re: Killing Sprees
Post by: mikembm on October 31, 2007, 02:52:55 am
ll 0 ll? Where is the download link? -_-

http://forums.soldat.pl/index.php?topic=9825.msg215727#msg215727
Title: Re: Killing Sprees
Post by: Xaero on October 31, 2007, 02:56:00 pm
Nice, I play regulary on a server using this script. It's quite fun :)
Title: Re: Killing Sprees
Post by: Leipod on November 13, 2007, 04:03:04 pm
I have a problem with this script. When I join the server, it says: Not enough parameters.
When I kill someone, and when i leave the game too, it says: Out of range
I just downloaded the zipfile of the script from xJapx, and didn't do anything special.
The screenshot shows the errors when i join or leave the game.

Plz help.

EDIT: I installed it on the soldatserver 2.6.3. Does anyone knows if it's compatible with it? :P