Author Topic: teamSwitch  (Read 5187 times)

0 Members and 1 Guest are viewing this topic.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
teamSwitch
« 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

Code: [Select]
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;
« Last Edit: November 29, 2006, 04:03:48 pm by cooz »
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like

Offline colby

  • Major(1)
  • Posts: 42
  • party time!!!
Re: teamSwitch
« Reply #1 on: January 07, 2007, 12:55:20 am »
this is a nice scrip. a one like this only that makes teams on random would be cool
favorite weapons: Styer, and Ruger

Offline jrgp

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 5037
Re: teamSwitch
« Reply #2 on: January 07, 2007, 01:04:20 am »
I think this should only be useful for INF, because the teams on CTF don't really matter unless the map is extremely unbalanced.
There are other worlds than these

Offline ultraman

  • Flagrunner
  • ****
  • Posts: 797
Re: teamSwitch
« Reply #3 on: January 07, 2007, 04:23:01 am »
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 :)

Offline FliesLikeABrick

  • Administrator
  • Flamebow Warrior
  • *****
  • Posts: 6144
    • Ultimate 13 Soldat
Re: teamSwitch
« Reply #4 on: January 07, 2007, 01:28:11 pm »
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.

Offline cooz

  • Soldier
  • **
  • Posts: 187
  • BANNED
Re: teamSwitch
« Reply #5 on: January 07, 2007, 02:18:26 pm »
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...
Dead man! Dead man walking! We got a dead man walking here! Banned man crawling more like