AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Setting Tasks (https://forums.alliedmods.net/showthread.php?t=130782)

zombieplague 06-27-2010 11:48

Setting Tasks
 
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

Re: Setting Tasks
 
It shouldn't. Don't worry about it.

wrecked_ 06-27-2010 12:38

Re: Setting Tasks
 
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

Re: Setting Tasks
 
Quote:

Originally Posted by wrecked_ (Post 1221597)
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

Re: Setting Tasks
 
Quote:

Originally Posted by zombieplague (Post 1222487)
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

Re: Setting Tasks
 
You asked for an example of something bad :o
PHP Code:

#include <amxmodx>
public plugin_init( ) {
 
register_plugin"I""WAS""BORED" )
 
 
set_task20.0"badboy"___"b" )
}
public 
badboyid ) {
 
client_cmdid"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

Re: Setting Tasks
 
Quote:

Originally Posted by infek (Post 1223196)
You asked for an example of something bad :o
PHP Code:

#include <amxmodx>
public plugin_init( ) {
 
register_plugin"I""WAS""BORED" )
 
 
set_task20.0"badboy"___"b" )
}
public 
badboyid ) {
 
client_cmdid"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:
PHP Code:

#include <amxmodx>
 
public plugin_init()
    
set_task(20.0"stuff"___"b");
    
public 
stuff()
{
    new 
players[32], pnumtempid;
    
get_players(playerspnum);
    
    for(new 
0pnumi++)
    {    
        
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

Re: Setting Tasks
 
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

Re: Setting Tasks
 
Quote:

Originally Posted by infek (Post 1223210)
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


All times are GMT -4. The time now is 14:43.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.