|
Author
|
Message
|
|
AMX Mod X Plugin Approver
|

10-06-2015
, 05:07
Re: Such approach is a performance loss or is it irrelevant?
|
#1
|
If you want to optimize your plugin, before trying micro-compiler optimization and such, you should first learn to use the proper functions/forwards for your needs. Learning what implies the use of such natives/forwards. You need more behind-in-scene knowledge about AMXX/Game/Engine. It's about understanding the flow of events to insert your code at the right place. It requires you read HLDSK, AMXX code, and such. You need to care first about the logic of your code.
For example, changing weapon model, you're using WeapPickup, which is an horrible and unreliable way. When you think about it, just because you pick up a weapon doesn't mean you will currently holding it right away, it depends of various factors (weapon weight, client cvar, CanDeploy/CanHolster virtual function, etc). This is not guarantee you will get the weapon nor that you will switch to it. Also this message happens before you actually gets the weapon. This doesn't seem a right place to set model. This is game knowledge.
You would want an event which is called when you deploy your weapon. If you look at HLSDK and how weapon is made, you see that model is set when Deploy() is called. Incidentally it happens Ham module can hooks virtual functions. This is AMXX knowledge. Then you should do the same for your plugin. You will now set model at the right time and when it's necessary.
__________________
|
|
|
|