Script Name: multiMode
Script Description: script allowing server to run multiple game modes, one after another
Original Author: cooz
Core Version: 2.5.2
const
//Teams
ALPHA = 1;
BRAVO = 2;
CHARLIE = 3;
DELTA = 4;
SPECTATOR = 5;
//Game Modes
DEATHMATCH = 0;
POINTMATCH = 1;
TEAMMATCH = 2;
CTF = 3;
RAMBO = 4;
INF = 5;
HTF = 6;
SERVER = 255;
MODE_COUNT = 7; //change to number of elements in km[] array (number of modes choosed to run)
Â
var
 mlist: string;
 i,izm,modenr: integer;
 km: array of integer;
function modeName(mint: integer): string;
begin
 case mint of
  0: result:= 'dm';
  1: result:= 'pm';
  2: result:= 'tm';
  3: result:= 'ctf';
  4: result:= 'rambo';
  5: result:= 'inf';
  6: result:= 'htf';
 end;
end;
procedure ActivateServer();
begin
 km:=[CTF, RAMBO, TEAMMATCH, POINTMATCH, DEATHMATCH, INF, HTF]; //edit this line, to choose modes which will run on server and to set order of them
 izm:=0;
 mlist:= readfile('maps_'+modeName(km[0])+'.txt');
 for i:=1 to length(mlist) do begin
  if mlist[i]=chr(13) then izm:=izm+1;
 end;
 writefile('mapslist.txt',mlist);
 command('/loadlist mapslist');
end;
procedure onMapChange();
label jump;
begin
 izm:=izm-1;
 if(izm=0) then begin
  command('/say this is last map,');
  command('/say after it game mode will change');
 end;
Â
 if(izm<0) then begin
  izm:=0;
  jump:
  modenr:=(modenr+1) mod MODE_COUNT;
  mlist:= readfile('maps_'+modeName(km[modenr])+'.txt');
  for i:=1 to length(mlist) do if mlist[i]=chr(13) then izm:=izm+1;
  if length(mlist)<1 then goto jump;
  writefile('mapslist.txt',mlist);
  command('/loadlist mapslist');
  command('/gamemode '+inttostr(km[modenr]));
 end;
end;
procedure AppOnIdle(Ticks: integer);
begin
 if((TimeLeft+1=TimeLimit*60)) then onMapChange();
 if((TimeLeft=10)and(izm=0)) then command('/say Server wil restart in 10 seconds');
 if((TimeLeft=1)and(izm=0)) then command('/say Server is restarting, Please rejoin');
end;
procedure OnCommand(ID: integer;Text: string);
begin
 if copy(Text,1,5)='/map ' then begin
  izm:=izm+1;
 end;
end;
notes:
first of all, it's not final version but i've tested it and it work quite good,
script has to be pasted into
core.pas as it use gamemodes conts from it,
you have to create separate files for each gamemode:
maps_ctf.txt - for capture the flag maps
maps_dm.txt - for deathmatch maps
maps_htf.txt - for hold the flag maps
maps_inf.txt - for infiltration maps
maps_pm.txt - for pointmatch maps
maps_rambo.txt - for rambomatch maps
maps_tm.txt - for teammatch maps
to those files write normal list of maps as you would do with mapslist.txt
eg in maps_ctf.txt can be:
ctf_Kampf
ctf_Voland
ctf_Ash
and maps_inf.txt:
inf_Abel
inf_Fortress
by editing line:Â km:=[CTF, RAMBO...]; you can choose which modes will be played on your server and in what order
script made for Avarax request - yeah, you had to wait 'few days'
any suggestions, bugs...? post them here
02.12.2006:
- one code typo corrected
06.12.2006:
- modified a little count down method, should look better now
- put comments to single lines, yeah