Official Soldat Forums
Server Talk => Scripting Releases => Topic started by: cooz on November 07, 2006, 05:00:29 am
-
Script Name: teamSwitch
Script Description: Script which move all players to opposite team after each round ends, it works for CTF and INF mode
Author: cooz
Core Version: 2.5.2
const
TEAMSWITCH_ON = 1;Â Â Â //choose between 0/1 to turn off/on script
function IDtoTeam(PlayerID: integer):integer;
begin
 case PlayerID of
  1: Result:= Player_Team_1;
  2: Result:= Player_Team_2;
  3: Result:= Player_Team_3;
  4: Result:= Player_Team_4;
  5: Result:= Player_Team_5;
  6: Result:= Player_Team_6;
  7: Result:= Player_Team_7;
  8: Result:= Player_Team_8;
  9: Result:= Player_Team_9;
  10: Result:= Player_Team_10;
  11: Result:= Player_Team_11;
  12: Result:= Player_Team_12;
  13: Result:= Player_Team_13;
  14: Result:= Player_Team_14;
  15: Result:= Player_Team_15;
  16: Result:= Player_Team_16;
  17: Result:= Player_Team_17;
  18: Result:= Player_Team_18;
  19: Result:= Player_Team_19;
  20: Result:= Player_Team_20;
  21: Result:= Player_Team_21;
  22: Result:= Player_Team_22;
  23: Result:= Player_Team_23;
  24: Result:= Player_Team_24;
  25: Result:= Player_Team_25;
  26: Result:= Player_Team_26;
  27: Result:= Player_Team_27;
  28: Result:= Player_Team_28;
  29: Result:= Player_Team_29;
  30: Result:= Player_Team_30;
  31: Result:= Player_Team_31;
  32: Result:= Player_Team_32;
 end;
end;
procedure TeamSwitch();
var i: integer;
begin
 if TEAMSWITCH_ON = 1 then begin
  for i:= 1 to NumPlayers+NumBots do begin
   case IDtoTeam(i) of
    1: command('/setteam2 '+inttostr(i));
    2: command('/setteam1 '+inttostr(i));
   end;
  end;
 end;
end;
procedure AppOnIdle(Ticks: integer);
begin
 if(TimeLeft+1=TimeLimit*60) then TeamSwitch();
end;
procedure OnCommand(ID: integer;Text: string);
begin
 if Text = '/teamswitch' then begin
  TeamSwitch();
 end;
 if ContainsString(Text,'/map ') then TeamSwitch();
end;
-
this is a nice scrip. a one like this only that makes teams on random would be cool
-
I think this should only be useful for INF, because the teams on CTF don't really matter unless the map is extremely unbalanced.
-
I think this should only be useful for INF, because the teams on CTF don't really matter unless the map is extremely unbalanced.
IMO Kampf is unbalanced, as is Laos. But yes, better for INF. Good job cooz :)
-
this is a nice scrip. a one like this only that makes teams on random would be cool
I agree, one that makes random teams after each round would be handy. Many people have asked for this as a server-side feature but scripting is exactly what should be used to do it.
-
this is a nice scrip. a one like this only that makes teams on random would be cool
I agree, one that makes random teams after each round would be handy. Many people have asked for this as a server-side feature but scripting is exactly what should be used to do it.
i cuoud do it, sure,
but in current server version there's no random() function and i'am not gonna use my homemade replacement...