Official Soldat Forums

Server Talk => Scripting Discussions and Help => Topic started by: |_ancer on April 16, 2009, 09:02:12 am

Title: Getting confused
Post by: |_ancer on April 16, 2009, 09:02:12 am
How do you make it when you type a commands like !commands or /help to show a list. I tried to make one but it never seems to show up.
Title: Re: Getting confused
Post by: GSx_Major on April 16, 2009, 09:24:12 am
Code: [Select]
procedure OnPlayerSpeak(ID: Byte; Text: String);
begin

  // Help
  if Text = '!commands' then begin
    WriteConsole(ID, 'Commands:', RGB(255, 255, 255));
    WriteConsole(ID, '!alpha', RGB(255, 255, 255));
    WriteConsole(ID, '!bravo', RGB(255, 255, 255));
  end;

  // Commands
  if Text = '!alpha' then Command('/setteam1 ' + IntToStr(ID));
  if Text = '!bravo' then Command('/setteam2 ' + IntToStr(ID));
end;
Title: Re: Getting confused
Post by: ~Niko~ on April 16, 2009, 12:30:17 pm
Huh.. what u wrote definitively will help me to do another script :P
Title: Re: Getting confused
Post by: CurryWurst on April 16, 2009, 12:54:17 pm
Done. Modify or add commands & rules by altering the specific text file.
The commands and rules list will be aligned by the script, so no scripting knowledge is required :)
By the way, I implemented my default LogInSystem commands list, I hope you don't mind.
Title: Re: Getting confused
Post by: |_ancer on April 16, 2009, 08:11:24 pm
Hmm that helped me but I'm wanting for /commands then it shows up. Not !commands because I want to keep it a secret thing.
Title: Re: Getting confused
Post by: y0uRd34th on April 17, 2009, 04:43:02 am
Code: [Select]
function OnPlayerCommand(ID: Byte; Text: String): Boolean;
begin
  Result := False;
  // Help
  if Text = '/commands' then begin
    WriteConsole(ID, 'Commands:', RGB(255, 255, 255));
    WriteConsole(ID, '/alpha', RGB(255, 255, 255));
    WriteConsole(ID, '/bravo', RGB(255, 255, 255));
  end;

  // Commands
  if Text = '/alpha' then Command('/setteam1 ' + IntToStr(ID));
  if Text = '/bravo' then Command('/setteam2 ' + IntToStr(ID));
end;
NOT TESTET

Should Work.
Title: Re: Getting confused
Post by: CurryWurst on April 17, 2009, 06:25:57 am
Hmm that helped me but I'm wanting for /commands then it shows up. Not !commands because I want to keep it a secret thing.

My script actually does that.