Raised This Month: $ Target: $400
 0% 

How to determine whether the player is looking for an entity?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-18-2011 , 20:33   Re: How to determine whether the player is looking for an entity?
Reply With Quote #9

Quote:
Originally Posted by bibu View Post
Do it better.



Bad method of checking for players maybe, yes. You were just talking about checking players, and I said it can be used for other entities too (what the OP wants).



Do it yourself then.
Your stock function is named is_aiming_at_player().
Therefore, it should be for checking players only.
You could write another stock that check if player is aiming at an entity with a given classname.
Here are those 2 stocks:
Code:
#include < amxmodx > #include < engine > new g_iMaxPlayers; public plugin_init( ) {     g_iMaxPlayers = get_maxplayers( ); } stock bool:is_aiming_at_player(id) {     new iEntity, iBody;     get_user_aiming( id, iEntity, iBody );         return ( 1 <= iEntity <= g_iMaxPlayers ); } stock bool:is_aiming_at_classname(id, const classname[]) {     new iEntity, iBody;     get_user_aiming( id, iEntity, iBody );         new szEntityClassname[ 32 ];     entity_get_string( iEntity, EV_SZ_classname, szEntityClassname, charsmax( szEntityClassname ) );         return equal( classname, szEntityClassname ); }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 23:25.


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