You can already send server-wide messages through the console with
talk(""); and announce("");
I understand this uses a timed center-print instead, so I guess it is a little different.
Oh, I noticed that anyone can change the time, please make that admin-only. Also, you really should specify limits on the time, so other admins won't potentially abuse it and make advert for lyfe
P.S. The ifNumber function really isn't needed for something like this. Here is your whole code in a nutshell:
//Server-Wide-Center-Print-Advert
//Originally by -Setro-
//Recoded by Gothboy for efficiency
$Advert::Pref::Time = 3;
function serverCMDAdvert(%client,%a,%b,%c,%e,%f,%g,%h,%i,%j,%k,%l,%m,%val)
{
%val = $Advert::Pref::Time;
%msg = %a SPC %b SPC %c SPC %d SPC %e SPC %f SPC %g SPC %h SPC %i SPC %j SPC %k SPC %l SPC %m;
if(!%client.isAdmin)
return;
else
centerPrintAll("\c0 Alert from " @ %client.name @ " :<br>\c6 " @ %msg @ " ",%val);
}
function serverCMDSetAdTime(%client,%msg)
{
%val = stripChars(%msg, "@#$%^&*()_+-={}|:<>?[]\;',./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
if(%client.isAdmin && %val >= 0 && %val <= 30)
{
messageClient(%client,'',"\c0Advert time set to \c4 " @ %val @ " ");
}
else if(%client.isAdmin)
{
messageClient(%client,'',"\c0 Please specify a number \c4-1 \c0and\c4 30 ");
echo("Advert Time Specification Error");
}
else
return;
}
Notice how I strip the characters and symbols so that you can type a%/>bcdf2aadglyp8
and still only get 28 as the outcome
You could probably even throw in a nifty little server sound