Quote:
Originally Posted by Doc-Holiday
|
Hurmm strange, but for me it work fine. The 1st code that Connor attached is error, but this 1 no error.
Test result:
Code:
[Ham Test] Bot [13] killed.
[Ham Test] Bot [1] spawned.
[Ham Test] Bot [2] spawned.
[Ham Test] Bot [3] spawned.
[Ham Test] Bot [4] spawned.
[Ham Test] Bot [5] spawned.
[Ham Test] Bot [6] spawned.
[Ham Test] Bot [7] spawned.
[Ham Test] Bot [8] spawned.
[Ham Test] Bot [9] spawned.
[Ham Test] Bot [10] spawned.
[Ham Test] Bot [17] hitted by [15.0] damage.
[Ham Test] Bot [17] hitted by [15.0] damage.
[Ham Test] Bot [17] hitted by [65.0] damage.
[Ham Test] Bot [15] hitted by [195.0] damage.
[Ham Test] Bot [17] hitted by [65.0] damage.
[Ham Test] Bot [17] hitted by [260.0] damage.
[Ham Test] Bot [17] hitted by [114.7] damage.
[Ham Test] Bot [17] hitted by [95.0]
Test plugin:
PHP Code:
#include <amxmodx>
#include <hamsandwich>
public plugin_init()
{
register_plugin("Test CZ bot Ham", "0.0.1", "wbyokomo")
RegisterHam(Ham_Spawn, "player", "OnPlayerSpawnPost", 1)
RegisterHam(Ham_Killed, "player", "OnPlayerKilled")
RegisterHam(Ham_TakeDamage, "player", "OnPlayerTakeDamage")
}
public cz_bot_ham_registerable(id)
{
RegisterHamFromEntity(Ham_Spawn, id, "OnPlayerSpawnPost", 1)
RegisterHamFromEntity(Ham_Killed, id, "OnPlayerKilled")
RegisterHamFromEntity(Ham_TakeDamage, id, "OnPlayerTakeDamage")
}
public OnPlayerSpawnPost(id)
{
if(!is_user_alive(id)) return;
client_print(0, print_chat, "[Ham Test] Bot [%i] spawned.", id)
}
public OnPlayerKilled(id)
{
client_print(0, print_chat, "[Ham Test] Bot [%i] killed.", id)
}
public OnPlayerTakeDamage(victim, inflictor, attacker, Float:damage, damagetype)
{
if(!is_user_connected(attacker)) return HAM_IGNORED;
client_print(attacker, print_chat, "[Ham Test] Bot [%i] hitted by [%.1f] damage.", victim, damage)
return HAM_IGNORED;
}
__________________