Author Topic: AutoGather only for players  (Read 1063 times)

0 Members and 1 Guest are viewing this topic.

Offline SneS

  • Soldier
  • **
  • Posts: 112
AutoGather only for players
« on: December 02, 2012, 06:09:16 am »
thanks!
« Last Edit: December 10, 2012, 07:32:08 am by SneS »

Offline TheOne

  • Soldier
  • **
  • Posts: 208
Re: AutoGather only for players
« Reply #1 on: December 02, 2012, 10:02:48 am »
Ah, we didn't reply to your other post.
You might want some of those commands to work for spectators as well though.
Like this:

Players only:
!p, !up, !r, !ub, !pw, !map, !random

All clients:
!alpha, !bravo, !spec, !help


In that case, replace the procedure "OnPlayerSpeak" in the file "Autogather.pas" with this:

Code: [Select]
procedure OnPlayerSpeak(ID: Byte; Text: string);
var
Map: string;
Mapslist: TStringArray;
begin
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
else if GetPlayerStat(ID, 'Team') < 5 then
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);
end;
end;

Offline SneS

  • Soldier
  • **
  • Posts: 112
Re: AutoGather only for players
« Reply #2 on: December 02, 2012, 12:09:28 pm »
Thanks, it works! ;)

Offline MrHamsTR

  • Soldier
  • **
  • Posts: 209
  • One day, everything will end..
Re: AutoGather only for players
« Reply #3 on: December 31, 2012, 03:58:27 pm »
How? I can't understand anything :(
Is there anybody can write script?
Good, go and play soldat ^^