Check if player is in screen
Hello.
How do i check if the players can see another guy in their screen? I'm making a plugin where (with a command) the player will automaticaly duck if another player in screen. How do i check if that player is in screen? Help will be appreciated. Thanks, MaTTe |
Re: Check if player is in screen
is_in_viewcone ( entity, Float: origin[3] )
|
Re: Check if player is in screen
Plus, you need to check if the player is visible.
Also is_in_viewcone method isn't 100% accurate in 3D. |
Re: Check if player is in screen
Is a player an entity?
Can I use if(is_in_viewcone(player, ...) Last question: How do I work with origin? I just want to know if the player is in the screen so i can perform the action. |
Re: Check if player is in screen
Code:
|
Re: Check if player is in screen
change get_user_origin(i, origin)
to entity_get_vector(players[i], EV_VEC_origin, origin) |
Re: Check if player is in screen
@dutchmeat That code doesn't work cause you're not able to use ids
in public server_frame() it just says "undefined symbol "id"" when i compile and when i add server_frame(id) it says "function heading differs from prototype." So what shall i do? |
Re: Check if player is in screen
OK ill post my plugin now and you can tell me what's wrong:
Code:
|
Re: Check if player is in screen
Don't use server_frame - it's inefficient.
You could use for example client_PreThink. Quote:
|
Re: Check if player is in screen
if(is_in_viewcone(id, origin)
{ set_task(0.1, "do_duck", id) } else { return PLUGIN_CONTINUE } the situation you did that is: if the first person is not in your view, then cancel this function but in fact maybe second one is in your view. so you should change that to if(is_in_viewcone(id, origin) { set_task(0.1,"do_duck",id) return } |
| All times are GMT -4. The time now is 06:56. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.