The online racing simulator
I think you're looking at the wrong packet. You should be looking at the definition for IS_BTN:

struct IS_BTN // BuTtoN - button header - followed by 0 to 240 characters
{
byte Size; // 12 + TEXT_SIZE (a multiple of 4)
byte Type; // ISP_BTN
byte ReqI; // non-zero (returned in IS_BTC and IS_BTT packets)
[b]byte UCID; // connection to display the button (0 = local / 255 = all)[/b]

byte ClickID; // button ID (0 to 239)
byte Inst; // some extra flags - see below
byte BStyle; // button style flags - see below
byte TypeIn; // max chars to type in - see below

byte L; // left : 0 - 200
byte T; // top : 0 - 200
byte W; // width : 0 - 200
byte H; // height : 0 - 200

// char Text[TEXT_SIZE]; // 0 to 240 characters of text
};

In the code example you posted you have set the UCID to 255, which means it's displayed to all the players on a host. You need to set it to the specific UCID of the player you want to display the button to.

Note: the UCID is not included in the IS_SPX packet, you need to use the PLID to get that players IS_NPL packet, which contains their UCID.
Quote from DarkTimes :In the code example you posted you have set the UCID to 255, which means it's displayed to all the players on a host. You need to set it to the specific UCID of the player you want to display the button to.

Note: the UCID is not included in the IS_SPX packet, you need to use the PLID to get that players IS_NPL packet, which contains their UCID.

I would also be good if the program interface had a hash table of information for you to use. So you could do getUserUcidByPlid(int Plid); and it would return their UCID.
ill test it and ill see if i can come up with a solution
Quote from Dygear :I would also be good if the program interface had a hash table of information for you to use. So you could do getUserUcidByPlid(int Plid); and it would return their UCID.

My memory of LFS_External is that you cannot do this, as for some unfathomable reason the packets are designed in a way that you cannot use them in hashtables. You need to create a player class, fill it with data yourself, store it in an array and iterate over it every time you want to figure anything out. I think I uninstalled LFS_External after realising this. I don't think anything has changed since then... Note: hashtables are known as dictionaries in C#.

Quote from Azzano62 :ill test it and ill see if i can come up with a solution

I already posted the solution.
Quote from DarkTimes :My memory of LFS_External is that you cannot do this, as for some unfathomable reason the packets are designed in a way that you cannot use them in hashtables. You need to create a player class, fill it with data yourself, store it in an array and iterate over it every time you want to figure anything out.

Well that sucks. Can't you just make one based off your own internal id, and then reference that? On each packet that contains a PLID or UCID update the instance of the players class based off the information within the packet. So on each MCI you would get the players X, Y, and Z for example, that information would be placed in the class.

[digression]
I wonder if anyone really understands why PLID and UCID exists ... I mean, really! Think about that for a second. The only reason we are exposed to both is because of PLID is for the PLayerId, and UCID is the UsersCarID. The only reason we have to have both is because of the Take Over Car (IS_TOC) packet.

In the InSim program side of things, it would be a good idea to keep these values also in two separate areas of memory, but cross reference each other.
[/digression]

The Global ID, that I'll refer to as just the id, of the client should then be used as a point of reference for all information gathering activities.

native get_user_uname(id);
native get_user_pname(id);

There should also be a way to get a list of player ids, in the form of an array. Where Connected get's all of the currently connected player Ids, and Spectators only gets the ids of the clients who are in the server but not racing. Get Drivers would return all of the Ids for the clients with cars attached to their name who are on track.

native get_connected();
native get_spectators();
native get_drivers();

From there it should be fairly simple to iterate over this information.

public listDriversInChat() {
new aDrivers[65] = get_connected();

for (new i = 0; aDrivers[i] != 0; i++)
print_chat(0, "%s", get_user_uname(aDrivers[i]));

return PLUGIN_CONTINUE;
}


FGED GREDG RDFGDR GSFDG