i'm trying when press E(+USE) in the entity "cosa" something happen, but dont work
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
public plugin_init()
{
register_clcmd("cosa", "cosa")
register_forward(FM_CmdStart, "fw_CmdStart")
}
public plugin_precache()
{
precache_model("models/a.mdl")
}
public cosa(id)
{
new Float:origin[3]
entity_get_vector(id,EV_VEC_origin,origin)
new ent = create_entity("info_target")
entity_set_origin(ent,origin);
origin[2] += 100.0
entity_set_origin(id,origin)
entity_set_float(ent,EV_FL_takedamage,1.0)
entity_set_float(ent,EV_FL_health,100.0)
entity_set_string(ent,EV_SZ_classname,"cosa");
entity_set_model(ent,"models/a.mdl");
entity_set_int(ent,EV_INT_solid, 2)
entity_set_byte(ent,EV_BYTE_controller1,125);
entity_set_byte(ent,EV_BYTE_controller2,125);
entity_set_byte(ent,EV_BYTE_controller3,125);
entity_set_byte(ent,EV_BYTE_controller4,125);
new Float:maxs[3] = {16.0,16.0,36.0}
new Float:mins[3] = {-16.0,-16.0,-36.0}
entity_set_size(ent,mins,maxs)
entity_set_float(ent,EV_FL_animtime,2.0)
entity_set_float(ent,EV_FL_framerate,1.0)
entity_set_int(ent,EV_INT_sequence,0);
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.01)
drop_to_floor(ent)
return 1;
}
public fw_CmdStart(id, handle, random_seed)
{
if(!is_user_alive(id))
return;
new buttons = (get_uc ( handle, UC_Buttons ) & IN_USE)
if (buttons )
{
new target, temp
if(get_user_aiming(id, target, temp, 50) != 0.0)
{
if(!target || !is_valid_ent(target))
return
new class[33]
entity_get_string(target, EV_SZ_classname, class, 31)
if(equal(class, "cosa"))
{
client_print(id, print_center, "Tocaste la Cosa we")
}
}
}
}