im troubling with entity parts of the code...idea is: on command make entity_number++
while creating these entities, it gives me correct names (enum used)...first, second, third...but the problem is: when i touch for example second entity, it is showing i touched the last one (third for example)...anyway to fix it?
PHP Code:
entity_get_vector(id,EV_VEC_origin,origin)
new ent = create_entity("info_target")
entity_set_origin(ent,origin);
entity_number++
formatex( model_name, charsmax( model_name ), "demo_model%d", entity_number )
entity_set_string(ent,EV_SZ_classname, model_name);//maybe here is the problem?
entity_set_model(ent,g_Model);
entity_set_int(ent,EV_INT_solid, 1)
new Float:maxs[3] = {100.0,100.0,36.0}
new Float:mins[3] = {-100.0,-100.0,-36.0}
entity_set_size(ent,mins,maxs)
set_pev(ent, pev_rendermode, kRenderTransAlpha)
drop_to_floor(ent)
new targetName[35]
entity_get_string(ent, EV_SZ_classname, targetName, charsmax(targetName))
new model_id;
if(TrieGetCell(g_models, targetName, model_id))
{
switch(model_id)
{
case npc_1: number_ent = "First"
case npc_2: number_ent = "Second"
case npc_3: number_ent = "Third"
}
}
return 1;
and a msg when im touching it:
PHP Code:
show_dhudmessage( id, "Position: %s", number_ent)