Ja stgimmt, wenn man es so definert! fehler meinerseits! sry
So Code wurde leicht verändert und wird jetzt getestet:
Delphi-Quellcode:
function GetTSSpeaker : pchar;
Function DisplayResult( Res : Integer ) : Boolean;
Var
ErrorMessage:
array[0..1023]
of Char;
begin
if res = 0
then
begin
//Writeln('OK');
Result := True;
exit;
end
else
begin
tsrGetLastError(@ErrorMessage, SizeOf(ErrorMessage));
Result := False;
end;
end;
function DoGetPlayers : boolean;
var
PlayersInfo :
Array[0..1023]
of TtsrPlayerInfo;
Records : Integer;
I : integer;
begin
result := true;
Records := 1024;
try
DisplayResult(tsrGetPlayers(@playersInfo, @records) );
setlength(Player,records);
if records > 0
then
begin
for I := 0
to Records - 1
do
begin
PLayer[i].id := PlayersInfo[i].PlayerID;
Player[i].
Name := PlayersInfo[i].NickName;
end;
result := true;
end;
except
On E :
Exception Do
begin
hLog.AddException(E);
exit;
end;
end;
// End Try Abschnitt
end;
function DoGetSpeakers : pchar;
var
IDs :
Array[0..1023]
of Integer;
Records : Integer;
I , u: integer;
PlayersInfo :
Array[0..1023]
of TtsrPlayerInfo;
ID : integer;
begin
result := '
';
Records := 1024;
try
DisplayResult(tsrGetSpeakers(@playersInfo, @records) );
//if Records > 0 then ;
for I := 0
to Records - 1
do
for u := 0
to high(Player)
do
if Player[u].id = PlayersInfo[i].PlayerID
then
begin
result := pchar(player[u].
Name);
break;
end;
except
On E :
Exception Do
hLog.AddException(E);
end;
//Ende Try Abschnitt
end;
begin
result := '
';
if DOGetPlayers
then
try
result := DogetSpeakers;
except
On E:
Exception Do
hLog.AddException(E,'
Function GetTSSpeaker', []);
end;
end;