Author Topic: [SOLVED] I can't find any mistakes here.  (Read 669 times)

0 Members and 1 Guest are viewing this topic.

Offline utkesmer

  • Major(1)
  • Posts: 44
[SOLVED] I can't find any mistakes here.
« on: April 19, 2011, 04:20:23 pm »
-----

_ Script _

Code: [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
begin

 if ( GetPiece(LowerCase(Text), ' ', 0 ) = '!ping' ) then begin

      WriteConsole(0, IDToName(ID)+' [Ping]: '+GetPlayerStat([b]GetPiece(Text, ' ', 1 )[/b], 'Ping' ), RGB(255,215,0) );

 end;

end;

_ ConsoleLog _

Code: [Select]
11-04-20 00:03:59    Console Log Started
11-04-20 00:03:59 Welcome to Soldat 1.5.0
11-04-20 00:03:59  [*] ScriptCore v2.6 loaded! Found 2 scripts...
11-04-20 00:03:59  [*] Compiling default -> Core.pas...
11-04-20 00:03:59  [*] Compiling default -> NetworkCore.pas...
11-04-20 00:03:59  [*] Compiling default -> AdminCore.pas...
11-04-20 00:03:59  [*] Compiling asd -> asd.pas...
11-04-20 00:03:59  [*] asd -> [Error] (7:113): [b]Type mismatch[/b]
11-04-20 00:03:59  [*] Compilation Failed.
11-04-20 00:03:59 Shutting down server...
11-04-20 00:03:59 Shutting down admin server...
11-04-20 00:03:59 Shutting down ScriptCore...

-----

If I edit the script like below, it is working.

Code: [Select]
procedure OnPlayerSpeak(ID: byte; Text: string);
begin

 if ( GetPiece(LowerCase(Text), ' ', 0 ) = '!ping' ) then begin

      WriteConsole(0, IDToName(ID)+' [Ping]: '+GetPlayerStat([b]1[/b], 'Ping' ), RGB(255,215,0) );

 end;

end;

-----

Code: [Select]
GetPlayerStat(GetPiece(Text, ' ', 1 ), 'Ping' )
So, why is this statement above not true?

Thanks, Utku.
« Last Edit: April 20, 2011, 06:49:13 am by utkesmer »

Offline Boblekonvolutt

  • Soldier
  • **
  • Posts: 222
  • "YOU are a CAR."
Re: I can't find any mistakes here.
« Reply #1 on: April 19, 2011, 04:25:46 pm »
function GetPlayerStat(ID: byte; Stat: string): Variant

What you're providing for ID is not a number, it's a string. You will need to use StrToInt and IntToStr.

Offline utkesmer

  • Major(1)
  • Posts: 44
Re: I can't find any mistakes here.
« Reply #2 on: April 20, 2011, 06:48:45 am »
Thanks.