//Argument0 - New user's index
//Argument1 - New user's tcp port
if(!global.p_online[argument0])
{

dynamicaddline("Initializing new user...");
global.p_id[argument1] = argument0;           //Use this to find the player number of a tcp socket.
global.p_tcpsocket[argument0] = argument1;    //Use this to find the tcp socket of a player number.
global.p_ip[argument0] = lastinIP();
global.p_locip[argument0] = "0.0.0.0";
/*tempsocket = udpconnect(global.mainudpport, true);
if(tempsocket > -1)
{
  global.p_udpsocket[argument0] = tempsocket;
  global.p_udpport[argument0] = global.mainudpport;
}
else
{
  global.p_udpsocket[argument0] = udpconnect(7005, true);
  global.p_udpport[argument0] = 7005;
}*/
global.p_online[argument0] = 1;
global.p_name[argument0] = "UNDEFINED";
global.p_spr[argument0] = NaviStandD;
global.p_room[argument0] = Online_Command_Screen;
global.p_canduo[argument0] = 0;
global.p_induo[argument0] = 0;
global.p_watchable[argument0] = 0;
global.p_sendalarm[argument0] = 900;
global.p_logalarm[argument0] = 2700;

pindex_opt();

//Send the new user their player ID:
clearbuffer();
writebyte(6);
writebyte(argument0);
sendmessage(argument1);

//Send the new user their outgoing UDP port (TO server):
clearbuffer();
writebyte(7);
writeint(global.mainudpport);
sendmessage(argument1);

//Send the new user their incoming UDP port (TO client):
//This has been moved to be sent when the server recieves the client's
//local IP for alt login detection. (case 5)

//Send the new user the list of online players:
clearbuffer();
writebyte(9);
writebyte(global.pnum);
for(op = 0; op < global.pindex; op += 1)
{
if(global.p_online[op])
{
writebyte(op);
writebyte(global.p_uid[op]);
writestring(global.p_name[op]);
writeint(global.p_room[op]);
writebyte(global.p_canduo[rpid[ru]]);
writebyte(global.p_induo[rpid[ru]]);
writebyte(global.p_watchable[rpid[ru]]);
//dynamicaddline("[SENDING] User: " + string(op) + " User Name: " + global.p_name[op] + " Room: " + string(global.p_room[op]));
}
}
sendmessage(argument1);

//After the user gets these four bits of info, it will connect to the
//UDP socket on the given UDP socket port, and send its username to the
//server, and the server will then publicly recognize the user.


//global.pnum += 1;
//pindex_opt();

}