0 Members and 1 Guest are viewing this topic.
const Color = $9933FFF; VotePerc = 51; InitTime = 60; AddTime = 10;var Enable: boolean; Time: integer; Voted: array[1..32] of boolean;procedure DisableVoteNext;begin Enable := false;end;procedure ActivateServer();begin Enable := true;end;procedure AppOnIdle(Ticks: integer);var i: byte;begin if (Time > 0) then begin Time := Time - 1; if (Time = 0) then begin for i := 1 to 32 do Voted[i] := false; WriteConsole(0, 'Oylama basarisiz', Color); end; end;end;function OnCommand(Id: byte; Text: string): boolean;begin if ((LowerCase(Copy(Text, 1, 8)) = '/restart') or (LowerCase(Copy(Text, 1, 8)) = '/nextmap') or ((LowerCase(Copy(Text, 1, 4)) = '/map') and (FileExists('maps/' + Copy(Text, 6, Length(Text)) + '.PMS')))) then DisableVoteNext;end;procedure OnMapChange(NewMap: string);var i: byte;begin Enable := true; for i := 1 to 32 do Voted[i] := false; Time := 0;end;procedure OnJoinGame(ID, Team: byte);begin Voted[ID] := false;end;function ShowTrimmedPercentage(): string;var i: byte;begin Result := FloatToStr(100 * Total / (NumPlayers - NumBots)); While (Copy(Result, Length(Result), 1) = '0') do Result := Copy(Result, 1, Length(Result) - 1);end; procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);var i, Total: byte;begin Voted[ID] := false; for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1; if (Total > 0) then begin if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin for i := 1 to 32 do Voted[ID] := false; DisableVoteNext; WriteConsole(0, 'Oylama basarili', Color); Command('/nextmap'); end else WriteConsole(0,ShowTrimmedPercentage() + '% / ' + InttoStr(VotePerc) + '% gerekiyor', Color); end;end;procedure OnPlayerSpeak(ID: byte; Text: string);var i, Total: byte;begin if ((LowerCase(Text) = '!nextmap') and (Enable)) then begin if Voted[ID] then WriteConsole(ID, 'Zaten oy kullandin.', Color) else if (Time = 0) then Time := InitTime else Time := Time + Addtime; Voted[ID] := true; for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1; if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin for i := 1 to 32 do Voted[ID] := false; DisableVoteNext; WriteConsole(0, 'Oylama basarili', Color); Command('/nextmap'); end else WriteConsole(0,ShowTrimmedPercentage() + '% / ' + InttoStr(VotePerc) + '% gerekiyor', Color); end;end;
const Color = $9933FFF; VotePerc = 51; InitTime = 60; AddTime = 10;var Enable: boolean; Time: integer; Voted: array[1..32] of boolean;procedure DisableVoteNext;begin Enable := false;end;procedure ActivateServer();begin Enable := true;end;procedure AppOnIdle(Ticks: integer);var i: byte;begin if (Time > 0) then begin Time := Time - 1; if (Time = 0) then begin for i := 1 to 32 do Voted[i] := false; WriteConsole(0, 'Oylama basarisiz', Color); end; end;end;function OnCommand(Id: byte; Text: string): boolean;begin if ((LowerCase(Copy(Text, 1, 8)) = '/restart') or (LowerCase(Copy(Text, 1, 8)) = '/nextmap') or ((LowerCase(Copy(Text, 1, 4)) = '/map') and (FileExists('maps/' + Copy(Text, 6, Length(Text)) + '.PMS')))) then DisableVoteNext; Result := false;end;procedure OnMapChange(NewMap: string);var i: byte;begin Enable := true; for i := 1 to 32 do Voted[i] := false; Time := 0;end;procedure OnJoinGame(ID, Team: byte);begin Voted[ID] := false;end;function ShowTrimmedPercentage(): string;var Total: byte;begin Result := FloatToStr(100 * Total / (NumPlayers - NumBots)); While (Copy(Result, Length(Result), 1) = '0') do Result := Copy(Result, 1, Length(Result) - 1);end; procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);var i, Total: byte;begin Voted[ID] := false; for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1; if (Total > 0) then begin if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin for i := 1 to 32 do Voted[ID] := false; DisableVoteNext; WriteConsole(0, 'Oylama basarili', Color); Command('/nextmap'); end else WriteConsole(0,ShowTrimmedPercentage() + '% / ' + InttoStr(VotePerc) + '% gerekiyor', Color); end;end;procedure OnPlayerSpeak(ID: byte; Text: string);var i, Total: byte;begin if ((LowerCase(Text) = '!nextmap') and (Enable)) then begin if Voted[ID] then WriteConsole(ID, 'Zaten oy kullandin.', Color) else if (Time = 0) then Time := InitTime else Time := Time + Addtime; Voted[ID] := true; for i := 1 to 32 do if (GetPlayerStat(i, 'Active') = true) and (Voted[i]) then Total := Total + 1; if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin for i := 1 to 32 do Voted[ID] := false; DisableVoteNext; WriteConsole(0, 'Oylama basarili', Color); Command('/nextmap'); end else WriteConsole(0,ShowTrimmedPercentage() + '% / ' + InttoStr(VotePerc) + '% gerekiyor', Color); end;end;