Actually, I've been playing around my code a bit and tried different methods. The entity is there. I'm getting the logs I want. For example, in my testmap, the sprite entity has an id of 38, as seen in logs.
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new TestSprite = -1;
new Float:fTestOrigin[3];
public plugin_precache()
{
register_forward(FM_Spawn, "FwdSpawn");
}
public plugin_init()
{
register_plugin("Viewcone Test", "1.0", "ridavcrum");
RegisterHam(Ham_Think, "player", "HamPlayerThink");
}
public FwdSpawn(ent)
{
log_amx("ENTITY: %d, START", ent);
if(!pev_valid(ent))
{
log_amx("ENTITY: %d, INVALID", ent);
return FMRES_IGNORED;
}
log_amx("ENTITY: %d, VALID", ent);
new ClassName[32];
pev(ent, pev_classname, ClassName, charsmax(ClassName));
log_amx("ENTITY: %d, CLASSNAME: %s", ent, ClassName);
if(equali(ClassName, "env_sprite"))
{
new TargetName[32];
pev(ent, pev_targetname, TargetName, charsmax(TargetName));
log_amx("ENTITY: %d, TARGETNAME: %s", ent, TargetName);
if(equali(TargetName, "sprite_test"))
{
TestSprite = ent;
log_amx("ENTITY: %d, END !!", ent);
return FMRES_HANDLED;
}
}
log_amx("ENTITY: %d, END", ent);
return FMRES_IGNORED;
}
public HamPlayerThink(id)
{
if(is_in_viewcone(id, fTestOrigin, 1) || is_visible(id, TestSprite))
client_print(id, print_chat, "%s%s", is_in_viewcone(id, fTestOrigin, 1) ? "IN_VIEWCONE" : "", is_visible(id, Sprite) ? " | IS_VISIBLE" : "");
}
None return true. Bleh!
Yes, I can definitely see the entity. It's in the middle of the room, basically.