0 Members and 1 Guest are viewing this topic.
const CHECK_TIME = 2;var i,j,temp,idtoswitch: integer;function IDtoKills(PlayerID: integer):integer;begin case PlayerID of 1: Result:= Player_Kills_1; 2: Result:= Player_Kills_2; 3: Result:= Player_Kills_3; 4: Result:= Player_Kills_4; 5: Result:= Player_Kills_5; 6: Result:= Player_Kills_6; 7: Result:= Player_Kills_7; 8: Result:= Player_Kills_8; 9: Result:= Player_Kills_9; 10: Result:= Player_Kills_10; 11: Result:= Player_Kills_11; 12: Result:= Player_Kills_12; 13: Result:= Player_Kills_13; 14: Result:= Player_Kills_14; 15: Result:= Player_Kills_15; 16: Result:= Player_Kills_16; 17: Result:= Player_Kills_17; 18: Result:= Player_Kills_18; 19: Result:= Player_Kills_19; 20: Result:= Player_Kills_20; 21: Result:= Player_Kills_21; 22: Result:= Player_Kills_22; 23: Result:= Player_Kills_23; 24: Result:= Player_Kills_24; 25: Result:= Player_Kills_25; 26: Result:= Player_Kills_26; 27: Result:= Player_Kills_27; 28: Result:= Player_Kills_28; 29: Result:= Player_Kills_29; 30: Result:= Player_Kills_30; 31: Result:= Player_Kills_31; 32: Result:= Player_Kills_32; end;end;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 switchPlayers(plrteam: byte; plramount: integer);begin temp:=65535; for i:=1 to plramount do begin for j:=1 to NumPlayers do begin if((IDtoKills(j)<=temp)and(IDtoTeam(j)<>plrteam)) then begin temp:= IDtoKills(j); idtoswitch:=j; end; end; command('/setteam'+inttostr(plrteam)+' '+inttostr(idtoswitch)); end;end;procedure AppOnIdle(Ticks: integer);begin if Ticks mod(3600*CHECK_TIME)=0 then begin if BravoPlayers+2<=AlphaPlayers then begin switchPlayers(2,(AlphaPlayers-BravoPlayers)/2); end else if AlphaPlayers+2<=BravoPlayers then switchPlayers(1,(BravoPlayers-AlphaPlayers)/2); end;end;procedure OnCommand(ID: integer;Text: string);begin if Text = '/sbalance' then begin if BravoPlayers+2<=AlphaPlayers then begin switchPlayers(2,(AlphaPlayers-BravoPlayers)/2); end else if AlphaPlayers+2<=BravoPlayers then switchPlayers(1,(BravoPlayers-AlphaPlayers)/2); end;end;
const CHECK_TIME = 2;var i,j,temp,idtoswitch: integer;procedure switchPlayers(plrteam: byte; plramount: integer);begin temp:=65535; for i:=1 to plramount do begin for j:=1 to NumPlayers do begin if (GetPlayerStat(j,'kills') <= temp) and (GetPlayerStat(j,'team') <> plrteam) then begin temp:=GetPlayerStat(j,'kills'); idtoswitch:=j; end; end; command('/setteam'+inttostr(plrteam)+' '+inttostr(idtoswitch)); end;end;procedure AppOnIdle(Ticks: integer);begin if Ticks mod(3600*CHECK_TIME)=0 then begin if BravoPlayers+2<=AlphaPlayers then begin switchPlayers(2,(AlphaPlayers-BravoPlayers)/2); end else if AlphaPlayers+2<=BravoPlayers then switchPlayers(1,(BravoPlayers-AlphaPlayers)/2); end;end;function OnCommand(ID: Byte; Text: string): boolean;begin if Text = '/sbalance' then begin if BravoPlayers+2<=AlphaPlayers then begin switchPlayers(2,(AlphaPlayers-BravoPlayers)/2); end else if AlphaPlayers+2<=BravoPlayers then switchPlayers(1,(BravoPlayers-AlphaPlayers)/2); end;end;