GetVehiclePos

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:19, 27 September 2011
Smithy (Talk | contribs)
(Related functions)
← Previous diff
Revision as of 17:22, 2 February 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
{{Description|Saves the x, y and z position of a vehicle in variables.}} {{Description|Saves the x, y and z position of a vehicle in variables.}}
Line 41: Line 40:
[[Category:Scripting Functions]] [[Category:Scripting Functions]]
 +[[fr:GetVehiclePos]]
[[ru:GetVehiclePos]] [[ru:GetVehiclePos]]

Revision as of 17:22, 2 February 2014



Description:

Saves the x, y and z position of a vehicle in variables.


Parameters:
(vehicleid, &Float:X, &Float:Y, &Float:Z)
vehicleidThe ID of the vehicle.
Float:XThe variable to store the X coordinate, passed by reference.
Float:YThe variable to store the Y coordinate, passed by reference.
Float:ZThe variable to store the Z coordinate, passed by reference.


Return Values:

This function does not return any specific values.


public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/vehpos", true) == 0)
     {
          new currentveh;
          currentveh = GetPlayerVehicleID(playerid);
 
          new Float:vehx, Float:vehy, Float:vehz;
          GetVehiclePos(currentveh, vehx, vehy, vehz);
 
          new vehpostext[96];
          format(vehpostext, sizeof(vehpostext), "The current vehicle positions are: %f, %f, %f", vehx, vehy, vehz);
 
          SendClientMessage(playerid, 0xFFFFFFFF, vehpostext);
          return 1;
     }
 
     return 0;
}

Related Functions

The following functions may be useful, as they are related to this function in one way or another.

In other languages