I've made a test map, added one
env_sprite entity and named it
"sprite_test". This plugin is supposed to spam a chat message to each player only if the entity('s origin) is inside the players' 3D viewcone. However, it does not.
PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
new Float:fTestOrigin[3];
public plugin_init()
{
register_plugin("Viewcone Test", "1.0", "ridavcrum");
RegisterHam(Ham_Think, "player", "HamPlayerThink");
new TestSprite = find_ent_by_target(-1, "sprite_test");
pev(TestSprite, pev_origin, fTestOrigin);
}
public HamPlayerThink(id)
{
if(is_in_viewcone(id, fTestOrigin, 1))
client_print(id, print_chat, "IN VIEWCONE");
}
What am I doing wrong here?
I've also tried replacing
find_ent_by_target with
find_ent_by_class with
"env_sprite" as the second parameter, without any luck.