Yes, new players will need the unique id of the past players. I don't remember how locoweeds was doing it, but the way i'm doing it works quite well. Here's how:
New client connected function:
Code:
function server_called()
{
//if new player connected
if((event_type == event_join) && (people_connected < 8))
{
ifdef server;
// old_pconnected = people_connected;
people_connected += 1; //another person connected
sleep(2);
send_var(people_connected); //send number of people connected
endif; //ifdef server
}
//if player disconnected
if(event_type == event_leave)
{
ifdef server;
people_connected -= 1; // one less person connected to server
sleep(2);
send_var(people_connected); // send number of people connected
endif;
}
}
on_server = server_called; // server called
Now, on the top of the function for your entity which contains the unique id:
Code:
if(people_connected == 1){mkart1 = me; my.kart_point = 1;}
if(people_connected == 2){mkart2 = me; my.kart_point = 2;}
if(people_connected == 3){mkart3 = me; my.kart_point = 3;}
if(people_connected == 4){mkart4 = me; my.kart_point = 4;}
if(people_connected == 5){mkart5 = me; my.kart_point = 5;}
if(people_connected == 6){mkart6 = me; my.kart_point = 6;}
if(people_connected == 7){mkart7 = me; my.kart_point = 7;}
if(people_connected == 8){mkart8 = me; my.kart_point = 8;}
In the while loop of your entities on the server.
Code:
if(new_sends != people_connected){client_new += 1*time;}
if(new_sends != people_connected)&&(client_new > 160){client_new = 0; new_sends += 1; send_skill(my.kart_point, send_all); send_skill(my.tracekart, send_all);send_skill(my.wheelkart, send_all);}
To sum it up, when an entity first connects, the people_connected variable goes up by one. You then send this variable to all existing clients. Now, on the new client that just connected you set it's unique id by the existing value of people_connected. In other words, if people_connected is 2, then the new client entity will be id#2.
Now that you've set this skill, you must have some commands for it to send the skill when a new player joins, otherwise only existing players will contain this skill. So that's why you put that code in the while loop on the server, that detects when a new client joins, then it resends all the important skill information(pointers, id, ect.) to the newly joint entity.
Theres probably many ways to do this... but no matter what your doing, you have to make sure you have a little bit of code in each entity function that will automatically update all the new clients of important skills ect. when they join.