Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const
- GOOD = $00FF99;
- BAD = $FF6666;
- var
- Mix, Anty: byte; //Mix 0 - No Match, Mix 1 - 1v1, Mix 2 - 2v2, Mix 3 - 3v3, Mix 4 - 4v4
- PlayerInMix, voter: array [1..32] of boolean;
- prewteam: array [1..32] of integer;
- MixList: array [1..8] of string;
- Time, Votes, Votes2, Votes3, Votes4, pause, a, b: integer;
- Voterr, VoteO, VoterM, VoteN, matchon, mixteams: boolean;
- InGameSup, SupWait, Move: array [1..32] of boolean;
- PlayerList: array of integer;
- function Explode(Source: string; const Delimiter: string): array of string;
- var Position, DelLength, ResLength: integer;
- begin
- DelLength := Length(Delimiter);
- Source := Source + Delimiter;
- repeat
- Position := Pos(Delimiter, Source);
- SetArrayLength(Result, ResLength + 1);
- Result[ResLength] := Copy(Source, 1, Position - 1);
- ResLength := (ResLength + 1);
- Delete(Source, 1, Position + DelLength - 1);
- until (Position = 0);
- SetArrayLength(Result, ResLength - 1);
- end;
- procedure ResVar(ID:byte);
- begin
- InGameSup[id] := false;
- SupWait[id] := false;
- PlayerInMix[id] := false;
- voter[id] := false;
- Move[id] := false;
- end;
- function GetTeamArray(const Team: byte): Array of byte;
- var i,x: integer;
- begin
- i := 1;
- x := 0;
- while (i < 32) do begin
- if (GetPlayerStat(i, 'Active') = true) then if (GetPlayerStat(i, 'Team') = Team) then begin
- SetArrayLength(Result, x + 1);
- Result[x] := i;
- inc(x,1);
- end;
- inc(i,1);
- end;
- end;
- procedure Balance();
- var i,Difference: integer;
- Players: Array of byte;
- begin
- Difference:=(a-b);
- if (Difference > 1) and (a > 1) then begin
- Players := GetTeamArray(1);
- while (true) do begin
- i := Players[Random(1, GetArrayLength(Players) - 1)];
- if (GetPlayerStat(i, 'Flagger') = false) then break;
- end;
- Move[i]:=true;
- Command('/setteam2 ' + inttostr(i));
- dec(a,1);
- WriteConsole(i, 'You were balanced due to unbalanced teams.', GOOD);
- end;
- if (Difference < -1) and (b > 1) then begin
- Players := GetTeamArray(2);
- while (true) do begin
- i := Players[Random(1, GetArrayLength(Players) - 1)];
- if (GetPlayerStat(i,'Flagger') = false) then break;
- end;
- Move[i]:=true;
- Command('/setteam1 ' + inttostr(i));
- dec(b,1);
- WriteConsole(i, 'You were balanced due to unbalanced teams.', GOOD);
- end;
- Difference:=(a-b);
- if (Difference > 1) or (Difference < -1) then Balance() else WriteConsole(0, 'Teams balanced. If you see no result teams are balanced.', GOOD);
- end;
- function RandomizeArray(arrayy: array of integer): array of integer;
- var len, high ,i, rand : integer;
- begin
- len := GetArrayLength(arrayy);
- setArrayLength(result, len)
- high := (len-1);
- for i := 0 to (len-1) do begin
- rand := Random(0, high);
- result[i] := arrayy[rand];
- arrayy[rand] := arrayy[high];
- dec(high, 1);
- end;
- end;
- procedure MixTeam();
- var c,x:integer; ranlist: array of integer;
- begin
- c := 1;
- x := 0;
- while (c < 32) do begin
- if (GetPlayerStat(c, 'Active') = true) then if (PlayerInMix[c] = true) then begin
- SetArrayLength(PlayerList, x + 1);
- PlayerList[x] := c; //Stworz liste graczy uczestniczacych w meczu
- inc(x,1);
- end;
- inc(c,1);
- end;
- ranlist := RandomizeArray(PlayerList); //randomizuj liste
- x:=0; mixteams:=true;
- for c := 0 to (GetArrayLength(ranlist)-1) do begin
- if(x=0) then begin
- if (GetPlayerStat(ranlist[c],'Team')<>1) then Command('/setteam1 '+inttostr(ranlist[c])); //Moving players
- x:=1;
- end else begin
- if (GetPlayerStat(ranlist[c],'Team')<>2) then Command('/setteam2 ' + inttostr(ranlist[c]));
- x:=0;
- end;
- end;
- mixteams:=false;
- end;
- Procedure CheckVotes();
- var i:byte; c:integer;
- begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (Votes > 0) then begin
- if (Votes>=iif(c>=mix,mix,c)) then begin
- DrawTextEx(0,51,'Vote to OFF - Successfully!',140,GOOD,0.075,180,2);
- Voteo := false;
- Votes := 0;
- Time := 0;
- Mix := 0;
- matchon := false;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) and (PlayerInMix[i]=true) then ResVar(i);
- for i := 1 to 8 do MixList[i] := '';
- end;
- end;
- if (Votes2 > 0) then begin
- if (Votes2>=iif(c>=mix,mix,c)) then begin
- DrawTextEx(0,51,'Vote to restart - Successfully!',140,GOOD,0.075,180,2);
- Voterr := false;
- Votes2 := 0;
- Time := 0;
- Anty:=1;
- Command('/restart');
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- end;
- end;
- if (Votes3 > 0) then begin
- if (Votes3>=iif(c>=mix,mix,c)) then begin
- DrawTextEx(0,51,'Vote to mix teams - Successfully!',140,GOOD,0.075,180,2);
- VoterM := false;
- Votes3 := 0;
- Time := 0;
- MixTeam();
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- end;
- end;
- if (Votes4 > 0) then begin
- if (Votes4>=iif(c>=mix,mix,c)) then begin
- DrawTextEx(0,51,'Vote to nextmap - Successfully!',140,GOOD,0.075,180,2);
- DrawTextEx(0,55,' ('+NextMap+')',140,GOOD,0.075,180,16);
- VoteN := false;
- Votes4 := 0;
- Time := 0;
- Anty:=1;
- Command('/nextmap');
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- end;
- end;
- end;
- procedure SubCheck(ID,y:byte; l:boolean; m:byte);
- var i,b:byte; t,t2:integer;
- begin
- if (m=1) then begin
- for i:= 1 to 32 do if (GetPlayerStat(i,'active')=true) then begin
- if (i<>ID) then if (InGameSup[i]=true) then begin
- t:=GetPlayerStat(i,'Team');
- t2:=GetPlayerStat(id,'Team');
- Move[id]:=true;
- Move[i]:=true;
- Command('/setteam'+inttostr(t2)+' '+inttostr(i));
- Command('/setteam'+inttostr(t)+' '+inttostr(id));
- InGameSup[id]:=false;
- InGameSup[i]:=false;
- WriteConsole(0,'Successfully changed players: '+GetPlayerStat(ID,'name')+' and '+GetPlayerStat(i,'name')+'.',GOOD);
- Exit;
- end;
- if (SupWait[i]=true) then begin
- t:=GetPlayerStat(ID,'Team');
- if (l=true) then begin
- ResVar(ID);
- Command('/setteam5 '+inttostr(ID));
- end;
- ResVar(i); //Zamiana
- Move[i] := true;
- PlayerInMix[i] := true;
- for b := 1 to (Mix*2) do if (MixList[b]='') then begin
- MixList[b] := GetPlayerStat(i,'Name');
- break;
- end;
- Command('/setteam'+inttostr(t)+' '+inttostr(i));
- if (y=1) then if (Mix=1) then WriteConsole(0,iif(Mix=1,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2],'-=2=-'),''),GOOD) else if (Mix=2) then WriteConsole(0,iif(Mix=2,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4],'-=4=-'),''),GOOD) else if (Mix=3) then WriteConsole(0,iif(Mix=3,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(Mix=3,iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6],'-=6=-'),''),''),GOOD) else if (Mix=4) then WriteConsole(0,iif(Mix=4,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(Mix=4,iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6]+',','-=6=-')+' '+iif(MixList[7]<>'',MixList[7]+',','-=7=-')+' '+iif(MixList[8]<>'',MixList[8],'-=8=-'),''),''),GOOD);
- if (l=true) then WriteConsole(0,'Successfully changed players: '+GetPlayerStat(ID,'name')+' and '+GetPlayerStat(i,'name')+'.',GOOD) else WriteConsole(i,'Into the game per: '+GetPlayerStat(ID,'name')+'.',GOOD);
- break;
- end;
- end;
- end;
- if (m=2) then begin
- for i:= 1 to 32 do if (GetPlayerStat(i,'active')=true) then begin
- if (InGameSup[i]=true) then begin
- t:=GetPlayerStat(i,'Team');
- ResVar(i);
- Command('/setteam5 '+inttostr(i));
- ResVar(ID);
- PlayerInMix[ID] := true; //Zamiana
- Move[ID]:=true;
- for b := 1 to (Mix*2) do if (MixList[b]='') then begin
- MixList[b] := GetPlayerStat(ID,'Name');
- break;
- end;
- Command('/setteam'+inttostr(t)+' '+inttostr(id));
- WriteConsole(0,'Successfully changed players: '+GetPlayerStat(ID,'name')+' and '+GetPlayerStat(i,'name')+'.',GOOD);
- break;
- end;
- end;
- end;
- end;
- Procedure MixR(ID:byte);
- var i,t:byte; c,b,a:integer;
- begin
- if (PlayerInMix[ID] = false) then begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i]='') then inc(c,1);
- if (c>0) then begin
- if (matchon=true) then Move[ID] := true;
- PlayerInMix[ID] := true; a:=0; b:=0;
- for t := 1 to 32 do if (GetPlayerStat(t,'Active')=true) and (PlayerInMix[t]=true) then begin
- if (GetPlayerStat(t,'Team')=1) then inc(a,1);
- if (GetPlayerStat(t,'Team')=2) then inc(b,1);
- end;
- if (a<=b) then begin
- if ((b=1) and (a=1)) or ((a=0) and (b=0)) then begin
- if (GetPlayerStat(ID,'Team')=5) then Command('/setteam2 '+inttostr(ID));
- end else if (a<b) then if (GetPlayerStat(ID,'Team')<>1) then Command('/setteam1 '+inttostr(ID));
- end else if (GetPlayerStat(ID,'Team')<>2) then Command('/setteam2 '+inttostr(ID));
- for i := 1 to (mix*2) do if (MixList[i]='') then begin//By Dominik
- MixList[i] := GetPlayerStat(ID,'Name');
- dec(c,1);
- break;
- end;
- if (Mix=1) then WriteConsole(0,iif(Mix=1,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2],'-=2=-'),''),GOOD) else if (Mix=2) then WriteConsole(0,iif(Mix=2,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4],'-=4=-'),''),GOOD) else if (Mix=3) then WriteConsole(0,iif(Mix=3,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(Mix=3,iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6],'-=6=-'),''),''),GOOD) else if (Mix=4) then WriteConsole(0,iif(Mix=4,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(Mix=4,iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6]+',','-=6=-')+' '+iif(MixList[7]<>'',MixList[7]+',','-=7=-')+' '+iif(MixList[8]<>'',MixList[8],'-=8=-'),''),''),GOOD);
- if (c=0) then begin
- for i := 1 to 32 do if (GetPlayerStat(i,'Active')=true) then if (PlayerInMix[i] = false) and (GetPlayerStat(i,'team')<>5) then Command('/setteam5 '+inttostr(i));
- matchon := true;
- Anty := 1;
- Command('/restart');
- DrawTextEx(0,51,'The match started!',140,GOOD,0.075,180,2);
- end;
- end else WriteConsole(ID,'Now takes the game '+inttostr(Mix)+'vs'+inttostr(Mix)+'. There are no places to join!',BAD);
- end else WriteConsole(ID,'You have been already added to the game.',BAD);
- end;
- Procedure MixON(ID, Typ:byte);
- var i:byte; c:integer;
- begin
- if (Mix=0) then begin
- Mix := Typ;
- MixR(ID);
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then if (i<>ID) then WriteConsole(i,'Enter !add to join!',GOOD);
- end else
- begin
- c := 0;
- for i := 1 to (mix*2) do if (MixList[i]='') then inc(c,1);
- if (c=0) then WriteConsole(ID,'Now takes the game '+inttostr(Mix)+'vs'+inttostr(Mix)+'!'+iif(PlayerInMix[id]=true,'',' Enter !sub to join the queue.'),BAD) else WriteConsole(ID,'Takes already match '+inttostr(Mix)+'vs'+inttostr(Mix)+'!'+iif(PlayerInMix[id]=true,'',' Write !add to join the game.'),BAD);
- end;
- end;
- procedure OnJoinGame(ID, Team: byte);
- begin
- ResVar(ID);
- DrawTextEx(ID,52,'!mix - Play Match!',350,GOOD,0.200,30,340);
- end;
- Procedure OnJoinTeam(ID, Team: byte);
- var i: byte; c:integer;
- begin
- if (Team=1) or (Team=2) then if (matchon=true) then begin
- if (PlayerInMix[ID] = false) then begin
- Command('/setteam5 '+inttostr(ID));
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] = '') then inc(c,1); //Daj info graczowi jak dolaczyc ponnownie
- if (c<>0) then WriteConsole(ID,' ---> Write !add to join game. <---',BAD) else WriteConsole(ID,' ---> Write !sub to join the queue. <---',BAD);
- prewteam[ID] := 5;
- exit;
- end else
- begin
- if (mixteams=false) then if (Move[ID]=false) then begin
- if (prewteam[ID]<>Team) then begin
- Move[id] := true;
- Command('/setteam'+inttostr(prewteam[ID])+' '+inttostr(id));
- prewteam[ID] := prewteam[ID];
- WriteConsole(ID,' ---> You can not change the team during the match. <---',BAD);
- WriteConsole(ID,' ---> Use !sub to turn into a team with other players. <---',BAD);
- exit;
- end;
- end else if (move[id]=true) then begin
- Move[id] := false;
- prewteam[ID] := GetPlayerStat(id,'team');
- exit;
- end;
- end;
- end;
- if (Team=5) then begin
- if (PlayerInMix[ID] = true) then begin
- ResVar(ID); //Usun gracza z listy i zresetuj zmienne
- for i := 1 to (Mix*2) do if (MixList[i] = GetPlayerStat(ID,'Name')) then MixList[i] := '';
- c:=0;
- for i := 1 to 8 do if (MixList[i] = '') then inc(c,1); //Sprawdz czy mix aktywny
- if (c=8) then begin
- Mix:=0;
- matchon:=false;
- end;
- SubCheck(ID,1,false,1); //Dodaj innego
- if (voter[id] = true) then begin
- if (Votes > 0) then dec(Votes,1); //Jesli glosowal, usun jego glos
- if (Votes2 > 0) then dec(Votes2,1);
- if (Votes3 > 0) then dec(Votes3,1);
- if (Votes4 > 0) then dec(Votes4,1);
- CheckVotes();
- end;
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] = '') then inc(c,1); //Daj info graczowi jak dolaczyc ponnownie
- if (c<>0) then WriteConsole(ID,' ---> Write !add to join game. <---',BAD) else WriteConsole(ID,' ---> Write !sub to join the queue. <---',BAD);
- end;
- end;
- prewteam[ID] := GetPlayerStat(id,'team');
- end;
- procedure OnPlayerSpeak(ID: byte; Text: string);
- var i:byte; mapy: TStringArray; c:integer;
- begin //!del !add !off !status !p !up !bal
- if regExpMatch('^!(balance|bal|teams)$',lowercase(Text)) then begin
- if (PlayerInMix[ID] = true) then begin
- a:=AlphaPlayers;
- b:=BravoPlayers;
- Balance();
- end else WriteConsole(ID,'You must participate in the game to balance teams.',BAD);
- end;
- if regExpMatch('^!(sub)$',lowercase(Text)) then begin
- if (Mix<>0) then begin
- if (PlayerInMix[ID] = true) then begin
- if (InGameSup[ID] = false) then begin
- InGameSup[ID] := true; //Dodanie do kolejki aby sie zmienic w grze
- WriteConsole(ID,'You have been added to the queue to change.',GOOD);
- end else WriteConsole(ID,'You`re already in the queue to change!',BAD);
- SubCheck(ID,0,true,1);
- end else
- begin
- if (SupWait[ID] = false) then begin
- SupWait[ID] := true; //dodaj do kolejki
- WriteConsole(ID,'You have been added to the queue.',GOOD);
- end else WriteConsole(ID,'You`re already to play match!',BAD);
- SubCheck(ID,0,true,2);
- end;
- end else WriteConsole(ID,'Currently not take any match!',BAD);
- end;
- if regExpMatch('^!(delsub)$',lowercase(Text)) then begin
- if (InGameSup[ID] = true) or (SupWait[ID] = true) then begin
- InGameSup[ID] := false;
- SupWait[ID] := false;
- WriteConsole(ID,'You have been removed from the queue.',GOOD);
- end else WriteConsole(ID,'You`re not in the queue!',BAD);
- end;
- if regExpMatch('^!(ranmap)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- mapy := Explode(ReadFile('mapslist.txt'),chr(13)+chr(10));
- Command('/map '+mapy[Random(0,GetArrayLength(mapy)-1)]);
- Anty:=1;
- end else WriteConsole(ID,'You can`t change the map not being in while of the match.',BAD);
- if MaskCheck(lowercase(Text),'!map *') then if (PlayerInMix[ID] = true) then begin
- delete(Text,1,5);
- if (Text<>'') then begin
- mapy := Explode(ReadFile('mapslist.txt'),chr(13)+chr(10));
- for i:= 1 to (GetArrayLength(mapy)-1) do begin
- if (ContainsString(lowercase(mapy[i-1]),lowercase(Text))=true) then begin
- if (mapy[i-1] <> '') then begin
- Command('/map '+mapy[i-1]);
- Anty:=1;
- end else WriteConsole(ID,'No maps found!',BAD);
- break;
- end;
- end;
- end else WriteConsole(ID,'You must enter the name of map or a part thereof.',BAD);
- end else WriteConsole(ID,'You can`t change the map not being in while the match.',BAD);
- if regExpMatch('^!(mix|cmdmix|mixcmd|cmdsmix|mixcmds)$',lowercase(Text)) then begin
- WriteConsole(ID,'While Match:',BAD);
- WriteConsole(ID,' !del - Exit from the match, !ub - Unbanlast. ',BAD);
- WriteConsole(ID,' !p - Enable pause, !up - Disable pause. ',BAD);
- WriteConsole(ID,' !bal - Balance teams, !mixteams - Mixed teams.',BAD);
- WriteConsole(ID,' !off !r - Votes per: Disable match | Restart match. ',BAD);
- WriteConsole(ID,' !map <name> - Change map name, !ranmap - Randommap. ',BAD);
- WriteConsole(ID,' !nextmap - Vote for nextmap. ',BAD);
- WriteConsole(ID,'Normally:',GOOD);
- WriteConsole(ID,' !add - Add to the match, !status - Match status. ',GOOD);
- WriteConsole(ID,' !sub - Add queue, !delsub - Exit from queue. ',GOOD);
- WriteConsole(ID,' !1v1 !2v2 - Beginning game 1v1 or 2v2. ',GOOD);
- WriteConsole(ID,' !3v3 !4v4 - Beginning game 3v3 or 4v4. ',GOOD);
- WriteConsole(ID,'Script Creator: dominikk26 ',$FFCCFF);
- end;
- if regExpMatch('^!(1v1)$',lowercase(Text)) then MixON(ID,1);
- if regExpMatch('^!(2v2)$',lowercase(Text)) then MixON(ID,2);
- if regExpMatch('^!(3v3)$',lowercase(Text)) then MixON(ID,3);
- if regExpMatch('^!(4v4)$',lowercase(Text)) then MixON(ID,4);
- if regExpMatch('^!(add)$',lowercase(Text)) then if (Mix <> 0) then MixR(ID) else WriteConsole(ID,'Currently not take none match!',BAD);
- if regExpMatch('^!(del)$',lowercase(Text)) then if (Mix <> 0) then Command('/setteam5 '+inttostr(ID)) else WriteConsole(ID,'Currently not take none match!',BAD);
- if regExpMatch('^!(off)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- if (Voterr=false) then begin
- if (VoterM = false) then begin
- if (VoteN=false) then begin
- if (voter[id] = false) then begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (Voteo=false) then begin
- Voteo := true;
- Time := 15;
- end else inc(Time,5);
- voter[id] := true;
- inc(Votes,1);
- DrawTextEx(0,51,'Vote to OFF - '+inttostr(Votes)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- CheckVotes();
- end else WriteConsole(0,'You have already voted!',BAD);
- end else WriteConsole(ID,'Takes vote per next one map.',BAD);
- end else WriteConsole(ID,'Currently, the vote per mixing teams.',BAD);
- end else WriteConsole(ID,'Takes vote per restarting the match.',BAD);
- end else WriteConsole(ID,'You can`t disable match, when you don`t participate in match.',BAD);
- if regExpMatch('^!(r|reset|restart)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- if (Voteo = false) then begin
- if (VoterM = false) then begin
- if (VoteN=false) then begin
- if (voter[id] = false) then begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (Voterr=false) then begin
- Voterr := true;
- Time := 15;
- end else inc(Time,5);
- voter[id] := true;
- inc(Votes2,1);
- DrawTextEx(0,51,'Vote to restart - '+inttostr(Votes2)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- CheckVotes();
- end else WriteConsole(0,'You have already voted!',BAD);
- end else WriteConsole(ID,'Takes vote per nextmap.',BAD);
- end else WriteConsole(ID,'Currently, the vote per mixing teams.',BAD);
- end else WriteConsole(ID,'Currently, the vote for the off match.',BAD);
- end else WriteConsole(ID,'You can`t restart the game if you don`t participate in match!',BAD);
- if regExpMatch('^!(ub|unbanlast)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then Command('/unbanlast') else WriteConsole(ID,'You can`t unban players if you don`t participate in match!',BAD);
- if regExpMatch('^!(status)$',lowercase(Text)) then begin
- if (Mix<>0) then begin
- WriteConsole(ID,'Match ON '+inttostr(Mix)+'vs'+inttostr(Mix)+': ',GOOD);
- if (Mix=1) then WriteConsole(0,iif(Mix=1,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2],'-=2=-'),''),GOOD) else if (Mix=2) then WriteConsole(0,iif(Mix=2,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4],'-=4=-'),''),GOOD) else if (Mix=3) then WriteConsole(0,iif(Mix=3,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(Mix=3,iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6],'-=6=-'),''),''),GOOD) else if (Mix=4) then WriteConsole(0,iif(Mix=4,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(Mix=4,iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6]+',','-=6=-')+' '+iif(MixList[7]<>'',MixList[7]+',','-=7=-')+' '+iif(MixList[8]<>'',MixList[8],'-=8=-'),''),''),GOOD);
- end else WriteConsole(ID,'Match OFF.',GOOD);
- end;
- if regExpMatch('^!(p|pause|pauza|stop)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- if (pause=0) then begin
- Command('/pause');
- WriteConsole(0,GetPlayerStat(ID,'name')+' turned on the paused!',GOOD);
- WriteConsole(0,'Pause is automatically turned off after 1:30 min.',GOOD);
- pause:=91;
- end else WriteConsole(ID,'Pause is already switched on!',BAD);
- end else WriteConsole(ID,'You can`t give pause without being in the course of the match.',BAD);
- if regExpMatch('^!(up|unpause|unpauze|play)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- if (pause>0) then begin
- if (pause<=4) then WriteConsole(ID,'Takes off pause.',BAD) else pause:=4;
- end else WriteConsole(ID,'Pause is not switched on!',BAD);
- end else WriteConsole(ID,'You can`t cancel without being paused during the match.',BAD);
- if regExpMatch('^!(mixt|mixteam|mixteams|mt)$',lowercase(Text)) then if (PlayerInMix[id]=true) then begin
- if (Voteo = false) then begin
- if (Voterr=false) then begin
- if (VoteN=false) then begin
- if (voter[id] = false) then begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (Voterm=false) then begin
- Voterm := true;
- Time := 15;
- end else inc(Time,5);
- voter[id] := true;
- inc(Votes3,1);
- DrawTextEx(0,51,'Vote to mix teams - '+inttostr(Votes3)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- CheckVotes();
- end else WriteConsole(0,'You have already voted!',BAD);
- end else WriteConsole(ID,'Takes vote per nextmap.',BAD);
- end else WriteConsole(ID,'Takes vote per restarting the match.',BAD);
- end else WriteConsole(ID,'Currently, the vote for the off match.',BAD);
- end else WriteConsole(ID,'You can`t vote per mixing teams without being in the course of the match.',BAD);
- if regExpMatch('^!(next|nextmap|votemap|nextvote)$',lowercase(Text)) then if (PlayerInMix[ID] = true) then begin
- if (Voteo = false) then begin
- if (VoterM = false) then begin
- if (Voterr=false) then begin
- if (voter[id] = false) then begin
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (VoteN=false) then begin
- VoteN := true;
- Time := 15;
- end else inc(Time,5);
- voter[id] := true;
- inc(Votes4,1);
- DrawTextEx(0,51,'Vote to nextmap - '+inttostr(Votes4)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- DrawTextEx(0,55,' ('+NextMap+')',140,GOOD,0.075,180,16);
- CheckVotes();
- end else WriteConsole(0,'You have already voted!',BAD);
- end else WriteConsole(ID,'Takes vote per restarting the match.',BAD);
- end else WriteConsole(ID,'Currently, the vote per mixing teams.',BAD);
- end else WriteConsole(ID,'Currently, the vote for the off match.',BAD);
- end else WriteConsole(ID,'You can`t vote for nextmap, without being in the match.',BAD);
- end;
- procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
- var i: byte; c: integer;
- begin
- if (PlayerInMix[ID] = true) then begin
- for i := 1 to 8 do if (MixList[i] = GetPlayerStat(ID,'Name')) then MixList[i] := ''; //Usun z listy
- c:=0;
- for i := 1 to 8 do if (MixList[i] = '') then inc(c,1);
- if (c=8) then begin //By Dominik
- Mix:=0; //Wylacz mix gdy brak graczy
- matchon:=false;
- end;
- SubCheck(ID,1,false,1); //Dodaj innego
- if (voter[id] = true) then begin
- if (Votes > 0) then dec(Votes,1); //Jesli glosowal, usun jego glos
- if (Votes2 > 0) then dec(Votes2,1);
- if (Votes3 > 0) then dec(Votes3,1);
- if (Votes4 > 0) then dec(Votes4,1);
- CheckVotes();
- end;
- end;
- ResVar(ID); //Reset zmiennych
- if (Mix=1) then WriteConsole(0,iif(Mix=1,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2],'-=2=-'),''),GOOD) else if (Mix=2) then WriteConsole(0,iif(Mix=2,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4],'-=4=-'),''),GOOD) else if (Mix=3) then WriteConsole(0,iif(Mix=3,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(Mix=3,iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6],'-=6=-'),''),''),GOOD) else if (Mix=4) then WriteConsole(0,iif(Mix=4,iif(MixList[1]<>'',MixList[1]+',','-=1=-')+' '+iif(MixList[2]<>'',MixList[2]+',','-=2=-')+' '+iif(MixList[3]<>'',MixList[3]+',','-=3=-')+' '+iif(MixList[4]<>'',MixList[4]+',','-=4=-')+' '+iif(Mix=4,iif(MixList[5]<>'',MixList[5]+',','-=5=-')+' '+iif(MixList[6]<>'',MixList[6]+',','-=6=-')+' '+iif(MixList[7]<>'',MixList[7]+',','-=7=-')+' '+iif(MixList[8]<>'',MixList[8],'-=8=-'),''),''),GOOD);
- end;
- procedure AppOnIdle(Ticks: integer);
- var i: byte; c:integer;
- begin
- DrawTextEx(0,49,'MIX '+iif((mix<>0),'ON','OFF')+'!',140,iif((mix<>0),GOOD,BAD),0.075,705,2); //Mix on off prawy rog 553 dol 545
- if (mix<>0) then DrawTextEx(0,50,'('+inttostr(mix)+'vs'+inttostr(mix)+')',140,iif((mix<>0),GOOD,BAD),0.075,719,13);
- if (Time>0) then begin
- dec(time,1);
- c:=0;
- for i := 1 to (mix*2) do if (MixList[i] <> '') then inc(c,1);
- if (Votes<>0) then DrawTextEx(0,51,'Vote to OFF - '+inttostr(Votes)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- if (Time=0) then begin
- Voteo := false;
- Votes := 0;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- DrawTextEx(0,51,'Vote to OFF - Failure!',140,BAD,0.075,180,2);
- end;
- if (Votes2<>0) then DrawTextEx(0,51,'Vote to Restart - '+inttostr(Votes2)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- if (Time=0) then begin
- Voterr := false;
- Votes2 := 0;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- DrawTextEx(0,51,'Vote to Reset - Failure!',140,BAD,0.075,180,2);
- end;
- if (Votes3<>0) then DrawTextEx(0,51,'Vote to mix teams - '+inttostr(Votes3)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- if (Time=0) then begin
- Voterm := false;
- Votes3 := 0;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- DrawTextEx(0,51,'Vote to mix teams - Failure!',140,BAD,0.075,180,2);
- end;
- if (Votes4<>0) then begin
- DrawTextEx(0,51,'Vote to nextmap - '+inttostr(Votes4)+'/'+inttostr(iif(c>=mix,mix,c))+' ('+inttostr(time)+'s)',140,GOOD,0.075,180,2);
- DrawTextEx(0,55,' ('+NextMap+')',140,GOOD,0.075,180,16);
- end;
- if (Time=0) then begin
- VoteN := false;
- Votes4 := 0;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then voter[i] := false;
- DrawTextEx(0,51,'Vote to nextmap - Failure!',140,BAD,0.075,180,2); DrawTextEx(0,55,'',140,GOOD,0.075,180,16);
- end;
- end;
- if (pause > 0) then begin
- dec(pause,1);
- if (pause = 3) then WriteConsole(0,'Unpausing!',GOOD);
- if (pause > 0) and (pause < 4) then WriteConsole(0,inttostr(pause)+'...', GOOD) else begin
- if (pause = 0) then begin
- WriteConsole(0,'GO GO GO!',GOOD);
- Command('/unpause');
- end;
- end;
- end;
- end;
- procedure SerRes();
- var i:byte;
- begin
- Mix := 0;
- for i := 1 to 32 do if (GetPlayerStat(i, 'Active')=true) then begin
- ResVar(i);
- prewteam[i] := GetPlayerStat(i,'Team');
- end;
- for i := 1 to 8 do MixList[i] := '';
- Votes := 0;
- Votes2 := 0;
- Votes3 := 0;
- Votes4 := 0;
- Voteo := false;
- Voterr := false;
- VoterM := false;
- VoteN := false;
- matchon := false;
- Anty:=0;
- mixteams:=false;
- end;
- procedure OnMapChange(NewMap: String);
- begin
- if (Anty<>1) then SerRes();
- Anty:=0;
- end;
- procedure ActivateServer();
- begin
- SerRes();
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement