Quote: "This is because disconnections close the network socket so it has to be cleaned up by deleting the old client, if the client reconnects it is assigned a new network socket so is given a new ID."
Do i understand that right? the ClientID just increases while clients join the server.
Sorry for my thread hijack.
My Server Code
ClientID=GetNetworkFirstClient(MP_NetworkID)
while ClientID<>0
if ClientID<>MP_MyClientID
if GetNetworkClientDisconnected(MP_NetworkID,ClientID)=1
if GetNetworkClientUserData(MP_NetworkID,ClientID,0)=1
DeleteNetworkClient(MP_NetworkID,ClientID)
SetNetworkClientUserData(MP_NetworkID,ClientID,0,0)
endif
else
if GetNetworkClientUserData(MP_NetworkID,ClientID,0)=0
SetNetworkClientUserData(MP_NetworkID,ClientID,0,1)
MessageID=CreateNetworkMessage()
AddNetworkMessageInteger(MessageID,NET_JOIN)
AddNetworkMessageInteger(MessageID,ClientID)
SendNetworkMessage(MP_NetworkID,0,MessageID)
for ID=1 to MP_MaxClientID
if GetNetworkClientUserData(MP_NetworkID,ID,0)=1 and ID<>ClientID
MessageID=CreateNetworkMessage()
AddNetworkMessageInteger(MessageID,NET_JOIN)
AddNetworkMessageInteger(MessageID,ID)
SendNetworkMessage(MP_NetworkID,ClientID,MessageID)
endif
next ID
endif
endif
endif
ClientID=GetNetworkNextClient(MP_NetworkID)
endwhile
My Client Code
ClientID=GetNetworkFirstClient(MP_NetworkID)
while ClientID<>0
if ClientID<>MP_MyClientID
if GetNetworkClientDisconnected(MP_NetworkID,ClientID)=1
if GetNetworkClientUserData(MP_NetworkID,ClientID,0)=1
DeleteNetworkClient(MP_NetworkID,ClientID)
SetNetworkClientUserData(MP_NetworkID,ClientID,0,0)
endif
endif
endif
ClientID=GetNetworkNextClient(MP_NetworkID)
endwhile
MessageID=GetNetworkMessage(MP_NetworkID)
while MessageID<>0
Option=GetNetworkMessageInteger(MessageID)
select Option
case NET_JOIN:
ClientID=GetNetworkMessageInteger(MessageID)
DeleteNetworkMessage(MessageID)
SetNetworkClientUserData(MP_NetworkID,ClientID,0,1)
endcase
endselect
MessageID=GetNetworkMessage(MP_NetworkID)
endwhile