GetPlayerLastShotVectors

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 12:05, 28 January 2014
Blantas (Talk | contribs)
(Fixed the example.)
← Previous diff
Revision as of 15:46, 31 January 2014
Connor Mead (Talk | contribs)

Next diff →
Line 42: Line 42:
[[Category:Scripting Functions]] [[Category:Scripting Functions]]
 +[[fr:GetPlayerLastShotVectors]]

Revision as of 15:46, 31 January 2014



GetPlayerLastShotVectors was added in SA-MP 0.3z This function was added in SA-MP 0.3z and will not work in earlier versions!


Description:

Retrieves the vector of the last shot a player fired.


Parameters:
(playerid, &Float:fOriginX, &Float:fOriginY, &Float:fOriginZ, &Float:fHitPosX, &Float:fHitPosY, &Float:fHitPosZ)
playeridThe ID of the player to get the last bullet shot information of.
&Float:fOriginXThe float variable to save the origin in the X direction to.
&Float:fOriginYThe float variable to save the origin in the Y direction to.
&Float:fOriginZThe float variable to save the origin in the Z direction to.
&Float:fHitPosXThe float variable to save the hit position in the X direction to.
&Float:fHitPosYThe float variable to save the hit position in the Y direction to.
&Float:fHitPosYThe float variable to save the hit position in the Z direction to.


Return Values:

The function itself doesn't return a specific value. The positions are stored in the referenced variables.


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.


Related Callbacks

The following callbacks might be useful, as they're related to this function in one way or another.

In other languages