Blockland Forums > Modification Help

Need some help please.

Pages: (1/2) > >>

sh0ckthealien:

Trying to make this Send a message every certain number of minutes.
Script executes, and Rtb Prefs load, and start/stop commands function. But other than that, it doesn't work. What am I doing wrong?


--- Code: ---function AnnounceTime_Loop()
{
cancel($AnounceTime::Loop);
if($AnounceTime::AnnounceTime < 1)
{
    $AnounceTime::AnnounceTime = 1;
        }
            $AnounceTime::Loop = schedule($AnounceTime::AnnounceTime * 60000,0,"AnnounceTime");
            AnnounceMsg();
}

function AnnounceMsg()
{
%aamsg = $Pref::Server::AutoAnnounce;
         messageAll('',"\c3 @ %aamsg @");
}


--- End code ---


Red_Guy:

Schedule takes these arguments:

schedule( delay, anchor, function, arg1, arg2 ....)

you have:
delay = $AnounceTime::AnnounceTime * 60000
anchor = 0
function = AnnounceTime

so where is your function named "AnnounceTime" ?

sh0ckthealien:

Okay now. Now the problem is, is it sends the message on /startaa and it does not loop.


--- Code: ---function AnnounceTime_Loop()
{
cancel($AnounceTime::Loop);
if($AnounceTime::AnnounceTime < 1)
{
   $AnounceTime::AnnounceTime = 1;
        }
            $AnounceTime::Loop = schedule($AnounceTime::AnnounceTime * 60000,0,"AnnounceTime");
}

function AnnounceTime()
{
%aamsg = $Pref::Server::AutoAnnounce;
         messageAll('',"\c3" @ %aamsg @ "\c3.");
}


function serverCmdStartAA(%client)

{
if(%client.isSuperAdmin)
{
cancel($AnounceTime::Loop);
$AnounceTime::Loop = schedule($AnounceTime::AnnounceTime * 60000,0,"AnnounceTime");
messageAll('',%client.getPlayerName() @ "\c3 has started the ***.");
}
else
{
messageClient(%client,'',"\c6Only \c0Super Admins\c3 may start the ***.");
}
}
--- End code ---


Red_Guy:

so now brown townyze whats going on.

you type: /startAA
 that calls serverCmdStartAA(%client)

.... then what gets called?


How is that different than what you want to happen.

sh0ckthealien:

But what I want it to do, is call the function AnnounceTime again in the specified number of minutes, which it does not do. For the life of me I can't figure out why.

Pages: (1/2) > >>

Go to full version