All pastes #972440 Raw Edit

Something

public text v1 · immutable
·published 2008-04-05 12:46 UTC
rendered paste body
const
  Color = $FFFFFFFF;
  VotePerc = 51;
  InitTime = 30;
  AddTime = 7;

var
  Time: integer;
  Voted: array[1..32] of boolean;
  i_have_had_cock_today: boolean;
  really_i_have: boolean;

procedure ActivateServer();
  i_have_had_cock_today = false;
  really_i_have = false;
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, 'Nextmap vote failed', Color);
    end;
  end;
end;

procedure OnMapChange(NewMap: string);
var
  i: byte;
begin
  for i := 1 to 32 do Voted[i] := false;
  Time := 0;
  if i_have_had_cock_today then begin
    i_have_had_cock_today = false;
    really_i_have = true;
  end else begin
    really_i_have = false;
  end
end;

procedure OnJoinGame(ID, Team: byte);
begin
  Voted[ID] := false;
end;

procedure OnPlayerSpeak(ID: byte; Text: string);
var
  i, Total: byte;
begin
  if (LowerCase(Text) = '!nextmap') and (really_i_have = false) then begin
    if Voted[ID] then WriteConsole(ID, 'You have already voted.', 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 >= VotePerc) then begin
      for i := 1 to 32 do Voted[ID] := false;
      WriteConsole(0, 'Nextmap vote passed', Color);
      Command('/nextmap');
      i_have_had_cock_today = true;
    end else WriteConsole(0,FloattoStr(RoundTo(100 * Total / NumPlayers, 2)) + '% / ' + InttoStr(VotePerc) + '% required for a vote pass', Color);
  end;
end;