Ok, as I suspected, the ratio hud was a mess, so I wrote a test script in order to see what was crashing the server. And it was that you can't divide 0 by a 0. Below is the test script I wrote. I have no idea exactly what you are trying to do, so I just updated the value every frame. Obviously, you change that to suit your purposes. But the method is sound - don't update the value while self.ratio is zero (otherwise it throws an error) and only apply a division once both self.score and self.deaths are defined.
This is what I ended up with:
Code:
init()
{
level thread onPlayerConnect();
}
onPlayerConnect()
{
for( ;; )
{
level waittill( "connected", player );
player thread onPlayerSpawned();
player thread onPlayerKilled();
}
}
onPlayerSpawned()
{
self endon( "disconnect" );
for( ;; )
{
self waittill( "spawned_player" );
self thread ratio();
}
}
onPlayerKilled()
{
self endon( "disconnect" );
for( ;; )
{
self waittill( "killed_player" );
if( isDefined( self.ratiohud ) )
self.ratiohud destroy();
}
}
ratio()
{
self endon( "killed_player" );
self endon( "disconnect" );
if( isDefined( self.ratiohud ) ) self.ratiohud destroy();
if( !isDefined( self.ratiohud ) )
{
self.ratiohud = newClientHudElem( self );
self.ratiohud.vertAlign = "fullscreen";
self.ratiohud.horzAlign = "fullscreen";
self.ratiohud.alignX = "left";
self.ratiohud.alignY = "middle";
self.ratiohud.x = 25;
self.ratiohud.y = 474;
self.ratiohud.sort = 1;
self.ratiohud.alpha = 1;
self.ratiohud.fontScale = 0.8;
self.ratiohud.archived = true;
self.ratiohud.label = (game["ratio"]);
self.ratiohud setValue( 0 );
}
for( ;; )
{
wait( 0.05 );
self.ratio = self getRatio();
if( !isDefined( self.ratio ) )
continue;
else
{
if( isDefined( self.ratiohud ) )
self.ratiohud setValue( self.ratio );
}
}
}
getRatio()
{
value = undefined;
if( !self.score && !self.deaths )
value = 0;
else if( self.score && !self.deaths )
value = self.score;
else if( self.score && self.deaths )
value = ( self.score / self.deaths );
return( value );
}
Once you've got your hud working, you can then move on to using the file functions.