Help with Optimization!
In my plugin , i remade 2 bools , this are called in Takedamage , but i hate make this in the takedamage
PHP Code:
|
Re: Help with Optimization!
Quote:
|
Re: Help with Optimization!
optimizate the bools , because , i make a plugin with a special weapons , and i created more bools , in the takedamage have more if if if , i need optimizate this with another method or swith or anything.
|
Re: Help with Optimization!
Provide more informations what does each bool, what do you want to with it, etc..
|
Re: Help with Optimization!
the idea is , the weapons have special effects , can freeze TTS or Kill CTS , change weapon model etc , but , i hate have more bools .
I'm searching for a good optimization , like swith or anything. when the player drop the weapon with special effects , the bools are in false. |
Re: Help with Optimization!
You don't explain enough, you do what in these checks ?
|
Re: Help with Optimization!
i check if the player have the BOOL in TRUE , he have the power when is attacking a enemy .EX
PHP Code:
my problem is , i have more bools , and i hate have more bools in the plugin , therefore i'm searching a optimizate this. if you doesn't understand , post please. |
Re: Help with Optimization!
like this thread
http://forums.alliedmods.net/showthr...ighlight=bools look , its possible to make a switch with the array in these case? ex? |
Re: Help with Optimization!
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:
|
Re: Help with Optimization!
sorry , i'm no talking about the human class , are a simple weapons with new model , damage, power , etc.
|
All times are GMT -4. The time now is 15:37. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.