PDA

View Full Version : Class Type for Bots / Hamsandwich


soccdoodcss
04-27-2008, 16:15
What is the class type for bots? "player" only refers to human players.

EDIT: Bots are class "player" but hamsandwich seems to skip over them. Any ideas?

v3x
04-27-2008, 17:18
Use FakeMeta?

soccdoodcss
04-27-2008, 18:30
I would but its using the pre-damage forward via RegisterHam.

VEN
04-29-2008, 14:13
You can use:native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);
See hamsandwich.inc for details.

Styles
04-29-2008, 14:23
yes. what I think he's asking is when you do ham takedamage, player blah..

what's it for bots. is player changed?

I'm on my pda. sorry for the typing.

soccdoodcss
04-29-2008, 23:12
You can use:See hamsandwich.inc for details.
Ok, I'll check it out. Thanks.

Edit:
/**
* Hooks the virtual table for the specified entity's class.
* An example would be: RegisterHam(Ham_TakeDamage, id, "player_hurt");
* Look at the Ham enum for parameter lists.
* Note: This will cause hooks for the entire internal class that the entity is
* not exclusively for the provided entity.
*
* @param function The function to hook.
* @param EntityId The entity classname 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 EnableHamForward/DisableHamForward to toggle the forward on or off.
*/
native HamHook:RegisterHamFromEntity(Ham:function, EntityId, const Callback[], Post=0);I'm confused. Where would I RegisterHam(Ham_TakeDamage, id, "player_hurt");. If it is in plugin_int(), how do I know the entity's id?

Alka
04-30-2008, 03:41
Do it when the bot is created/joined...not on plugin_init.

soccdoodcss
04-30-2008, 16:30
Alright, that makes more sense. Thanks for the help.

Edit: I registered it in client_putinserver but:

L 04/30/2008 - 15:39:41: [HAMSANDWICH] Failed to retrieve classtype for entity id "4", hook for "beforeDamage" not active.
L 04/30/2008 - 15:39:41: [AMXX] Displaying debug trace (plugin "martyrdom.amxx")
L 04/30/2008 - 15:39:41: [AMXX] Run time error 10: native error (native "RegisterHamFromEntity")
L 04/30/2008 - 15:39:41: [AMXX] [0] martyrdom.sma::client_putinserver (line 31)
Ernie connected
Ernie is joining the Counter-TerroristI took out the registerham in plugin_init completely. Now, it still registers me, but the errors occur when a bot joins.