Author Topic: Force Light to Delete onClientLeaveGame  (Read 1670 times)

I want to make sure the player's light is deleted when he/she leaves the server.

Here's what I've got so far:
Code: [Select]
package DeleteLight
{
function GameConnection::OnClientLeaveGame(%client)
{
%player = %client.player;
%player.light.delete();
Parent::OnClientLeaveGame(%client);
}
};
Code: [Select]
function PhysicsDeathVehicle::onDriverLeave(%this,%obj,%player)
{
if(isObject(%player))
{
%player.dismount();
%player.unMountImage(1);
%player.light.delete();
}
%obj.schedule(10,delete);
}
The second part works fine, but the leave game one just doesn't seem to.

Code: [Select]
package my_package
{
function gameConnection::onClientLeaveGame( %this )
{
if ( isObject( %light = %this.player.light ) )
{
%light.delete();
}

parent::onClientLeaveGame( %this );
}
};

activatePackage( "my_package" );

Why are you doing this though? The default game code already deletes the light when a player's corpse disappears.

for some reason the default light deletion is not applying

for some reason the default light deletion is not applying

This indicates that you've done something wrong.


Perhaps it's time for a question megathread


Perhaps it's time for a question megathread
All created over the course of at least 1 month.

Did you do anything with lights or overwriting certain functions that would break this?