AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Hook think\spawn "gib" (https://forums.alliedmods.net/showthread.php?t=246050)

fl0werD 08-10-2014 22:06

Hook think\spawn "gib"
 
How to hook think\spawn gibs after death in cs?

NiHiLaNTh 08-11-2014 03:48

Re: Hook think\spawn "gib"
 
Last time I tested Ham_Think failed there, so I used register_think and it worked.

fl0werD 08-11-2014 06:48

Re: Hook think\spawn "gib"
 
In combat.cpp not used LINK_ENTITY_TO_CLASS( entity_class, CGib ); therefore cannot be registered through Ham

meTaLiCroSS 08-11-2014 15:32

Re: Hook think\spawn "gib"
 
By looking at CS mod code, yeah, you're right; there is no associated classname to the CGib class. An easy way to hook Gib spawn would be hooking SetModel (checking the properly model)

Then with the gib entid, you can hook with RegisterHamFromEntity forwards you want. But at the first hook, you wouldn't be able to hook Spawn pre (because you'll be registering forwards just some steps after Spawn Pre).

fl0werD 08-11-2014 21:03

Re: Hook think\spawn "gib"
 
Torment question: which is faster equal( szClassName, "gib" ) or ( szClassName[ 0 ] == 'g' && szClassName[ 2 ] == 'b' ) ?

mottzi 08-12-2014 10:21

Re: Hook think\spawn "gib"
 
The second one.

meTaLiCroSS 08-12-2014 23:10

Re: Hook think\spawn "gib"
 
Are you checking it's classname?

fl0werD 08-13-2014 10:44

Re: Hook think\spawn "gib"
 
Quote:

Originally Posted by mottzi (Post 2182880)
The second one.

Thanks.

Quote:

Originally Posted by meTaLiCroSS (Post 2183235)
Are you checking it's classname?

Yes. You can suggest something better?:)

meTaLiCroSS 08-13-2014 20:39

Re: Hook think\spawn "gib"
 
Quote:

Originally Posted by fl0werD (Post 2183463)
Thanks.


Yes. You can suggest something better?:)

They have no classname lol, there's no linked classname to the CGib class, have you read my post? :shock:

fl0werD 08-13-2014 20:51

Re: Hook think\spawn "gib"
 
Quote:

Originally Posted by meTaLiCroSS (Post 2183687)
They have no classname lol, there's no linked classname to the CGib class, have you read my post? :shock:

He has no entity_class, but has a classname.


All times are GMT -4. The time now is 13:09.

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