News System for newbies by me :)
Enjoy
function onScriptLoad()
{
NewTimer("TextUpdater",60000,0); \\ Edit it as u want, it is 60 seconds now
}
Functions...
function TextUpdater()
{
if( GetPlayers() > 0 )
{
local idx = random_msg[ rand() % random_msg.len() ];
ClientMessageToAll( idx[0], idx[1], idx[2], idx[3] );
}
}
Finally the main one "news" system
random_msg <- [
["**Message-1",255,255,255],
["**Message-2",255,0,0], \\ Add how many u want
];
This is actually posted by Shadow, here in old forum - http://vcmp.liberty-unleashed.co.uk/forum/index.php?topic=1422.msg8979#msg8979
Edit - I just noticed that you are new here ? Dont take me rude please !
Stop fuc***** post unusefull and copied snippet and this is already posted by Matheus
Nope actually I made this, I didn't knew about that site, thanks for telling me that site, now I'll take a look at that website
nice try to fool players
to reducing lag cause of timer it must be improved
function onScriptLoad()
{
newsTimer <- NewTimer("TextUpdater",60000,0); \ Edit it as u want, it is 60 seconds no
newsTimer.Paused = true;
}
function onPlayerJoin(player)
{
if( newsTimer.Paused == true )
{
newsTimer.Paused = false;
print("timer resumed");
}
}
function onPlayerPart(player, reason)
{
if ( GetPlayers() == 0 && newsTimer.Paused == false )
{
newsTimer.Paused = true;
print("timer paused");
}
}
function TextUpdater()
{
ClientMessageToAll( random_msg[rand()% random_msg.len()],255,25,0 );
}
random_msg <- ["msg 1", "msg2", "msg3"];
Quote from: Beztone on Jul 14, 2015, 04:50 PMto reducing lag cause of timer it must be improved
<snip>
... I mean technically yeah but you probably shaved off a lot less than a millisecond of execution time with that optimization. It's not like the overhead of calling a timer function takes seconds. It's inelegant.
There should be a balance between readability for the scripter and optimization for the server — this looks like an unnecessary microoptimization that just adds complexity.
Quote from: Stormeus on Jul 14, 2015, 06:28 PMQuote from: Beztone on Jul 14, 2015, 04:50 PMto reducing lag cause of timer it must be improved
<snip>
... I mean technically yeah but you probably shaved off a lot less than a millisecond of execution time with that optimization. It's not like the overhead of calling a timer function takes seconds. It's inelegant.
There should be a balance between readability for the scripter and optimization for the server — this looks like an unnecessary microoptimization that just adds complexity.
Meh never understand what stormeus say in these type of cases :D will you describe it more clearly ?
Quote from: Axel-Blaz on Jul 14, 2015, 06:48 PMQuote from: Stormeus on Jul 14, 2015, 06:28 PMQuote from: Beztone on Jul 14, 2015, 04:50 PMto reducing lag cause of timer it must be improved
<snip>
... I mean technically yeah but you probably shaved off a lot less than a millisecond of execution time with that optimization. It's not like the overhead of calling a timer function takes seconds. It's inelegant.
There should be a balance between readability for the scripter and optimization for the server — this looks like an unnecessary microoptimization that just adds complexity.
Meh never understand what stormeus say in these type of cases :D will you describe it more clearly ?
What's not to understand?
Quote from: Axel-Blaz on Jul 14, 2015, 06:48 PMMeh never understand what stormeus say in these type of cases :D will you describe it more clearly ?
It's a pointless fix because timers don't take years to run.
UseLess Lock the Topic
Yup, ur posts makes all the topics useless
Quote from: Axel-Blaz on Jul 14, 2015, 06:48 PMMeh never understand what stormeus say in these type of cases :D will you describe it more clearly ?
http://www.learn-english-online.org might help in the future
LOL..!!