Hi, i have a big problem with get_user_aiming()!
if i aim at an entity which i have created i get sometimes a valid entityID and sometimes just 0 as the ID.
I have noticed that if the entity is on a certain wall in the map i get the ID and on another wall i get 0
I would realy appreciate if someone could point me in the right direction and/or help me to solve my problem.
(Full code is also attached)
With this code i create an entity:
Code:
public entcreate()
{
g_entity = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
engfunc(EngFunc_SetModel, g_entity, g_models[g_curmodeltype]);
if(g_curmodeltype == 0) set_pev(g_entity, pev_classname, MEDKITCLASS);
else set_pev(g_entity, pev_classname, RECHARGECLASS);
set_pev(g_entity, pev_controller_0, 125);
set_pev(g_entity, pev_controller_1, 125);
set_pev(g_entity, pev_controller_2, 125);
set_pev(g_entity, pev_controller_3, 125);
new Float:mins[3] = {-10.0, -10.0, -10.0};
new Float:maxs[3] = {10.0, 10.0, 10.0};
engfunc(EngFunc_SetSize, g_entity, mins, maxs);
set_pev(g_entity, pev_solid, 2);
setGlow(g_entity);
}
And with that i get the ID from the entity i aim at:
Code:
public del_station(id)
{
new body, index;
if(get_user_aiming(id, index, body) == 0.0) return PLUGIN_HANDLED_MAIN;
log_amx("deleting initiated index: %d", index);
return PLUGIN_CONTINUE;
}
This is the Console output..for 3 different Entities...
As you see 2 of them return their ID (on the wall behind the Terror-spawn on dust2) and from 1 entity i get the ID 0 (on a different wall...) :
Quote:
L 05/23/2007 - 15:11:15: [HA-Stations_v0.3.amxx] deleting initiated index: 111
L 05/23/2007 - 15:11:17: [HA-Stations_v0.3.amxx] deleting initiated index: 0
L 05/23/2007 - 15:11:18: [HA-Stations_v0.3.amxx] deleting initiated index: 110
|
Thanks for looking into this!
greetz regalis
And here is the full code: