GetVehicleZAngle

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 06:17, 6 July 2016
AbyssMorgan (Talk | contribs)
(Add GetVehicleRotation)
← Previous diff
Current revision
OstGot (Talk | contribs)

Line 3: Line 3:
{{Description|Get the rotation of a vehicle on the Z axis (yaw).}} {{Description|Get the rotation of a vehicle on the Z axis (yaw).}}
-{{Parameters|vehicleid, &Float:z_angl}}+{{Parameters|vehicleid, &Float:z_angle}}
{{Param|vehicleid|The ID of the vehicle to get the Z angle of.}} {{Param|vehicleid|The ID of the vehicle to get the Z angle of.}}
-{{Param|Float:z_angl|A float variable in which to store the Z rotation, passed by reference.}}+{{Param|Float:z_angle|A float variable in which to store the Z rotation, passed by reference.}}
-{{ReturnsSuccess||This means the vehicle does not exist.}}+{{ReturnsSuccess||This means the vehicle does not exist.
 +* The vehicle's rotation is stored in the specified variable.}}
{{Example}} {{Example}}

Current revision



Description:

Get the rotation of a vehicle on the Z axis (yaw).


Parameters:
(vehicleid, &Float:z_angle)
vehicleidThe ID of the vehicle to get the Z angle of.
Float:z_angleA float variable in which to store the Z rotation, passed by reference.


Return Values:

  • 1: The function executed successfully.
  • 0: The function failed to execute. This means the vehicle does not exist.
  • The vehicle's rotation is stored in the specified variable.


Example Usage:

public OnPlayerCommandText(playerid, cmdtext[])
{
     if(strcmp(cmdtext, "/vehrot", true) == 0)
     {
          new currentveh;
          new Float:z_rot;
          new message[40];
 
          currentveh = GetPlayerVehicleID(playerid);
 
          GetVehicleZAngle(currentveh, z_rot);
 
          format(message, sizeof(message), "The current vehicle rotation is: %.0f", z_rot);
 
          SendClientMessage(playerid, 0xFFFFFFFF, message);
 
          return 1;
     }
 
     return 0;
}

Related Functions

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

Personal tools
In other languages