If you knew the ID of the schedule, you could.
Of course you could set the schedule on a $global variable as well if you're not using it on some object or whatever.
i still cant get it to work... what am i doing wrong?
it works in which if you go outside the mission area it will kill you, but i cant get it to turn off...
maybe if i do $area instead of %mission?
and what is the second number for schedule(Timeinms, whatsthisfor, "function", %args, %otherargs);
//==============================================================================
//
// By: BlitzTorque
// Locks The Mission Area
//==============================================================================
function ccLockArea(%sender){
if (!%sender.isadmin){
messageclient(%sender, 'MsgClient', "\c2Admins only.");
return;
}
%mission = MissionArea;
if(%mission.isLocked){
%mission.isLocked = false;
messageall('MsgAdminForce', "\c5"@%sender.namebase SPC "\c2 has unlocked the mission area");
cancel(%mission.timer);
return;
}
else{
%mission.isLocked = true;
messageall('MsgAdminForce', "\c5"@%sender.namebase SPC "\c2 has locked the mission area");
lookforplayers();
}
}
function lookforplayers(){
for(%i=0;%i<ClientGroup.getCount();%i++){
%client = ClientGroup.getObject(%i);
//schedule(500, 0, "lookforplayers", %client);
if(isObject(%client.player)){
if(%client.outOfBounds){
%client.player.scriptKill($DamageType::OutOfBounds);
messageall('AdminForce', "\c3"@%client.namebase SPC "\c2walked stepped outside the safe-zone");
}
}
}
%mission.timer = schedule(500, 0, "lookforplayers");//schedule(500, 0, "lookforplayers");//, %client);
}
Well for starters, the %mission in your lookforplayers() function is undefined.
If all you want to do is make a regular schedule loop stop, all you had to do was stick something like "if (!$LockedArea) return;" at the top of the function you had looping.
It seems like you're taking the nasa route for something that would otherwise be just a simple add, sticking a bit in DefaultGame::leaveMissionArea
function DefaultGame::leaveMissionArea(%game, %playerData, %player)
{
if(%player.getState() $= "Dead")
return;
[b]if ($LockedArea) {
%player.scriptKill($DamageType::OutOfBounds);
messageall('AdminForce', "\c3"@%client.namebase SPC "\c2stepped outside the safe-zone.");
return;
}[/b]
%player.client.outOfBounds = true;
messageClient(%player.client, 'LeaveMissionArea', '\c1You left the mission area.~wfx/misc/warning_beep.wav');
}
Comments
if i am just using schedule(blah, "functionblah", %blah);
would i just use cancel(schedule)?
Of course you could set the schedule on a $global variable as well if you're not using it on some object or whatever.
it works in which if you go outside the mission area it will kill you, but i cant get it to turn off...
maybe if i do $area instead of %mission?
and what is the second number for schedule(Timeinms, whatsthisfor, "function", %args, %otherargs);
If all you want to do is make a regular schedule loop stop, all you had to do was stick something like "if (!$LockedArea) return;" at the top of the function you had looping.
It seems like you're taking the nasa route for something that would otherwise be just a simple add, sticking a bit in DefaultGame::leaveMissionArea
i tried a $lockarea instead of $lockedarea but instead of putting if(!$lockarea) return;
i put if($lockarea = false) return; why didnt that work?
gotta love logic and booleans