Author Topic: Colored Admin Messages  (Read 3429 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Colored Admin Messages
« on: May 31, 2007, 05:58:37 pm »
Script Name: Colored Admin Messages (and player notification)
Script Description: Whenever an admin does '/say ' and whatever text, it will display green on everybody's consoles as [NAME] MESSAGE, but if it is from the server, or an outside program, it will appear like [Server] MESSAGE. All message are shown in green if you use this script.
Original Author(s): Curt (DorkeyDear) (But too simple to be claimed by me)
Core Version: 2.6.0
Code:
Code: [Select]
function OnCommand(ID: Byte; Text: string): boolean;
var
  Name: string;
begin
  Result := false;
  if ID = 255 then Name := 'Server' else Name := GetPlayerStat(ID,'Name');
  if Copy(Text,1,5) = '/say ' then begin
    Result := true;
    WriteConsole(0,'[' + Name + '] ' + Copy(Text,6,Length(Text)),$FF52DD52);
  end;
  if GetPiece(Text,' ',0) = '/pm' then begin
    Result := true;
    try
      WriteConsole(StrtoInt(GetPiece(Text,' ',1)),'[PM] [' + Name + '] ' + Copy(Text,Length(GetPiece(Text,' ',1)) + 5,Length(Text)),$FF52DD52);
    except end;
  end;
end;

Go ahead and replace $FF52DD52 if you wish to change the color. A bunch of Soldat default colors may be found here.
« Last Edit: July 19, 2007, 07:17:17 pm by DorkeyDear »

Offline -Major-

  • Veteran
  • *****
  • Posts: 1419
Re: '/say ' abuser catcher (and colored text)
« Reply #1 on: June 01, 2007, 09:12:30 am »
you should show us in which procedure it shall be sorted in.
« Last Edit: June 01, 2007, 01:41:45 pm by -Major- »

Offline Zyyn

  • Major(1)
  • Posts: 21
Re: '/say ' abuser catcher (and colored text)
« Reply #2 on: June 01, 2007, 12:38:18 pm »
I'm pretty sure that this would go in the OnCommand function in the Core.pas, that is where I put it

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: '/say ' abuser catcher (and colored text)
« Reply #3 on: July 19, 2007, 07:18:16 pm »
forgot to copy that with it, its edited now

Date Posted: June 01, 2007, 03:39:16 PM
Update
  • Private messages are colored
  • Changed IDtoName to GetPlayerStat(ID,'Name')
  • Changed name from "'/say ' abuser catcher (with colored text)" to "Colored Admin Messages"

Offline Eldiablo

  • Major(1)
  • Posts: 22
    • Caffeine Killers Home Page
Re: Colored Admin Messages
« Reply #4 on: August 19, 2007, 07:20:21 pm »
Nice work Dorkey.
You've got some great stuff :]