Jump to content
14eFlorian

Players list in a RscListbox

Recommended Posts

Hi,
I want to display the list of player name in my rsclistbox and when I click on a player, I’m teleported to him.

This is my RscListbox (who is in my dialog named menu_teleport) :

        // List
        class listbox : RscListbox {
            idc = 11500;
            x = 0.314375 * safezoneW + safezoneX;
            y = 0.291 * safezoneH + safezoneY;
            w = 0.180469 * safezoneW;
            h = 0.396 * safezoneH;
        };

This is my playerteleport.sqf :

createDialog "menu_teleport";
{
	lbAdd [1500, name _x];
	lbSetData [1500, _forEachIndex, _x];
} forEach allPlayers;

I have a error :
Error Type Objet, String waited

I have done several tests with other functions but no player name is displayed (I made tests with unit names too and I have the same error). I understand that the variable is not good but how can I return a player name in string ?
I found several posts that had the same error but the given solutions don't work for me.

Do you have any idea?

Share this post


Link to post
Share on other sites
On 3/24/2024 at 6:39 PM, 14eFlorian said:

idc = 11500;

On 3/24/2024 at 6:39 PM, 14eFlorian said:

lbAdd [1500,

You are adding to the wrong idc.

 

 

On 3/24/2024 at 6:39 PM, 14eFlorian said:

Error Type Objet, String waited

This comes from the lbSetData, data can only be STRING you're trying to add an OBJECT _x.

Give the player a varName and use that instead.

lbSetData [11500, _forEachIndex, _x call BIS_fnc_objectVar];

To tele to them...

_player = lbData[ 11500, _index ];
player setPosATL getPosATL ( missionNamespace getVariable _player );

 

Share this post


Link to post
Share on other sites

Thanks for your answer, it works perfectly.

And for the IDC, it was a bad copy paste (I have 2 dialog) 😀

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×