Raised This Month: $51 Target: $400
 12% 

How to speed up my plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
byetovice
Senior Member
Join Date: Nov 2009
Location: Turkey
Old 07-23-2011 , 10:59   How to speed up my plugin?
Reply With Quote #1

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 ?
__________________
Working on mods..
byetovice is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-23-2011 , 11:03   Re: How to speed up my plugin?
Reply With Quote #2

is_user_alive is enough, it includes already a check if user is connected.

Including cstrike is fine.
__________________
Arkshine is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 07-23-2011 , 11:21   Re: How to speed up my plugin?
Reply With Quote #3

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.

Last edited by SnoW; 07-23-2011 at 11:24.
SnoW is offline
Send a message via MSN to SnoW
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:38.


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