Author Topic: what is the problem here?  (Read 623 times)

0 Members and 1 Guest are viewing this topic.

Offline addict

  • Major(1)
  • Posts: 19
what is the problem here?
« on: October 12, 2007, 02:02:28 pm »

procedure OnPlayerSpeak(ID: byte; Text: string);
begin
if Text = !blue then Command('/setteam2 ID')
end;

the erroe is 4:11 Syntax Error

  • Compiling ben -> ben.pas...
  • ben -> [Error] (4:11): Syntax error
  • ben -> [Error] (4:11): Syntax error

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: what is the problem here?
« Reply #1 on: October 12, 2007, 02:07:27 pm »
it should be
Quote
procedure OnPlayerSpeak(ID: byte; Text: string);
begin
if Text = '!blue' then Command('/setteam2 ' + InttoStr(ID));
end;
I tried to bold the things that have changed..
' (single quote)s must go around strings you specify
ID is the datatype byte, which is not a string.. which is what the argument / parameter of Command needs, so it must be changed through InttoStr(...) which also works with other datatypes relating to numbers, although not any sort of floats (decimals)
« Last Edit: October 12, 2007, 02:09:12 pm by DorkeyDear »