View Single Post
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 01-05-2012 , 01:04   Re: Hamsandwich Updating
#90

Quote:
Originally Posted by joaquimandrade View Post
I know a bit about this stuff so I can make it clear for you:

RegisterHam and RegisterHamFromEntity are ways of reaching a class' virtual table. You can read about it here: http://en.wikipedia.org/wiki/Virtual_method_table

RegisterHam does it by asking the game to create a dummy entity by using a classname like "weapon_ak47" that isn't more than a way of reaching the C++ class CAK47 (I think that's the name).

CZ Bots C++ class is CCSBot but there isn't a half life classname linked to it just for the reason that CCSBot are not considered entities or didn't need to be considered entities. So, you can't use RegisterHam with CZ Bots because there isn't a connection between classnames and the C++ class CCSBot.
Then can you make a hamsandwich stock to registerham for CZbot? I found this stock to registerham for CZbot. We need this kind of stock to make our coding job simple.

Please take a look.
PHP Code:
/**
 * Hooks the virtual table for CZ Bots entity class.
 * An example would be: RegisterHamBots(Ham_TakeDamage, "player_hurt");
 * Look at the Ham enum for parameter lists.
 *
 * @param function        The function to hook.
 * @param callback        The forward to call.
 * @param post            Whether or not to forward this in post.
 * @return                 Returns a handle to the forward.  Use EnableHamForwardBots/DisableHamForwardBots to toggle the forward on or off.
 */
native RegisterHamBots(Ham:function, const Callback[], Post=0); 
Attached Files
File Type: sma Get Plugin or Get Source (cs_ham_bots_api.sma - 650 views - 7.3 KB)
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline