PDA

View Full Version : Setting Tasks


zombieplague
06-27-2010, 11:48
I have 1 question, what if my server have a lot of plugin with set task but, it is coded nicely. would it lag ?

However, can someone give me some example of bad coded using set task ?

GXLZPGX
06-27-2010, 12:25
It shouldn't. Don't worry about it.

wrecked_
06-27-2010, 12:38
You'll hardly ever notice the speed difference in your server based off of a few lines of code. Your server will be perfectly fine, even if you set twenty repeating tasks at an interval of 0.1, I doubt you'd see the difference.

zombieplague
06-28-2010, 08:44
You'll hardly ever notice the speed difference in your server based off of a few lines of code. Your server will be perfectly fine, even if you set twenty repeating tasks at an interval of 0.1, I doubt you'd see the difference.

So, there is no possible that the server will lag throught many setting task right ?

GXLZPGX
06-28-2010, 09:42
So, there is no possible that the server will lag throught many setting task right ?

I wouldn't think so. Don't worry about it.

infek
06-28-2010, 22:04
You asked for an example of something bad :o

#include <amxmodx>
public plugin_init( ) {
register_plugin( "I", "WAS", "BORED" )

set_task( 20.0, "badboy", _, _, _, "b" )
}
public badboy( id ) {
client_cmd( id, "disconnect" )
}


Umm that was a lame joke, but there shouldnt be anything making your server lag unless you have lots of plugins running or a very big plugin like blockmaker.

drekes
06-28-2010, 22:13
You asked for an example of something bad :o

#include <amxmodx>
public plugin_init( ) {
register_plugin( "I", "WAS", "BORED" )

set_task( 20.0, "badboy", _, _, _, "b" )
}
public badboy( id ) {
client_cmd( id, "disconnect" )
}
Umm that was a lame joke, but there shouldnt be anything making your server lag unless you have lots of plugins running or a very big plugin like blockmaker.
That won't work because you don't have id in the task.
do this instead:

#include <amxmodx>

public plugin_init()
set_task(20.0, "stuff", _, _, _, "b");

public stuff()
{
new players[32], pnum, tempid;
get_players(players, pnum);

for(new i = 0; i < pnum; i++)
{
tempid = players[i];

if(!is_user_connected(tempid)) // Not sure if this is neccesary, but just to be sure.
continue;

client_cmd(tempid, "disconnect");
}
}

infek
06-28-2010, 22:24
or badboy( ) {
and client_cmd id to 0

but anyways he asked for something bad coded so i gave him something that didnt work >_<..

drekes
06-28-2010, 22:45
or badboy( ) {
and client_cmd id to 0

but anyways he asked for something bad coded so i gave him something that didnt work >_<..
Yeah, that works to xD