Quote:
Originally Posted by bibu
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 );
}
__________________