function GameConnection::spawnPlayer(%this) {
[irrelevant code]
$LoadingBricks_BrickGroup = %this.brickgroup;
$LoadingBricks_Client = %this;
$LoadingBricks_ColorMethod = 3;
$LoadingBricks_DoOwnership = false;
$LoadingBricks_FileName = "Add-Ons/Gamemode_Numb3rs/bls/station.bls";
$LoadingBricks_Silent = true;
$LoadingBricks_StartTime = getSimTime();
$loadOffset = %xpos SPC %ypos SPC %zpos;
ServerLoadSaveFile_Start($LoadingBricks_FileName);
return parent::spawnPlayer(%this);
}
function fxDTSBrick::onLoadPlant(%this) {
parent::onLoadPlant(%this);
// not everything is set automatically
%this.schedule(50,renameNumbersBrick);
}
function fxDTSBrick::renameNumbersBrick(%this) {
//only works on SP for whatever reason
//%client = %this.client;
if(%client $= "") {
%group_name = %this.getGroup().getName();
%client = findClientByBL_ID(getSubStr(%group_name,stripos(%group_name,"_")+1,strLen(%group_name)));
}
[irrelevant code]
When bricks are loaded by the first part of the code in Single Player, I can use %client = %this.client to get the client from the loaded brick. On internet/dedicated servers, I can't do this, it's "-1" for everything.
I have to resort to grabbing the brickgroup the brick is in and do string manipulation on the name of said brickgroup, then find the client via the BL_ID obtained from the group name. This works on everything fine, but it seems completely unnecessary.
Is there a reason for everything loaded being "-1" on internet/dedicated servers?
EDIT: It's actually a bigger issue now with clients using the same IDs, stuff.