You did not understand me, micro optimizations give you nothing, you don't get rid of lag with them or whatever you are thinking.
About the Damage thing, I think you are confused a bit. It's not more powerfull or whatever. Look at it's description:
Quote:
|
This message is sent when a player takes damage, to display the red locational indicators. The last three arguments are the origin of the damage inflicter or victim origin if inflicter isn't found. DamageType is a bitwise value which usually consists of a single bit.
|
Ham only hooks virtual functions, that are implemented differently in every class. So, for another entity class you must register the hook with this classname(if you register for "player", then only entities with player will be afected). I am not sure what bots are you talking about, but there are for sure ways to hook damage for them too. Also, as you can see for the Damage event, you can't modify the damage on the fly, you must create another entity that does damage, while with Ham you alter the damage directly. I would say Ham is more powerfull considering this.
Quote:
|
I just what to optimize a operation that happens every-time, like when you get shot. Not for those who just happens one time here. Not others like the 'cs_set_user_bpammo', to save some native calls which rarely happens.
|
Lol, what you understand from "every time" ? You are not working per frame, this happens once at 2/3 seconds or so, it's nothing for the server.
PHP Code:
efficiently micro optimized
Again, micro optimizations does not give you anything.
Your title ask if it is irrelevant or not, you got your answer, but you still act like you know already. If so, why asking ?
Now, more about your code:
1.In a Ham forward you should use HAM_ return constants + this function is not mean to return booleans, but integers.
2.Do not hardcode a string array size, you have charsmax() for retrieving it. It helps on readability.
3.
default: return PLUGIN_HANDLED you can remove this, but not like it matters much.
4.Something you should care about is the use of
FM_CmdStart, which is called per frame, and if you have alternatives you should avoid it. I think that now you can hook WeaponIdle with ham, disable it right after hooking, enable it on deploy and disable on holster. It should work, test and see.
5.For Fakemeta forwards you should return FMRES_* constants, not PLUGIN_.
__________________