Author Topic: Master  (Read 8526 times)

0 Members and 1 Guest are viewing this topic.

Offline sckme

  • Major(1)
  • Posts: 33
Re: Master
« Reply #20 on: September 30, 2008, 02:16:34 am »
it's dont work. i wrote in cmd /setpred 1 (1 is my ID, i wrote this in game), and    
nothing happens ;f before when i start my server i edit file commands.txt in folder Master and i wrote command setpred and its sucks, dont work.

Offline Mr

  • Inactive Soldat Developer
  • Soldier
  • ******
  • Posts: 166
Re: Master
« Reply #21 on: September 30, 2008, 06:14:59 am »
it's dont work. i wrote in cmd /setpred 1 (1 is my ID, i wrote this in game), and    
nothing happens ;f before when i start my server i edit file commands.txt in folder Master and i wrote command setpred and its sucks, dont work.

Wait... let's try to translate this to english:
Quote
Sorry, but your script won't work for me. I wrote "/setpred 1" in Soldat's cmd, but nothing happens. Bevore I started my server I edited the commands.txt file in the script's directory. Can you fix this problem, please?

Let's replay to this post :)


Maybe this will help you: http://www.enesce.com/help/index.html?Functions/CrossFunc.html
I don't know the InfPred script, but I guess that this will fix your problem:

Replace this:
Code: [Select]
CrossFunc([ID, MasterCmds[i]], 'InfiPred.OnCommand'); Break;
With this code:
Code: [Select]
CrossFunc([ID, Text], 'InfiPred.OnCommand');
Break;
« Last Edit: September 30, 2008, 06:22:22 am by Mr »

Offline sckme

  • Major(1)
  • Posts: 33
Re: Master
« Reply #22 on: September 30, 2008, 07:27:03 am »
infi pred code:

Code: [Select]
  const
  Color = $FFFFFFFF;

var
  IsPred, AfterRespawn: array[1..32] of boolean;

procedure AppOnIdle(Ticks: cardinal);
var
  i: byte;
begin
  for i := 1 to 32 do if AfterRespawn[i] then begin
    if IsPred[i] then begin
      GiveBonus(i, 1);
      DrawText(i, '  ', 0, $00000000, 0, 0, 0);
    end;
    AfterRespawn[i] := false;
  end;
  if (Ticks mod 600) = 0 then begin
    for i := 1 to 32 do if GetPlayerStat(i, 'Active') = true then if IsPred[i] and (GetPlayerStat(i, 'Alive') = true) then begin
      GiveBonus(i, 1);
      DrawText(i, '  ', 0, $00000000, 0, 0, 0);
    end;
  end;
end;

procedure OnJoinGame(Id, Team: byte);
begin
  IsPred[Id] := false;
end;

function OnCommand(Id: byte; Text: string): boolean;
var
  Who: byte;
begin
  if Text[1] = '/' then begin
    Delete(Text, 1, 1);
    if LowerCase(GetPiece(Text, ' ', 0)) = 'setpred' then begin
      try
        Who := StrtoInt(Copy(Text, 9, Length(Text)));
        if not GetPlayerStat(Who, 'Active') then StrtoInt(' ');
        IsPred[Who] := true;
        if GetPlayerStat(Who, 'Alive') = true then begin
          GiveBonus(Who, 1);
          DrawText(Who, '  ', 0, $00000000, 0, 0, 0);
        end;
        if Id <> Who then WriteConsole(Id, 'You have given ' + GetPlayerStat(Who, 'Name') + ' infinite predator', Color);
        WriteConsole(Who, 'An admin has given you infinite predator', Color);
      except
        WriteConsole(Id, 'Invalid player', Color);
      end;
    end else if LowerCase(GetPiece(Text, ' ', 0)) = 'delpred' then begin
      try
        Who := StrtoInt(Copy(Text, 9, Length(Text)));
        if not GetPlayerStat(Who, 'Active') then StrtoInt(' ');
        IsPred[Who] := false;
        if Id <> Who then WriteConsole(Id, 'You have taken infinite predator from ' + GetPlayerStat(Who, 'Name'), Color);
        WriteConsole(Who, 'An admin has taken your infinite predator', Color);
      except
        WriteConsole(Id, 'Invalid player', Color);
      end;
    end;
  end;
end;

procedure OnPlayerRespawn(Id: byte);
begin
  AfterRespawn[Id] := true;
end;

ur suggestion don't work :)