Author Topic: Schedule problems  (Read 693 times)

Code: [Select]
function getTheTime()
{
        return getWord(getDateTime(),1);
}

function servercmdSetAnnounceTime(%client,%time)
{
if(%client.isHost == true)
{
if(%time < 4999)
{
%time = 5000;
}
$delay = %time;
$AnnounceSchedule = schedule(%time, 0, "DoAnAnnounce");
messageAll("", "\c4TBP Announcer: \c6The announcer delay has been changed to " @ %time/1000 @ " seconds by the host.");
}
}

function DoAnAnnounce(%client)
{
$update += 1;
$percentage = $Server::PlayerCount/$Pref::Server::MaxPlayers*100;
messageAll("", "<just:center><color:ffee00> [[ " @ $Pref::Server::RTBSetup::User @ "'s " @ $Pref::Server::Name @ " ]]");
messageAll("", "<just:center><color:ff6600>" @ $Server::PlayerCount @ "/" @ $Pref::Server::MaxPlayers @ " players are in the server. [" @ $percentage @ "% full.]");
messageAll("", "<just:center><color:00bb00>" @ $Server::BrickCount @ " bricks are in the server.")
messageAll("", "<just:center><color:bbbbbb>" @ getTheTime() @ " [Update #" @ $update @ "]<just:left>");
}

function servercmdWelcomeMessage(%client)
{
if(%client.isSuperAdmin)
{
messageAll("", $Pref::Server::WelcomeMessage);
}
}

package TBPAnnounceSpawnBPrint
{
function GameConnection::onClientEnterGame(%client)
{
messageClient(%client,'',"\c4This server is running \c6TBP Info Announcer \c7v0.9b \c4by TheBlackParrot.");
Parent::onClientEnterGame(%client);
}
};
This is a server info announcer I'm working on.
How would I make this repeat? I'm rather new to Torque, please help me. Looking at other add-ons doesn't help much.

Also, how would I show the player's brickcount? (How many bricks the player has in the server, rather then all bricks.) Gave up on that.

Still having problems with the schedule.
« Last Edit: July 23, 2010, 02:31:56 PM by TheBlackParrot »

Code: [Select]
function getTheTime() {
        return getWord(getDateTime(),1);
}

^ Fixed getTheTime(); command, which by the way is your local time so it might confuse users not in your timezone.

Code: [Select]
%BrickCount = findclientbyname(NAME).brickGroup.getCount();

Code: [Select]
%BrickCount = findclientbyname(NAME).brickGroup.getCount();
It's only showing my brickcount to everyone in the server.

Then you arnt using it right.
Code: [Select]
function servercmdmyBrickcount(%client)
{
    MessageClient(%client,'',"Brickcount:" SPC %client.brickGroup.getCount());
}

Then you arnt using it right.
Code: [Select]
function servercmdmyBrickcount(%client)
{
    MessageClient(%client,'',"Brickcount:" SPC %client.brickGroup.getCount());
}
But I need it to show that to everyone. :\
« Last Edit: July 23, 2010, 02:32:14 PM by TheBlackParrot »

Nothing about the schedule not repeating? It only delays.

To make it repeat you just call it again
Code: [Select]
function servercmdMyBrickCount(%client)
{
    MessageAll('',"Brickcount:" SPC %client.brickGroup.getCount());
   $Repeat = schedule(%delay,0,servercmdMyBrickCount,%client);
}
Then use cancel($Repeat); to cancel it.