Author Topic: GoldBalancer  (Read 2441 times)

0 Members and 1 Guest are viewing this topic.

Offline SkyBoy

  • Major(1)
  • Posts: 4
  • To be or not to be... that is the question.
GoldBalancer
« on: October 13, 2007, 05:08:31 am »
Script Name : GoldBalancer
Script Description: On servers frequent absence of administrators there is such problem as balance and гроков And balance of forces! Balance of players: players can type at absence of balance комманду! balance and to stabilize commands. Balance of forces: absence of balance of forces, it is possible to correct by change of a card - players will be mixed. P.S. Thanks the author sbalan its one procedure was necessary for this))
Original Author : SkyBoy
Core Version: v2.6.0 (windows)
Core.pas
Code:
Code: [Select]
var
  i,j,b,temp,idtoswitch,bl: integer;
procedure OFFPlayers(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 skyproverka;
begin
if BravoPlayers+2<=AlphaPlayers then begin OFFPlayers(2,(AlphaPlayers-BravoPlayers)/2); WriteConsole(0,'teams was balanced!',RGB(114,248,80)) end
     else if AlphaPlayers+2<=BravoPlayers then begin OFFPlayers(1,(BravoPlayers-AlphaPlayers)/2); WriteConsole(0,'teams was balanced!',RGB(114,248,80)) end;
end;

procedure skyperetosovka;
begin
for i:=1 to NumPlayers do begin
 bl:=round(GetPlayerStat(i,'X')) + round(GetPlayerStat(i,'Y'))+GetPlayerStat(i,'Ping')+GetPlayerStat(i,'Primary')+GetPlayerStat(i,'Secondary')+GetPlayerStat(i,'Ammo');
       if bl mod 2 = 0 then 
       command('/setteam'+inttostr(1)+' '+inttostr(i));
       if bl mod 2 = 1 then 
       command('/setteam'+inttostr(2)+' '+inttostr(i)) end;
end;
NetworkCore.pas
Code:
Code: [Select]
procedure OnMapChange(NewMap: string);
begin
skyperetosovka; // тусуем
skyproverka // балансируем
end;
procedure OnPlayerSpeak(ID: byte; Text: string);
begin
if Text = '!balance' then skyproverka;
end;

Offline Hydro

  • Major(1)
  • Posts: 31
Re: GoldBalancer
« Reply #1 on: October 13, 2007, 08:59:50 am »
Why isn't it in 1 file? :O

Offline SkyBoy

  • Major(1)
  • Posts: 4
  • To be or not to be... that is the question.
Re: GoldBalancer
« Reply #2 on: October 13, 2007, 11:37:09 pm »
Because so it is more convenient to introduce a script in already existing scripts

Offline Iq Unlimited

  • Flagrunner
  • ****
  • Posts: 864
  • mr. foobar2000
Re: GoldBalancer
« Reply #3 on: October 14, 2007, 01:07:55 pm »
skyperetosovka; // тусуем
skyproverka // балансируем

what exactly do those words mean in english :/.

also
Because so it is more convenient to introduce a script in already existing scripts

theres a reason ScriptCore v2 exists. Doing it this way is outdated and shouldn't be done anymore.

Offline q0p4z

  • Major(1)
  • Posts: 29
Re: GoldBalancer
« Reply #4 on: October 14, 2007, 02:30:51 pm »
well maybe he posted it the old way because of this:
Core Version: v2.6.0 (windows)