0 Members and 1 Guest are viewing this topic.
const Color = $E56600; VoteTime = 60; AddTime = 15; VotePerc = 65;var Voted : array[1..32] of boolean; VoteRun, EnDis : boolean; Time : integer; Script : string; procedure ScriptChange(const ScriptName : string; const State : boolean);var Index, SIndex : string; rec : boolean;begin if not FileExists('scripts/script-vote/' + ScriptName + '/Includes.txt') then begin exit; end; Index := ReadFile('scripts/script-vote/' + ScriptName + '/Includes.txt'); SIndex := Copy(Index,0,length(Index)); rec := false; if (State) and (Copy(Index,0,2) = '//') then begin WriteFile('scripts/script-vote/' + ScriptName + '/Includes.txt',Copy(Index,3,length(Index))); rec := true; end else if not (State) and (Copy(Index,0,2) <> '//') then begin WriteFile('scripts/script-vote/' + ScriptName + '/Includes.txt','//' + SIndex); rec := true; end else if not (State) and (Copy(Index,0,2) = '//') then begin rec := false; end else if (State) and (Copy(Index,0,2) <> '//') then begin rec := false; end; if rec then begin Command('/recompile ' + ScriptName); end else if not rec then exit;end;function GetScriptState(const ScriptName : string): boolean;var Index : string; begin if FileExists('scripts/script-vote/' + ScriptName + '/Includes.txt') then begin Index := ReadFile('scripts/' + ScriptName + '/Includes.txt'); if Copy(Index,0,2) = '//' then begin Result := false; end else Result := true end;end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);beginend;procedure OnPlayerSpeak(ID: byte; Text: string);var Total, i : integer;begin if (LowerCase(GetPiece(Text,' ',0)) = '!vote') and not (Voted[ID]) then if (GetPlayerStat(ID,'Active')) then if FileExists('scripts/script-vote/' + GetPiece(Text,' ',1) + '/Includes.txt') then begin Total := Total + 1; Voted[ID] := true; VoteRun := true; if Time = 0 then Time := VoteTime else Time := Time + AddTime; if GetScriptState(GetPiece(Text,' ',1)) = true then begin EnDis := false; WriteConsole(ID,'Player ' + IdToName(ID) + ' voted to enable the script ' + GetPiece(Text,' ',1),Color); end else if GetScriptState(GetPiece(Text,' ',1)) = false then begin EnDis := true; WriteConsole(ID,'Player ' + IdToName(ID) + ' voted to disable the script ' + GetPiece(Text,' ',1),Color); end; Script := GetPiece(Text,' ',1); if (100 * Total / (NumPlayers - NumBots) >= VotePerc) then begin for i := 1 to 32 do Voted[ID] := false; WriteConsole(ID,'Script-Change vote passed! Script "' + Script + '" is now ' +iif(EnDis,'en','dis') + 'abled',Color); ScriptChange(Script,EnDis); end else WriteConsole(0,FloatToStr(RoundTo(100 * Total / (NumPlayers - NumBots), 2)) + '% / ' + InttoStr(VotePerc) + '% required for a vote pass', Color); end else WriteConsole(ID,'Error, Script ' + GetPiece(Text,' ',1) + ' not found.',Color);end;procedure AppOnIdle(Ticks: integer);var i, b : integer;begin if Time >= 0 then begin Time := Time - 1; end; if Time = 0 then begin for b := 1 to 32 do Voted := false; WriteConsole(0, 'Script-Vote failed', Color); end;end;
{ ... HOME OF THE CONSTANT ... FILL ALL THE CONSTANT VERY CAREFULLY! Always keep the 'single quotes' WHERE APPROPRIATE. AND READ ALL INFORMATION CONTAINED ON THE RIGHT TO CONSTANT. }constNomeServidor = 'Kowalsky - Multi Modes.'; // Name Your server.MaxM = 6; // Choose Max Modes your server. (1 - 6) Script1 = 'script1.pas'; // Name of Script 1 mode. Ex: Arquivo1.pasScript2 = 'script2.pas'; // Name of Script 2 mode. Ex: Arquivo2.pasScript3 = 'script3.pas'; // Name of Script 3 mode. Ex: Arquivo3.pasScript4 = 'script4.pas'; // Name of Script 4 mode. Ex: Arquivo4.pasScript5 = 'script5.pas'; // Name of Script 5 mode. Ex: Arquivo5.pasScript6 = 'script6.pas'; // Name of Script 6 mode. Ex: Arquivo6.pasPasta1 = 'Pasta_Mode1'; //Paste the 1st script.Pasta2 = 'Pasta_Mode2'; //Paste the 2st script.Pasta3 = 'Pasta_Mode3'; //Paste the 3st script.Pasta4 = 'Pasta_Mode4'; //Paste the 4st script.Pasta5 = 'Pasta_Mode5'; //Paste the 5st script.Pasta6 = 'Pasta_Mode6'; //Paste the 5st script.Mode1 = 'Mode 1'; // Name of Mode ID 1. Ex: Hide'N'Seek. Mode2 = 'Mode 2'; // Name of Mode ID 2. Ex: Knife Voley.Mode3 = 'Mode 3'; // Name of Mode ID 3. Ex: Zrpg.Mode4 = 'Mode 4'; // Name of Mode ID 4. Ex: Climb.Mode5 = 'Mode 5'; // Name of Mode ID 5. Ex: M79 Climb.Mode6 = 'Mode 6'; // Name of Mode ID 6. Ex: Mission Mod.Cor = $FFFFFF; // Default color of the posts is WHITE Tempomax = 80; // Time limit for a vote to stayativa. (in seconds)PercentualN = 75; // Max Vote Percent ModeP = 1; // Default Mode when the server starts.Desativar = '//'; // Do not lock here!CorS = $FFFBDA22; { ...END OF CONSTANT...