Author Topic: Auto Gather/ I want Some changes?  (Read 1048 times)

0 Members and 1 Guest are viewing this topic.

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Auto Gather/ I want Some changes?
« on: December 30, 2012, 07:55:27 pm »
hi, I want autogather commands (!p !up !pass !alpha !spec !bravo !map....)
but spectators can use it, I dont want it.
can anybody give me a code for only players?
spectators cant use it?
Is there anybody can write script?
Good, go and play soldat ^^

Offline P

  • Major(1)
  • Posts: 15
Re: Auto Gather/ I want Some changes?
« Reply #1 on: December 31, 2012, 10:21:56 am »
there is a similar script on the first page of this subforum
http://forums.soldat.pl/index.php?topic=42245.0

ps: i highly recommend to search on your own before you open a thread

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: Auto Gather/ I want Some changes?
« Reply #2 on: December 31, 2012, 04:06:14 pm »
?! I dont know anything this script and your gived link?
Is there anybody can write script?
Good, go and play soldat ^^

Offline Bonecrusher

  • Global Moderator
  • Veteran
  • *****
  • Posts: 1397
  • High above
    • Zabijaka.pl
Re: Auto Gather/ I want Some changes?
« Reply #3 on: January 01, 2013, 05:44:39 am »
there you go

Im chill like that

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: Auto Gather/ I want Some changes?
« Reply #4 on: January 01, 2013, 06:13:47 am »
there you go

Code: [Select]
const
ClMessage = $FFFF0000;

var
Unpause: boolean;
UnpauseCount: integer;

function Split(const Source: string; const Delimiter: string): tstringarray;
var
  i,x,d: integer;
  s: string;
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;

procedure ActivateServer();
begin
  Unpause := false;
  UnpauseCount := 0;
end;

procedure AppOnIdle(Ticks: integer);
begin
  if (Unpause = true) then begin
    if (UnpauseCount = 0) then begin
      WriteConsole(0,'GO!',ClMessage);
      WriteLn('GO!');
      Command('/unpause'); Command('/unpause'); Command('/unpause');
      UnpauseCount := 0;
      Unpause := false;
    end
    else if (UnpauseCount > 0) then begin
      WriteConsole(0,InttoStr(UnpauseCount)+'...',ClMessage);
      WriteLn(InttoStr(UnpauseCount)+'...');
      UnpauseCount := UnpauseCount - 1;
    end;
  end;
end;

procedure OnJoinTeam(ID, Team: byte);
begin
  WriteConsole(ID,'AutoGather is running on this server. Type !help for commands',ClMessage);
  if (Paused = true) then
    Command('/pause');
end;

function OnCommand(ID: Byte; Text: string): boolean;
begin
//---/unpause
  if (MaskCheck(lowercase(Text),'/unpause*')) and (Paused = true) and (Unpause = false) then begin
    //Setup all the variables to go! AppOnIdle will do the rest.
    Unpause := true;
    UnpauseCount := 3;
    WriteConsole(0,'Unpausing...',ClMessage);
    WriteLn('Unpausing...');
    Result := true;
  end
//---/pause
  else if (MaskCheck(lowercase(Text),'/pause*')) then begin
    //If it is unpausing, break the countdown and stay paused...
    if (Unpause = true) then begin
      Unpause := false;
      UnpauseCount := 0;
      WriteConsole(0,'>>>Countdown Cancelled<<<',ClMessage);
      WriteLn('>>>Countdown Cancelled<<<');
    end
    //otherwise... just pause.
  end;
end;

procedure OnMapChange(NewMap: String);
begin
  Unpause := false;
  UnpauseCount := 0;
end;

procedure OnPlayerSpeak(ID: Byte; Text: string);
var
Map: string;
Mapslist: TStringArray;
begin
  if (MaskCheck(lowercase(Text),'!up')) or (MaskCheck(lowercase(Text),'!unpause')) then begin
    OnCommand(255,'/unpause');
  end
  else if (MaskCheck(lowercase(Text),'!p')) or (MaskCheck(lowercase(Text),'!pause')) then begin
    OnCommand(255,'/pause');
    Command('/pause');
  end
  else if (MaskCheck(lowercase(Text),'!r')) or (MaskCheck(lowercase(Text),'!restart')) then begin
    Command('/restart');
  end
  else if (MaskCheck(lowercase(Text),'!ub')) or (MaskCheck(lowercase(Text),'!unbanlast')) then begin
    Command('/unbanlast');
    WriteConsole(0,'Unbanned',ClMessage);
  end
  else if (MaskCheck(lowercase(Text),'!pw')) or (MaskCheck(lowercase(Text),'!password')) then begin
    //Password := IntToStr(Random(100,999)); - it used to make a new password, but I've changed it to just show the current one
    //Command('/password '+Password);
    WriteConsole(0,'Current password is '+Password,ClMessage);
  end
  else if (MaskCheck(lowercase(Text),'!map*')) then begin
    Map := GetPiece(Text,' ',1);
    if (FileExists('maps/'+Map+'.PMS')) then
      Command('/map '+Map)
    else
      WriteConsole(0,'Map '+Map+' not found!',ClMessage);
  end
  else if (MaskCheck(lowercase(Text),'!random')) then
    if (FileExists('mapslist.txt')) then begin
      Mapslist := Split(ReadFile('mapslist.txt'),chr(13)+chr(10));
      Map := Mapslist[Random(0,Arrayhigh(Mapslist)+1)];
      Command('/map '+Map);
    end else
      WriteConsole(0,'Unable to choose a random map!',ClMessage)
  else if (MaskCheck(lowercase(Text),'!alpha')) then
    Command('/setteam1 '+IntToStr(ID))
  else if (MaskCheck(lowercase(Text),'!bravo')) then
    Command('/setteam2 '+IntToStr(ID))
  else if (MaskCheck(lowercase(Text),'!spec')) then
    Command('/setteam5 '+IntToStr(ID))
  else if (MaskCheck(lowercase(Text),'!help')) then begin
    WriteConsole(ID,'AutoGather Commands',ClMessage);
    WriteConsole(ID,'!pause, !p - Pauses the game',ClMessage);
    WriteConsole(ID,'!unpause, !p - Unpauses the game',ClMessage);
    WriteConsole(ID,'!restart, !r - Restarts the game',ClMessage);
    WriteConsole(ID,'!unbanlast, !ub - Unbans the last player banned',ClMessage);
    WriteConsole(ID,'!password, !pw - Shows the current server password',ClMessage);
    WriteConsole(ID,'!map <map> - Changes to the specified map',ClMessage);
    WriteConsole(ID,'!random - Chooses a random map',ClMessage);
    WriteConsole(ID,'!alpha, !bravo, !spec - Moves you to the specified team',ClMessage);
  end;
end;

spectators is still using these commands
I dont want it, I want only players can use it
Can you understand me? My english not good :(
I want, only alpha and bravo team can use it
Is there anybody can write script?
Good, go and play soldat ^^