Author Topic: Some basic stuff for your basic death match server  (Read 3340 times)

0 Members and 1 Guest are viewing this topic.

Offline nub

  • Major
  • *
  • Posts: 56
Some basic stuff for your basic death match server
« on: February 25, 2007, 11:30:43 am »
First of all I made a workaround for the bug where the server wouldn't change the map although one of the players reached the score limit. Sometimes the script will notice the score limit a bit earlier =)

I also added a !nextmap command which can be used by every player to see the next map. The server will also notice who made the first kill on the map and will tell that.

Code: [Select]
var kills: array[1..32] of integer;
    currMap: string;

procedure OnJoinGame(IP, Nickname: string;Team: byte);
begin
  { When a player joins, reset his kills}
  kills[NameToID(Nickname)] := 0;
end;

procedure OnPlayerKill(Killer,Victim,Weapon: string);
var i: byte;
begin

  if (Killer <> Victim) then begin

    { Delete kills on Mapchange }
    if (currMap <> CurrentMap) then begin
      for i:= 1 to 32 do kills[i] := 0;
      currMap := CurrentMap;
      Command('/say First kill by '+Killer+'. Nextmap is '+NextMap); {Tell people what the next map will be and who did the first kill}
    end;

    { Keep track of the kills }
    inc(kills[NameToID(Killer)],1);

    { if player reaches limit execute /nextmap }
    if (kills[NameToID(Killer)] >= ScoreLimit) then begin
      for i:= 1 to 32 do kills[i] := 0;
      Command('/nextmap');
    end;
  end;

end;

procedure OnPlayerSpeak(Name,Text: string);
begin
  if (Text = '!nextmap') then Command('/say Nextmap is ' + NextMap);
end;
Можно зарезать, украсть и всё-таки быть счастливым...

Offline Frenchie

  • Camper
  • ***
  • Posts: 358
  • SoldatHQ
Re: Some basic stuff for your basic death match server
« Reply #1 on: February 25, 2007, 03:21:15 pm »
I also added a !nextmap command which can be used by every player to see the next map.

Not many people know this, but you can use /info to get name of nextmap and other information. :)
Soldat Lobby Avec Players -New Release! - Updated AGAIN!


Offline nub

  • Major
  • *
  • Posts: 56
Re: Some basic stuff for your basic death match server
« Reply #2 on: February 25, 2007, 03:56:28 pm »
OMG! BUT IT DOESN'T SHOW THE ONE WHO MADE THE FIRST KILL! So =p
Можно зарезать, украсть и всё-таки быть счастливым...

Offline Dark Dragon DX

  • Major(1)
  • Posts: 11
  • My Logo
    • My Library Of Files
Re: Some basic stuff for your basic death match server
« Reply #3 on: July 14, 2008, 08:24:20 pm »
Probably a little late to reply to this topic, but it's practical. If I use this script, everytime a player dies, it gives me an error.
The error is:
  • [Error] default -> (OnPlayerKill): Out Of Range

Does it do this for everyone?
« Last Edit: July 14, 2008, 08:27:49 pm by Dark Dragon DX »
Dark Dragon DX[/I]
My Library Of Files

Offline Flippeh

  • Major
  • *
  • Posts: 58
  • Fish go moo :>
    • My Homepage
Re: Some basic stuff for your basic death match server
« Reply #4 on: July 15, 2008, 07:47:03 am »
Does the "Dies" refer to dying as in death polygons?

Because in that case, if one was killed by the map, the killer's ID would be 255.. I think.. or 0. And both of those are out of the 1..32 array range. Should include a check for that in the OnPlayerKill

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Some basic stuff for your basic death match server
« Reply #5 on: July 15, 2008, 10:19:07 am »
Actually, when a player dies because of the map, I believe its considered a selfkill. But I can't be 100% certain here.

Offline Dark Dragon DX

  • Major(1)
  • Posts: 11
  • My Logo
    • My Library Of Files
Re: Some basic stuff for your basic death match server
« Reply #6 on: July 15, 2008, 01:09:56 pm »
Does the "Dies" refer to dying as in death polygons?

Because in that case, if one was killed by the map, the killer's ID would be 255.. I think.. or 0. And both of those are out of the 1..32 array range. Should include a check for that in the OnPlayerKill

I have two bots killing each other in my server now, everytime one bot kills the other, I get that error.
Dark Dragon DX[/I]
My Library Of Files

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: Some basic stuff for your basic death match server
« Reply #7 on: July 15, 2008, 06:07:01 pm »
(Script is for 2.5.4/1.3.1 just in case...)

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Some basic stuff for your basic death match server
« Reply #8 on: July 15, 2008, 09:39:02 pm »
Yeah, for those with some server version more recent (such as latest), this won't work on that.