Am currently using the following code to build my userlist but the down side to this is it will loop names over and over making duplicate names so am having to do extra code to stop same names showing up in list so am wondering if there a more professional less resource and hassle code for building userlist for rooms or lobbys?
function TLobbyServer.GetLobbyUsers(const LobbyID: string): string;
var
i: Integer;
HostID: string;
begin
Result := '';
for i := 0 to (SocketServer.ClientCount -1) do
begin
if (CompareText(SocketServer.Client[i].Lobby, LobbyID) = 0) then
begin
HostID := '';
HostID := IntToStr(Integer(CompareText(SocketServer.Client[i].LobbyOwner, SocketServer.Client[i].Name) = 0));
//
Result := Result + 'š02œ' + LobbyID + 'œ' // lobby name
+ SocketServer.Client[i].Name + 'œ' // username
+ SocketServer.Client[i].Rank + 'œ' // current user rank (paid/free/staff)
+ SocketServer.Client[i].IconNumber + 'œ' // current Icon
+ SocketServer.Client[i].BIconNumber + 'œ' // custom paid icons
+ MBoolToStr(SocketServer.Client[i].IsLAFK) + 'œ' // away from keybored user
+ HostID + 'œ' // is lobby owner
+ SocketServer.Client[i].HasTrophy + 'œ'; // has won a nice shiney trophy
end;
end;
end;
thanks for the help