Raised This Month: $ Target: $400
 0% 

What can i optimize?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-09-2010 , 20:07   Re: What can i optimize?
Reply With Quote #2

cmdSayRestart(id)

There are more efficient ways of checking your restart say commands. I would use a Trie.

If the string Tmp is not a number then what does str_to_num(Tmp) return (I would assume zero)? If it returns zero then you don't need to do the is_str_num() and you shouldn't need to do if(equal(Tmp, "")) either. Just do

Code:
server_cmd("sv_restart %d",clamp(Value, 1, 60))
Also, I would do the is_user_admin() check at the begining so you don't read names and arguments AND most importantly you don't do looping at all.

You should probably move the getting user name stuff to right before you use it since you don't use it anywhere else.

In RoundStart(), if client #1 is not connected then nobody will be stripped of weapons. Use get_players().

In BlockChangeTeam(id), the third return is technically unreachable. Solution: remove the "else return PLUGIN_CONTINUE;".

Anywhere you use cs_get_user_team() use a switch.

Do your admin check in CFGVALE( id ) first because you don't use the variable created before it unless the user is an admin.

Those are some suggestions. Not guaranteed to be the best nor is it all of the possible optimizations.
__________________
fysiks is offline
 



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 07:11.


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