Official Soldat Forums
Server Talk => Scripting Releases => Topic started 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:
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;
-
New spree names are done every 5 kills, not every 2.
-
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.
-
actually continuous kills are easier to get in R/S o_O
cool idea nevertheless
-
Fixed a small bug in script.
-
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.
-
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?
-
how i can use this script?
-
i want to know the same thing...
-
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.
-
avarax is right about continuous kills but good job keep up good owrk m8
-
Does this server script work on Linux servers? I ask because my server is on Linux.
-
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.
-
nice script, after a few tries I got it working. Thanks ;)
-
i tried to combine this code with the networkcore.pas .. i really dunno whats wrongs ;x
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)
-
ty .. now everything works fine ;q
-
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.
-
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..
-
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.
-
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 :)
-
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.
-
Yeah I was thinking why there's that :D I deleted it when I noticed it ingame :P
-
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!)
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.
-
Would it be possible to add a bit so if a player gets a Triple Kill, Multi Kill, + it will announce it also?
-
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.
-
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.
-
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.
-
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.
-
Script has been updated for new server version
-
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??
-
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.
-
oh... ofcourse!! thx m8
-
Can someone edit the script for DM server, or does it work in it?
-
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.
-
there a zip file for this?
-
I can make one really quick:
...here.
(Zipped file is the xJapx version)
-
ty since 2.6.2 all posts should be modified
-
Hmm.. is this compatible with 2.6.2? Maybe I made an error.
-
Yes, it is.
-
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 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.
-
ll 0 ll? Where is the download link? -_-
-
ll 0 ll? Where is the download link? -_-
http://forums.soldat.pl/index.php?topic=9825.msg215727#msg215727
-
Nice, I play regulary on a server using this script. It's quite fun :)
-
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