Bug 3232 - Ham_Weapon_SendWeaponAnim crashes
Ham_Weapon_SendWeaponAnim crashes
Status: RESOLVED DUPLICATE of bug 5611
Product: AMX Mod X
Classification: Unclassified
Component: Core
trunk
PC All
: P4 minor
Assigned To: amxmodx-bugs@alliedmods.net
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-08-04 11:45 PDT by XxAvalanchexX
Modified: 2013-06-18 00:10 PDT (History)
6 users (show)

See Also:


Attachments
Fix for Ham_Weapon_SendWeaponAnim (554 bytes, patch)
2010-12-20 12:05 PST, Reuben Morais
no flags Details | Diff | Splinter Review
Proposed patch (2.13 KB, patch)
2010-12-21 11:26 PST, Vincent Herbet [:Arkshine]
no flags Details | Diff | Splinter Review
Corrected proposed path (2.88 KB, patch)
2010-12-21 12:51 PST, Vincent Herbet [:Arkshine]
no flags Details | Diff | Splinter Review

Description XxAvalanchexX 2008-08-04 11:45:40 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.
Comment 1 WiLS (MeRcyLeZZ) 2008-10-09 21:05:28 PDT
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.
Comment 2 joaquimandrade 2009-06-21 08:02:53 PDT
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) },
Comment 3 Reuben Morais 2010-12-20 12:05:19 PST
Created attachment 2481 [details] [review]
Fix for Ham_Weapon_SendWeaponAnim

Builds fine, not tested.
Comment 4 Vincent Herbet [:Arkshine] 2010-12-20 16:59:58 PST
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.
Comment 5 joaquimandrade 2010-12-20 17:27:57 PST
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.
Comment 6 Reuben Morais 2010-12-21 05:24:11 PST
I'll try and get myself familiar with the Ham Sandwich code and see what I can do.
Comment 7 Vincent Herbet [:Arkshine] 2010-12-21 11:26:53 PST
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
Comment 8 Vincent Herbet [:Arkshine] 2010-12-21 12:51:52 PST
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.
Comment 9 joaquimandrade 2010-12-21 13:40:36 PST
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.
Comment 10 Vincent Herbet [:Arkshine] 2010-12-21 15:12:55 PST
Thanks for the explanation, Quim.
Comment 11 David Anderson [:dvander] 2013-02-13 01:18:52 PST
Passing on this for 1.8.2. given bug 5611.
Comment 12 Vincent Herbet [:Arkshine] 2013-06-18 00:10:43 PDT

*** This bug has been marked as a duplicate of bug 5611 ***

Note You need to log in before you can comment on or make changes to this bug.