38 lines
6.5 KiB
Plaintext
38 lines
6.5 KiB
Plaintext
#using scripts\codescripts\struct;
|
|
|
|
#using scripts\shared\callbacks_shared;
|
|
#using scripts\shared\system_shared;
|
|
|
|
|
|
|
|
#namespace clientids;
|
|
|
|
function autoexec __init__sytem__() { system::register("clientids",&__init__,undefined,undefined); }
|
|
|
|
function __init__()
|
|
{
|
|
callback::on_start_gametype( &init );
|
|
callback::on_connect( &on_player_connect );
|
|
}
|
|
|
|
function init()
|
|
{
|
|
// this is now handled in code ( not lan )
|
|
// see s_nextScriptClientId
|
|
level.clientid = 0;
|
|
}
|
|
|
|
function on_player_connect()
|
|
{
|
|
self.clientid = matchRecordNewPlayer( self );
|
|
if ( !isdefined( self.clientid ) || self.clientid == -1 )
|
|
{
|
|
self.clientid = level.clientid;
|
|
level.clientid++; // Is this safe? What if a server runs for a long time and many people join/leave
|
|
}
|
|
|
|
/#
|
|
PrintLn( "client: " + self.name + " clientid: " + self.clientid);
|
|
#/
|
|
}
|
|
|