Ok Depresie, I do a code but have one bugs. I dont know much work with entitys, but lets go.
Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <cs_ham_bots_api>
new const ENTITY_MODEL[] = "models/bag.mdl";
public plugin_init()
{
register_plugin("Plugin", "Version", "Author");
RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1);
RegisterHamBots(Ham_Spawn, "fw_PlayerSpawn_Post", 1);
register_forward(FM_Touch, "forward_touch");
}
public plugin_precache()
{
precache_model(ENTITY_MODEL);
}
public fw_PlayerSpawn_Post(id)
{
if (!is_user_alive(id))
return;
new entity, Float:origin[3];
entity = create_entity("info_target");
entity_get_vector(id, EV_VEC_origin, origin);
set_pev(entity, pev_body, 1);
entity_set_model(entity, ENTITY_MODEL);
origin[2] += 10;
entity_set_origin(entity, origin);
set_pev(entity, pev_owner, id);
entity_set_string(entity, EV_SZ_classname, "entity_head");
entity_set_int(entity, EV_INT_solid, 2);
}
public forward_touch(toucher, touched)
{
if (is_user_alive(toucher))
{
client_print(toucher, print_chat, "Touch");
dllfunc(DLLFunc_ClientKill, toucher);
}
}
Now the problems of this code. First, obviously that code is killing the toucher and dont the owner of the entity. Second, I think if exists other entity in the game and a player touch he, I think will execute the "entity_head" class. You can help me to fix that? And, any optimization?
Sorry for my English.
__________________