Raised This Month: $ Target: $400
 0% 

Help with Optimization!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-30-2010 , 18:22   Re: Help with Optimization!
Reply With Quote #9

First of all if you are using classes (or something like that) you can optimize the code alot for eg in ZP MeRcyLeZZ uses different bools to identify a user's class like for a zombie player it would be this : g_zombie[id] or for survivor it would be this: g_survivor[id]

Instead you can use a single variable to store a player's class and update it whenever you want
If you cant understand then i will give you an example where MeRcyLeZZ forgot to optimize the code:
Instead of seperate bools to identify a player's class you can do it like this:
new g_players_class[ 33 ]

and on places where player changes class you can store it as a number
[In my eg zombie is taken as 1 and nemesis as 2]
g_players_class[ id ] = 1 // Means player is a zombie

Or like this

g_players_class[ id ] = 2 // Means player is a nemesis

And so you can use switch like this:
PHP Code:
switch( g_players_classid ] )
{
        case 
CLASS_THUNDER:
        {
                     
// do stuff
        
}
        case 
CLASS_CITIZEN:
        {
                     
// do stuff
        
}

__________________

My Plugins For ZP

Inactive due to College and Studies

Last edited by abdul-rehman; 07-30-2010 at 18:26.
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
 



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 00:13.


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