Raised This Month: $ Target: $400
 0% 

Ham_Weapon_Reload Problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
shine771
Senior Member
Join Date: Jun 2007
Old 08-12-2008 , 12:29   Ham_Weapon_Reload Problem.
Reply With Quote #1

I'm making a new, cool mod... but i'm having problems with Ham_Weapon_Reload. I'm trying to hook it.. but nothing happens.
PHP Code:
//plugin_init {
 
RegisterHam(Ham_Weapon_Reload,"player","player_reloaded")
//}
public player_reloaded(idlog_amx("RELOADED"
Maybe i am doing something wrong? Can anyone give me an code snippet/example how to hook this event properly?
Mod: cstrike, but didn't work on HL too. I've found only one topic where Ham_Weapon_Reload was involved... but there i didn't find anything useful.
I don't want to catch the After-Reload event in the Messy way... i would like to use this method if it's possible. Thanks.
shine771 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-12-2008 , 12:42   Re: Ham_Weapon_Reload Problem.
Reply With Quote #2

I think you should register this forward with the weapons class and not the player class.

What I'm using for a coming plugin :

Code:
    RegisterHamsItemDeploy ()     {         new s_WeaponName[ 24 ];         for ( new i_Wpn = 1; i_Wpn <= MAX_WEAPONS; i_Wpn++ )         {             get_weaponname ( i_Wpn, s_WeaponName, charsmax ( s_WeaponName ) );             if ( s_WeaponName[ 0 ] ) RegisterHam ( Ham_Item_Deploy, s_WeaponName, "fwd_Item_Deploy", 1 );         }     }

It should the same for 'Ham_Weapon_Reload'.
__________________
Arkshine is offline
shine771
Senior Member
Join Date: Jun 2007
Old 08-12-2008 , 12:50   Re: Ham_Weapon_Reload Problem.
Reply With Quote #3

Mm... i used "weapon_glock18"... nothing happened. If it would work... should i register ~20-30 forwards.. because there are ~20-30 weapon in CS. Of course i can do for loop... but isn't there a better way.. like "weapon_" >>> All entities with classname containing/starting(with) "weapon_" would be hooked/included... anyway... it doesn't work... . Thanks for your help anyway.
shine771 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-12-2008 , 12:55   Re: Ham_Weapon_Reload Problem.
Reply With Quote #4

Sawce has already said there is not any others ways than that.

[edit] Just tested and it works fine.

"weapon_glock18" should work. Try as post.
__________________

Last edited by Arkshine; 08-12-2008 at 12:58.
Arkshine is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-12-2008 , 13:09   Re: Ham_Weapon_Reload Problem.
Reply With Quote #5

Quote:
Originally Posted by shine771 View Post
Mm... i used "weapon_glock18"... nothing happened. If it would work... should i register ~20-30 forwards.. because there are ~20-30 weapon in CS. Of course i can do for loop... but isn't there a better way.. like "weapon_" >>> All entities with classname containing/starting(with) "weapon_" would be hooked/included... anyway... it doesn't work... . Thanks for your help anyway.
You can hook Ham_Player_AddItem and use RegisterHamFromEntity in the just added weapon. Then when the item is removed you can disable the hook.
danielkza is offline
shine771
Senior Member
Join Date: Jun 2007
Old 08-12-2008 , 14:16   Re: Ham_Weapon_Reload Problem.
Reply With Quote #6

Thanks arkshine! I just wrote "weapon_glock18" in the wrong RegisterHam(one above). Now i fixed it. .
Thanks danielkza for trying to help . I'll stick to my method... btw it just catches when you start reloading the weapon.. even if you've got full clip it still calls this event when you press the R(reload key). I fixed it using Cur weapon.. anyway.. thanks all .
shine771 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 03:16.


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