Raised This Month: $ Target: $400
 0% 

Such approach is a performance loss or is it irrelevant? [solved]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 10-06-2015 , 05:07   Re: Such approach is a performance loss or is it irrelevant?
Reply With Quote #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.
__________________
Arkshine is offline
Reply



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 22:16.


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