Author Topic: Game Mode crashing  (Read 2175 times)

i've been trying to get this to work for about an hour now

Code: [Select]
function Disease_enterHelicopter(%player)
{
%client = %player.client;

if(!isObject(%client))
{
return;
}

if(%player.isInfected)
{
centerPrint(%client, "Infected cannot enter the helicopter!", 2);
return;
}

echo("doing message");
MessageAll('', "\c3" @ %client.name @ " \c0has entered the helicopter!");
echo("doing points");
%client.addScore(4, "Surviving the disease");

echo("playing sound");
ServerPlay3D(Disease_Sound_note_haunt, %player.getHackPosition());
echo("deleting player");
%player.delete();
echo("doing camera");
%camera = %client.camera;
%camera.setFlyMode();
%camera.mode = "Observer";
%client.setControlObject(%camera);

echo("checking for end");
Disease_checkForEnd();
}

the last thing echoed is "doing camera" and the game crashes
« Last Edit: March 05, 2014, 06:55:49 PM by Subpixel »

Try deleting the player after you do the camera stuff.

Try deleting the player after you do the camera stuff.
It worked when I was alone on the server.

But when swollow was on and did it, it echoed "deleting player" and crashed.

But when swollow was on and did it, it echoed "deleting player" and crashed.
I don't understand why it does that.


Comment out the serverPlay3D temporarily, just so we can verify it's not because of that.

run trace at the same time you echo

run trace at the same time you echo
I'll try tracing and removing ServerPlay3D.

I've had cases where a line would not appear in console.log if the crash was close after an echo. I'd always have it open the console window and then check what the last line is when windows displays the crash popup

After testing and seeing the entire function is being called, I believe this might be the problem in the package:
Code: [Select]
%this == helicopter.getID()
I belive it may be causing problems sometimes if %this decides to be the name string or something. I changed it to %this.getName() $= "helicopter", testing it now...

So you didn't post all the related code?

I've had cases where a line would not appear in console.log if the crash was close after an echo.

setLogMode(1);

It started happening again wtfffFFFFF

Code: [Select]
function Disease_enterHelicopter(%player)
{
if(!isObject(%player))
{
return;
}
%client = %player.client;

if(!isObject(%client))
{
return;
}

if(%player.isInfected)
{
centerPrint(%client, "Infected cannot enter the helicopter!", 2);
return;
}

echo("doing message");
MessageAll('', "\c3" @ %client.name @ " \c0has entered the helicopter!");
echo("doing points");
%client.addScore(4, "Surviving the disease");

//echo("playing sound");
//ServerPlay2D(Disease_Sound_note_page);
echo("doing camera");
%camera = %client.camera;
%pos = getWords(helicopter.getTransform(), 0, 2);
%pos = VectorAdd(%pos, "16.3826 -14.974 9.4074");
%camera.setTransform(%pos SPC "0.274232 0.114423 -0.954832 0.823959");
//%camera.setFlyMode();
%camera.setClampMode(helicopter, "16.3826 -14.974 9.4074");
//%camera.mode = "Observer";
%client.setControlObject(%camera);
echo("deleting player");
%player.delete();

echo("checking for end");
Disease_checkForEnd();
}

I literally didn't change any code since yesterday and it just started to happen again.

The game just crashed when the minigame reset. Here is the code, ::reset was called when it crashed

Code: [Select]
function MinigameSO::scheduleReset(%this, %time)
{
if($Disease::Resetting)
{
return;
}
$Disease::Resetting = true;
if(!%time)
{
%time = 10000;
}
Parent::scheduleReset(%this, %time);
Disease_onRoundEnd();
}

function MinigameSO::reset(%this, %client)
{
Parent::reset(%this, %client);
$Disease::Resetting = false;
Disease_removeHelicopter();
Disease_onStart();
Disease_LoadPlayerScores();
}

All the Disease_ functions can be called without issues.

Maybe create a schedule for it? Like 1000ms?