Add constants for get_user_origin() (#604)

This commit is contained in:
justgo97 2018-09-28 15:22:21 +01:00 committed by Vincent Herbet
parent e8c8111178
commit 22fd09efea
4 changed files with 21 additions and 7 deletions

View File

@ -533,4 +533,16 @@ enum
STATSX_MAX_STATS STATSX_MAX_STATS
} }
/**
* Constants for get_user_origin()
*/
enum
{
Origin_Client = 0, // Client's Origin
Origin_Eyes, // Eyes (and Weapon) Origin
Origin_AimEndClient, // Aim End Origin from Client's Position
Origin_AimEndEyes, // Aim End Origin from Eyes Position
Origin_CS_LastBullet // Last Bullet's Origin (Counter-Strike)
}
#include <cstrike_const> // To keep backward compatibility #include <cstrike_const> // To keep backward compatibility

View File

@ -1203,14 +1203,16 @@ native get_user_ping(index, &ping, &loss);
/** /**
* Retrieves an origin related to the client. * Retrieves an origin related to the client.
* *
* @note For a list of possible modes see the Origin_* constants in amxconst.inc.
*
* @param index Client index * @param index Client index
* @param origin Array to store origin in * @param origin Array to store origin in
* @param mode What type of origin to retrieve: * @param mode What type of origin to retrieve:
* 0 - current position * Origin_Client - current position
* 1 - position of eyes (and weapon) * Origin_Eyes - position of eyes (and weapon)
* 2 - aim end position from client position * Origin_AimEndClient - aim end position from client position
* 3 - aim end position from eyes (hit point for weapon) * Origin_AimEndEyes - aim end position from eyes (hit point for weapon)
* 4 - position of last bullet hit (only for Counter-Strike) * Origin_CS_LastBullet - position of last bullet hit (only for Counter-Strike)
* *
* @return 1 on success, 0 if client is not connected * @return 1 on success, 0 if client is not connected
* @error If the client index is not within the range of 1 to * @error If the client index is not within the range of 1 to

View File

@ -125,7 +125,7 @@ stock remove_entity_name(const eName[])
stock ViewContents(id) stock ViewContents(id)
{ {
new origin[3], Float:Orig[3]; new origin[3], Float:Orig[3];
get_user_origin(id, origin, 3); get_user_origin(id, origin, Origin_AimEndEyes);
Orig[0] = float(origin[0]); Orig[0] = float(origin[0]);
Orig[1] = float(origin[1]); Orig[1] = float(origin[1]);
Orig[2] = float(origin[2]); Orig[2] = float(origin[2]);

View File

@ -325,7 +325,7 @@ stock fm_remove_entity_name(const classname[]) {
stock fm_ViewContents(id) { stock fm_ViewContents(id) {
new origin[3], Float:Orig[3]; new origin[3], Float:Orig[3];
get_user_origin(id, origin, 3); get_user_origin(id, origin, Origin_AimEndEyes);
IVecFVec(origin, Orig); IVecFVec(origin, Orig);
return fm_point_contents(Orig); return fm_point_contents(Orig);