Author Topic: How to cancel %v.player.kill();  (Read 3145 times)

because player.client.killSchedule is the scheduleID of the 30-second player.kill event.

when the player spawns, client.killSchedule is cancelled.
Setting a function in a schedule does not prevent it from being called.

Oh by the way you have a syntax error.

Also that schedule is placed on the client, then you're cancelling it from the player.

To start the timer:
%obj.killSchedule = %obj.schedule( 90000, "kill" );

To stop the timer:
cancel( %obj.killSchedule );

To check if the timer is active:
if ( isEventPending( %obj.killSchedule ) )
{
        ...
}


%obj is the player object.
« Last Edit: September 03, 2012, 06:07:40 AM by Port »

Also that schedule is placed on the client, then you're cancelling it from the player.
because the playerobject deletes itself after death

Shouldn't it be setting the schedule when you spawn and cancelling it when you get in the vehicle?

Let me explain.

The guy is on a 90 second timer, right?

When he enters the vehicle, I want that timer to be stopped.

That's what I want.

Shouldn't it be setting the schedule when you spawn and cancelling it when you get in the vehicle?

oh

They never told me what variables were in Blockland TorqueScript.

I need to know that, seriously.
« Last Edit: September 12, 2012, 08:40:55 PM by Deoxys And One Noob »

Sorry for double post, but...

Code: [Select]
if(!isObject(%client.minigame))
    return;

function Armor::OnDismount(%client,%v, %obj)
{
%client = findClientByName();
%v.player.kill();

for (%v = %v.player.kill(); %v.player.kill = schedule('30'); %v++)
{
return %v;
}

}

function GameConnection::spawnPlayer()
{
GameConnection::SpawnPlayer(schedule('30',%v.player.kill();));

for (%v = Armor::onMount(); $Player::DamageTake(0); %v++)
{
return %v;
}
}

Is this good?

the Class::functionname syntax is only used for actually declaring the function, not when calling it.  You would want to put that in a package, make sure to have all your arguments, parent it, then do the schedult on the player.

I had to unpackage it so that I can make the if work.

Oh. Then how do I make the player invincible? I can parent it, yes. Let me just fix it up a little.

Code: [Select]
if(!isObject(%client.minigame))
    return;

function Armor::OnDismount(%client,%v, %obj)
{
parent::Armor::OnDismount()

%client = findClientByName();
%v.player.kill();

for (%v = %v.player.kill(); %v.player.kill = schedule('30'); %v++)
{
return %v;
}

}

function GameConnection::spawnPlayer(%this, %obj)
{
parent::GameConnection::SpawnPlayer(schedule('30',%v.player.kill();));

for (%v = Armor::onMount(); $Player::DamageTake(0); %v++)
{
return %v;
}
}

I had to unpackage it so that I can make the if work.

Oh. Then how do I make the player invincible? I can parent it, yes. Let me just fix it up a little.

Code: [Select]
if(!isObject(%client.minigame))
    return;

function Armor::OnDismount(%client,%v, %obj)
{
parent::Armor::OnDismount()

%client = findClientByName();
%v.player.kill();

for (%v = %v.player.kill(); %v.player.kill = schedule('30'); %v++)
{
return %v;
}

}

function GameConnection::spawnPlayer(%this, %obj)
{
parent::GameConnection::SpawnPlayer(schedule('30',%v.player.kill();));

for (%v = Armor::onMount(); $Player::DamageTake(0); %v++)
{
return %v;
}
}

This stuff honestly makes no sense. Tell me as well as you can, what you are trying to do, from start to end.

This stuff honestly makes no sense. Tell me as well as you can, what you are trying to do, from start to end.


Let me explain.

The guy is on a 30 second timer, right?

When he enters the vehicle, I want that timer to be stopped.

When he cheats and exits the vechicle, I want him to be killed after 30 seconds.

That's what I want.

This should do it, though I haven't tested it, I'm leaving that up to you.

Code: [Select]
package Deoxy
{
function Armor::OnDismount(%this,%player,%object)
{
%p = parent::OnDismount(%this,%player,%obj);

%client = %player.client;
%client.killTimer = %player.schedule(%client.timeRemaining,kill);
echo("Restarting kill timer for "@%client.name@" ("@%client.timeRemaining@")");
%client.timeRemaining = "";

return %p;

}

function armor::onMount(%this,%player,%object)
{
%p = parent::onMount(%this,%player,%object);

%client = %player.client;
%client.timeRemaining = getTimeRemaining(%client.killTimer);
cancel(%client.killTimer);
echo("Stopping kill timer for "@%client.name@" ("@%client.timeRemaining@")");

return %p;
}

function gameConnection::spawnPlayer(%this)
{
%p = parent::spawnPlayer(%this);

%this.killTimer = %obj.schedule(30000,kill);
echo("Starting kill timer for "@%this.name@" (30 seconds)");

return %p;
}
};
activatePackage(Deoxy);