AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to speed up my plugin? (https://forums.alliedmods.net/showthread.php?t=162825)

byetovice 07-23-2011 10:59

How to speed up my plugin?
 
Hello. How can i write plugins better ?
My questions :

Which one i should use ?
Only is_user_alive...
Code:

if(is_user_alive( id ))
{
... is this enough?
}

Or alive and connect check ?
Code:

if(is_user_connected( id ) && is_user_alive( id ))
{
..
}

Includes :
If i include <cstrike> for just using "cs_set_user_money" code, does this slow down the server ? Should i make a stock for set_user_money ?

Last Question : Is there any tutorial to write better ?

Arkshine 07-23-2011 11:03

Re: How to speed up my plugin?
 
is_user_alive is enough, it includes already a check if user is connected.

Including cstrike is fine.

SnoW 07-23-2011 11:21

Re: How to speed up my plugin?
 
Has anyone ever done profiling what is the speed difference between those natives?

MAX_SLOTS * TIME_IS_CONNECTED + AVERAGE_PLAYERS_CONNECTED * TIME_IS_ALIVE > MAX_SLOTS * TIME_IS_ALIVE

I believe the presentation is pretty much true. Not in empty server though. On the other hand the speed does not matter a thing on an empty server.


All times are GMT -4. The time now is 00:49.

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