Is curweapon worth ditching if there are many weapons to declare?
Instead of hijacking another thread I'll just make a new one.
Basically I'm using the curweapon hook to change some weapon models, change user speeds and recharge nades for a custom event. But I recently found out the event is also called when you fire the gun, or reload it, not only when it's selected, so that would explain the high data rates sent to the players when there are 25 players shooting m4a1s together So my question is, is it worth ditching it for ham_item_deploy if I have to declare all weapons in game? If not, is there any other kind of hook I could make so my function is only called when changing weapons? Here's the function, I know it's a clusterfuck Code:
|
Re: Is curweapon worth ditching if there are many weapons to declare?
So you use curweapon only to check if the weapon is knife? Because I see only that. You are checking the zombies and the days, but the only weapon check is for knife. So in that case, you can easily just register Ham_Item_Deploy with "weapon_knife" and put these checks there. And yes, the ham is called only on the switch of the weapon, which it is registered with. :)
And for curweapon better use read_datas instead of checks for weapon. |
Re: Is curweapon worth ditching if there are many weapons to declare?
Quote:
it's true that only knives are changed, but user speeds need to be updated at every weapon change, so for this to work I'd need to declare every weapon in game |
Re: Is curweapon worth ditching if there are many weapons to declare?
Well, look. You can register the ham separately with weapon_knife and set the model, and then register the same ham, but for all weapons in other function, where to set the speed , gravity, etc. Did you get the idea? Two separate functions needed, I think.
|
Re: Is curweapon worth ditching if there are many weapons to declare?
Quote:
I'll give it a spin and reply in a while |
Re: Is curweapon worth ditching if there are many weapons to declare?
can someone please confirm that everything I did is fine and better compared to the code in OP? small note: case 5 not needed anymore
Code:
|
Re: Is curweapon worth ditching if there are many weapons to declare?
Why is this check for the knife in the funcion with the all weapons, when you have a special registered for knife?
Also, use switches. Also, you use set_pev(id, pev_maxspeed) and set_user_maxspeed at one time? Why? Try that way, edit the stuff how you want. PHP Code:
|
Re: Is curweapon worth ditching if there are many weapons to declare?
Quote:
implementing and testing now |
Re: Is curweapon worth ditching if there are many weapons to declare?
Dont set rendering, player models & gravity in Ham_Item_Deploy
I guess this is a daysmenu for jailbreak. Set it when you start the day insted. |
| All times are GMT -4. The time now is 09:41. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.