nein nicht so ganz!? hier mein code:
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;
if not DisplayResult(tsrGetPlayers(@playersInfo, @records) ) then ;
if Records > 0 then
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;
end;
function DoGetSpeakers : pchar;
var
IDs : Array[0..1023] of Integer;
Records : Integer;
I: integer;
PlayersInfo : Array[0..1023] of TtsrPlayerInfo;
ID : integer;
begin
result := '';
Records := 1024;
if not DisplayResult(tsrGetSpeakers(@playersInfo, @records) ) then exit;
if Records > 0 then ;
for I :=0 to Records-1 do
ID := PlayersInfo[i].PlayerID ;
for i:= 0 to high(Player) do
if Player[i].id = Id then
result := pchar(player[i].Name);
end;
begin
result := '';
if DOGetPlayers then
result := DogetSpeakers;
end;