Raised This Month: $ Target: $400
 0% 

Get origin in player's viewcone?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 11-25-2019 , 10:33   Get origin in player's viewcone?
Reply With Quote #1

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(TestSpritepev_originfTestOrigin);
}

public 
HamPlayerThink(id)
{
    if(
is_in_viewcone(idfTestOrigin1))
        
client_print(idprint_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.
redivcram is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:51.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode