Author Topic: Another noob question lol:  (Read 703 times)

0 Members and 1 Guest are viewing this topic.

Offline AquaByrd

  • Soldier
  • **
  • Posts: 108
  • Lolwut?
Another noob question lol:
« on: January 22, 2009, 05:09:47 am »
So far I've got:

Code: [Select]
//Slaps selected player
Function OnCommand (ID: Byte; Text: string): boolean;
Begin
if GetPiece(Text,' ',0) = '/slap' then begin
          DoDamage(strtoint(GetPiece(Text,' ',1)),50);
     end;
End;

And I want to add a WriteConsole function to say to all the players that <player x> got slapped. How would I go about doing that?
My sig was 300 x 120, the maximum size is 300 x 125. Check next time will you.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Another noob question lol:
« Reply #1 on: January 22, 2009, 06:29:03 am »
Code: [Select]
//Slaps selected player
Function OnCommand (ID: Byte; Text: string): boolean;
Begin
   if GetPiece(Text,' ',0) = '/slap' then begin
          DoDamage(strtoint(GetPiece(Text,' ',1)),50);
          WriteConsole(0, 'Player ' + GetPlayerStat(strtoint(GetPiece(Text,' ',1)), 'Name') + ' got slapped!', $FFFFFFFF);
     end;
End;

although I suggest putting the player id into a variable sense ur calling StrtoInt and GetPiece both 2x on the same thing now.. (sry no time, gtg)

Offline AquaByrd

  • Soldier
  • **
  • Posts: 108
  • Lolwut?
Re: Another noob question lol:
« Reply #2 on: January 22, 2009, 06:33:39 am »
Ok, thanks man.
My sig was 300 x 120, the maximum size is 300 x 125. Check next time will you.