0 Members and 1 Guest are viewing this topic.
saykillkickpasswordsetteammaprestartpauseunpausegmuteungmute
And if the first person that joins is an idiot he will screw up your server...
what program do you use for the scripts?
CrossFunc([ID, MasterCmds], 'SCRIPTNAME.OnCommand');
For those who want this to work with other scripts with custom commands, do this:1. open Master.pas file2. do "find" and find "Break;"3. on the line BEFORE THIS LINE, add this:QuoteCrossFunc([ID, MasterCmds], 'SCRIPTNAME.OnCommand');where as "SCRIPTNAME" is the name of the folder that the script is in..if u want it to work with more than 1 script, juts add the exact same thing under this... but with a different SCRIPTNAME.
const AutoMaster = false; Color = $0000FF;var Master: byte; MasterCmds: tstringarray;function Split(const Source: string; const Delimiter: string): tstringarray;var i,x,d: integer; s: string;begin if Source <> '' then begin  d := Length(Delimiter);  x := 0;  i := 1;  SetArrayLength(Result,1);  while i <= Length(source) do begin   s := Copy(Source,i,d);   if s = Delimiter then begin    Inc(i,d);    Inc(x,1);    SetArrayLength(result,x + 1);   end else begin    Result := Result + Copy(s,1,1);    Inc(i,1);   end;  end; end else SetArrayLength(Result,0);end;procedure ActivateServer();begin MasterCmds := Split(ReadFile('scripts/Master/Commands.txt'),Chr(13) + Chr(10));end;function OnCommand(ID: Byte; Text: string): boolean;var i: integer;begin Result := false; if Text = '/loadmasterfile' then MasterCmds := Split(ReadFile('scripts/Master/Commands.txt'),Chr(13) + Chr(10)); if Master = ID then for i := 0 to ArrayHigh(MasterCmds) - 1 do if MasterCmds = Copy(Text,2,Length(MasterCmds)) then Result := true;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;var i: integer;begin if Master = 0 then begin  if (ID <> 255) and (LowerCase(Text) = '/master') then if Master = 0 then begin   Master := ID;   WriteConsole(0,GetPlayerStat(ID,'Name') + ' VIP zaktualizowany!.',Color);  end else WriteConsole(ID,'Master has already been claimed by ' + GetPlayerStat(Master,'Name') + '.',Color); end else if Master = ID then for i := 0 to ArrayHigh(MasterCmds) - 1 do if MasterCmds = Copy(Text,2,Length(MasterCmds)) then begin  Command(Text);  if Text <> '/loadmasterfile' then OnCommand(ID,Text);  CrossFunc([ID, MasterCmds], 'InfiPred.OnCommand'); Break; end;end;procedure OnJoinGame(ID, Team: byte);begin if (AutoMaster) and (Master = 0) then OnPlayerCommand(ID,'/master');end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin if ID = Master then Master := 0;end;
const AutoMaster = false; Color = $FFFFFF;var Master: byte; MasterCmds: tstringarray;function Split(const Source: string; const Delimiter: string): tstringarray;var i,x,d: integer; s: string;begin if Source <> '' then begin  d := Length(Delimiter);  x := 0;  i := 1;  SetArrayLength(Result,1);  while i <= Length(source) do begin   s := Copy(Source,i,d);   if s = Delimiter then begin    Inc(i,d);    Inc(x,1);    SetArrayLength(result,x + 1);   end else begin    Result[x] := Result[x] + Copy(s,1,1);    Inc(i,1);   end;  end; end else SetArrayLength(Result,0);end;procedure ActivateServer();begin MasterCmds := Split(ReadFile('scripts/Master/Commands.txt'),Chr(13) + Chr(10));end;function OnCommand(ID: Byte; Text: string): boolean;var i: integer;begin Result := false; if Text = '/loadmasterfile' then MasterCmds := Split(ReadFile('scripts/Master/Commands.txt'),Chr(13) + Chr(10)); if Master = ID then for i := 0 to ArrayHigh(MasterCmds) - 1 do if MasterCmds[i] = Copy(Text,2,Length(MasterCmds[i])) then Result := true;end;function OnPlayerCommand(ID: Byte; Text: string): boolean;var i: integer;begin if Master = 0 then begin  if (ID <> 255) and (LowerCase(Text) = '/master') then if Master = 0 then begin   Master := ID;   WriteConsole(0,GetPlayerStat(ID,'Name') + ' has claimed master for the server.',Color);  end else WriteConsole(ID,'Master has already been claimed by ' + GetPlayerStat(Master,'Name') + '.',Color); end else if Master = ID then for i := 0 to ArrayHigh(MasterCmds) - 1 do if MasterCmds[i] = Copy(Text,2,Length(MasterCmds[i])) then begin  Command(Text);  if Text <> '/loadmasterfile' then OnCommand(ID,Text);  CrossFunc([ID, MasterCmds[i]], 'InfiPred.OnCommand');  Break; end;end;procedure OnJoinGame(ID, Team: byte);begin if (AutoMaster) and (Master = 0) then OnPlayerCommand(ID,'/master');end;procedure OnLeaveGame(ID, Team: byte; Kicked: boolean);begin if ID = Master then Master := 0;end;
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.
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?
CrossFunc([ID, MasterCmds[i]], 'InfiPred.OnCommand'); Break;
CrossFunc([ID, Text], 'InfiPred.OnCommand');Break;
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;