The online racing simulator
Updating InSim buttons
(5 posts, started )
Updating InSim buttons
Alright, so i'm just toying around again with programming in C# again, and I came across a roadbump.

I have a series of buttons, when User 1 clicks a button (I have it assigned to change the button to their username), but it seems only local, as in User 2, User 3 do not see the button which User 1's username is displayed on. Is this something that is incorrectly configured on my end or is it something that can not be done.

Many Thanks
-Dustin
#2 - PoVo
You have to send out the button with the other users UCID. Ill post a code when im on my PC.
#3 - PoVo
Here's the code you were looking for.

This should all be inside your BTC packet receive event.



<?php 
switch (BTC.ClickID)
{
     case 
26// <- CHANGE BUTTON ID
            
            // Select every connection in clsConnection
            
foreach (clsConnection C in Connections)
            {
                   
// Do a function to each of them in this case send the button 
                   
InSim.Send_BTN_CreateButton("" Connections[GetConnIdx(BTC.UCID)].PlayerNameFlags.ButtonStyles.ISB_LIGHT480635126/* <- CHANGE BUTTON ID*/C.UniqueID2false);
            }
               break;
}
?>

This should work well, just change the button ID's!
Or, setting the UCID to 255 when showing the button, will show it to everyone. Instead of sending it, say 20 times, if that's the average load of an averagely famous server, you'll only have to send it once.

Also, I don't know how right I am, but I think that "foreach" is kind of inefficient. At least, I'd preffer to do it like that(of course, only in case you _need_ to do it that way):


<?php 
switch (BTC.ClickID)
{
     case 
26// <- CHANGE BUTTON ID
          // Select every connection in clsConnection
          
for (int i 0Connections.Counti++)
          {
               
// Do a function to each of them in this case send the button 
               
InSim.Send_BTN_CreateButton(Connections[i].PlayerNameFlags.ButtonStyles.ISB_LIGHT480635126/* <- CHANGE BUTTON ID*/Connections[i].UniqueID2false);
          }
          break;

?>

There is some possibility that some things could be wrong in the code above, but I haven't been programming in C# for quite a while. What could be wrong: Well, mainly variable/class names, as I don't know lfs_external by heart that much.
Thanks guys, that did the trick.

Updating InSim buttons
(5 posts, started )
FGED GREDG RDFGDR GSFDG