Author Topic: Enable/disable script  (Read 641 times)

0 Members and 1 Guest are viewing this topic.

Offline Akinaro

  • Flagrunner
  • ****
  • Posts: 749
Enable/disable script
« on: October 13, 2013, 09:10:18 am »
.
« Last Edit: November 11, 2013, 04:50:00 am by Akinaro »

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Enable/disable script
« Reply #1 on: October 13, 2013, 09:39:55 am »
Try this code:
Code: [Select]
var
enabled: boolean;

Procedure ActivateServer();
begin
enabled:=false;
end;

Procedure AppOnIdle(Ticks: Integer);
var
i: byte;
begin
if (Ticks mod (60 * 16) = 0) then begin
if enabled then begin
for i := 1 to 16 do begin
if (GetPlayerStat(i, 'active')) then begin
GiveBonus(i, 1);
DrawText(i, '  ', 2, $00000000, 1, 0, 0);
end;
end;
end;
end;
end;

function OnCommand(ID: Byte; Text: string): boolean;
var
i: byte;
begin
if Text = '/predatorwar' then begin
if enabled then begin
WriteConsole(0,'PredatorWar has been disabled!', $FF0000);
enabled := false;
end
else begin
WriteConsole(0,'PredatorWar has been enabled!', $FF0000);
enabled := true;
for i := 1 to 16 do begin
if (GetPlayerStat(i, 'active')) then begin
GiveBonus(i, 1);
DrawText(i, '  ', 2, $00000000, 1, 0, 0);
end;
end;
end;
end;
end;
Classic banana

Offline kicikici

  • Soldier
  • **
  • Posts: 180
Re: Enable/disable script
« Reply #2 on: October 13, 2013, 02:41:01 pm »
My code works fine, I tested.
Do u know what quoted text do?
Quote
if Text = '/predwar on' then
      begin
         WriteConsole(0,'PredatorWar has been enabled!', $FF0000);
         enabled := true;
         end else
            begin
            for i := 1 to 16 do begin
            if (GetPlayerStat(i, 'active')) then
            begin
            GiveBonus(i, 1);
            DrawText(i, '  ', 2, $00000000, 1, 0, 0);
            end;
         end;
      end;
This code will give predator to all players when u type ANY admin cmd. I suppose that it shouldnt work in that way :P
Classic banana