Script Name: NextMap Vote
Script Description: Players can vote to skip to next map by writing !nextmap.
Vote % set on 60% for default.
Original Author(s): Iftach
Core Version: 2.6.0
Please alert me on any bug you find.
var
NextMapArray: array[1..32] of Boolean;
NextMapVote: Byte;
procedure ResetMapVote();
var
i: integer;
begin
NextMapVote:=0;
for i := 1 to 32 do begin
NextMapArray[i] := False;
end;
end;
procedure OnMapChange(NewMap: string);
begin
ResetMapVote()
end;
procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);
begin
if NextMapArray[ID] then begin
NextMapArray[ID]:=false;
NextMapVote:=NextMapVote-1;
end;
end;
procedure NextMapV(ID: integer);
var
VotePrec: Double;
begin
NextMapArray[ID]:=true;
NextMapVote:=NextMapVote+1;
command('/say Voters for Next Map: ' + inttostr(NextMapVote)+'/'+inttostr(NumPlayers));
VotePrec:=NextMapVote/NumPlayers;
{the 0.6 means 60% vote percentage needed. (changeable)}
if (VotePrec>0.6) then Begin
Command('/say Next Map Vote Had Passed');
Command('/nextmap');
End;
End;
procedure OnPlayerSpeak(ID: byte; Text: string);
begin
if (Text = '!nextmap') and (NextMapArray[ID]=false) then NextMapV(ID);
End;