Bugzilla – Bug 3232
Ham_Weapon_SendWeaponAnim crashes
Last modified: 2013-06-18 00:10:43 PDT
Using this code: <code>public do_hi(id) { new name[24]; get_weaponname(get_user_weapon(id),name,23); new ent = fm_find_ent_by_owner(0,name,id); if(pev_valid(ent)) { log_amx("I'm really gonna do it"); ExecuteHam(Ham_Weapon_SendWeaponAnim,ent,3,1,0); } return PLUGIN_HANDLED; }</code> http://i14.photobucket.com/albums/a310/xxavalanchexx/crash.jpg The log message does get written. The arguments for SendWeaponAnim are animation, skiplocal, and body. In the HLSDK, skiplocal is default 1 and body is default 0, so that's what I used.
I can also confirm the server crashing when trying to hook that forward (CS 1.6 and CZ). Anyway, I thought HS functions were supposed to be experimental: From hamsandwich_const.inc * A few notes about all of the following functions: * - Not all functions will do as you expect on all mods. * If a function does not do what you would believe it should * DO NOT file a bug report, you will be ignored.
The function doesn't work because it is expecting 3 args plus the entity and it just receives two. Change in hamsandwich code: { V("weapon_sendweaponanim", Void_Int_Int_Int) }, to { V("weapon_sendweaponanim", Void_Int_Int) },
Created attachment 2481 [details] [review] Fix for Ham_Weapon_SendWeaponAnim Builds fine, not tested.
I'm against this fix, because by default there are 3 params for HL and probably most of mods have kept the original header. So, here it would be more specific to CS. If you apply such fix, it will most likely crash for HL and such. I would suggest to make something like Ham_CS_SendWeaponAnim instead.
Yes, Arkshine is right, Seta. The header of the function was changed in CS and changing it in hamsandwich will fuck it for other mods.
I'll try and get myself familiar with the Ham Sandwich code and see what I can do.
Created attachment 2484 [details] [review] Proposed patch Here a new patch to add a new entry instead, since specific to CS : Ham_CS_Weapon_SendWeaponAnim. Compiled and tested in-game successfully. Here a small plugin used to test : http://pastebin.com/hut48txr
Created attachment 2485 [details] [review] Corrected proposed path I've just noticed that ham_const.inc is referenced 2 times, in plugins/include/ and dlls/hamsandwich/include/. Not sure if we should modify both, but it would not hurt to do it, just to be sure. This patch is an update to include plugins/include/ham_const.ini modification.
Both is the way. One is shipped with the installation of amxx and other is shipped with the module. Like, the first is a copy of the second.
Thanks for the explanation, Quim.
Passing on this for 1.8.2. given bug 5611.
*** This bug has been marked as a duplicate of bug 5611 ***