I'm going to add on to what arkshine said:
Quote:
Originally Posted by arkshine
- new bool:is_glowing[33][2049] <== whoa. Are you sure that's necessary to create such large array for that ? If I understand well, weapons in a distance will be glow ? Just few weapons should be enough. You can use dynamic array too.
- I hate cvars. You parse each time the same thing, when it need to be parsed only one time, or when the value changes. :/
|
new bool:is_glowing[33][2049]
You should just do a bit sum.
Code:
new g_glowing_ents[33];
// to set a ent glowing for the player
g_glowing_ents[id] |= (1<<ent);
// to remove
g_glowing_ents[id] &= ~(1<<ent);
// to check
if( g_glowing_ents[id] & (1<<ent) )
I think that should work fine.
Unless I'm being stupid and there is a limit for bits.
If I am being stupid, use a dynamic Array, and push/delete entities when they are(n't) glowing.
--------------------------------
For your cvar with color:
You call that so many times in the plugin.
You call it every AddToFullPack frame, and every time the HUD is shown a message (every 0.1 seconds when enabled).
Instead, hook the new round event and store the colors in global variables each round.
EDIT:
Also, I don't see anywhere that you set the glowing entity to remove the glow if player moves away from the weapon.
EDIT2:
Scratch what I said above about the bit sum.
What you should do is make 1 entity glow at a time.
Code:
new g_glowing_ent[33];
// found an entity
g_glowing_ent[id] = ent;
// not near any entity
g_glowing_ent[id] = -1;
That way, the AddToFullPack forward will automatically remove the glow from the old weapon and put it on the new weapon.
__________________