GetPlayerLastShotVectors
Description:
Function GetPlayerLastShotVectors retrieves the start and end (hit) position of the last bullet a player fired.
Function GetPlayerLastShotVectors was added in 0.3z and will not work in earlier versions! |
|
Parameters:
(playerid, Float:fOriginX, Float:fOriginY, Float:fOriginZ, Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ)
int | playerid | The ID of the player to get the last bullet shot information of. |
float | fOriginX | A float variable in which to save the X coordinate of where the bullet originated from. |
float | fOriginY | A float variable in which to save the Y coordinate of where the bullet originated from. |
float | fOriginZ | A float variable in which to save the Z coordinate of where the bullet originated from. |
float | fHitPosX | A float variable in which to save the X coordinate of where the bullet hit. |
float | fHitPosY | A float variable in which to save the Y coordinate of where the bullet hit. |
float | fHitPosZ | A float variable in which to save the Z coordinate of where the bullet hit. |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. The player specified does not exist.
Examples:
public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/lastshot", true) == 0) { new lsString[128], Float:fOriginX, Float:fOriginY, Float:fOriginZ, Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ; GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ); format(lsString, 128, "Last Shot Information: Origin: %f, %f, %f. Hit position: %f, %f, %f", fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ); SendClientMessage(playerid, -1, lsString); return 1; } return 0; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerWeaponData: Find out information about weapons a player has.
- GetPlayerWeapon: Check what weapon a player is currently holding.
- VectorSize: Get the length (norm) of a vector.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnPlayerWeaponShot: Called when a player fires a weapon.