Quote:
Originally Posted by ConnorMcLeod
Ham_TakeDamage works fine with podbot.
|
But not with CZ bots.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "Registering bots with ham"
#define VERSION "1.0"
#define AUTHOR "SnoW"
new bool:gBotsRegistered;
public plugin_init( )
{
register_plugin( PLUGIN, VERSION, AUTHOR );
/*
We are registering normal players just as an example.
*/
RegisterHam( Ham_Spawn, "player", "hamSpawnPlayer", 1 );
}
public client_authorized( id )
if( !gBotsRegistered && is_user_bot( id ) )
{
/*
The registering has to be delayed since the bot hasn't any data yet.
*/
set_task( 0.1, "register_bots", id );
}
public register_bots( id )
{
if( !gBotsRegistered && is_user_connected( id ) )
{
/*
If registering wasn't done in the middle of the task and the bot haven't disconnected.
*/
RegisterHamFromEntity( Ham_Spawn, id, "hamSpawnBot", 1 );
gBotsRegistered = true;
}
}
public hamSpawnBot( id )
{
if( is_user_alive( id ) )
server_print( "Bot spawn hooked correctly." );
return HAM_IGNORED;
}
public hamSpawnPlayer( id )
{
if( is_user_alive( id ) )
server_print( "Player spawn hooked correctly." );
return HAM_IGNORED;
}
Edit: Reason below