callfunc_begin vs Multiforward which is better?
I used MultiForward for my Weapon Menu System and notice some time it cause crash on server or really huge lag spike if a lot of player try to buy weapons at the same time.
I thought it was because of it have to go though 20+ plugins using that forward and executed too many time (3 execute per player in < 1 second + chance of 10+ players press buy and execute at short period of time) So did some research and found callfunc_begin function which directly call function from specific plugins. With PluginID and FunctionID can be sent via "Weapon Register Native"(like ZP Class Register), in theory, it would be great for Weapon Menu System. But still, it is my own assumption. I am not sure which one is better to use in this situation so I want to hear veteran opinion on this. P/S: Some said that callfunc_begin is basically native so why not use native? - Between replacing 2 parameters getting from Info Param of the menu item and have to create a .inc file, register_native, making a switch between menu item that lead to each native for each specific weapon? the first one definitely cleaner. |
Re: callfunc_begin vs Multiforward which is better?
Quote:
It doesn't matter if it's called in 1 plugin, 10 plugins and so on, it's executed once by a module or a plugin, so, passed params will be the same for every plugin in that moment. Quote:
This code: PHP Code:
PHP Code:
|
Re: callfunc_begin vs Multiforward which is better?
Quote:
- Check if the plugins have a the forward - Check the weaponid according to parameter sent While using callfunc only need to check weaponid only. Which argued with him that "is 1 or 2 check really that matter? While something like takedamage even have to check class, team,... at the same time" He said that it was not about more or less if, it is about the performance. If you could reduced any useless "if" then it would boost the performance specially on something like Pawn. That why every Zombie server was lagged, he said The weapon system I wrote was similar to the Extra Item from ZP Quote:
|
Re: callfunc_begin vs Multiforward which is better?
Quote:
The natives have 2 checks too: - if the given native exists - parameters passed through function. You can perform a profile to see how much times a function is being called. |
| All times are GMT -4. The time now is 02:35. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.