Advertisement
Retracer

Get drift angle

Dec 13th, 2023 (edited)
1,839
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.80 KB | Source Code | 0 0
  1. // Автор: Randy | Author: Randy | vk.com/id136437037
  2. Float:GetDriftAngle(playerid) // Получаем угол заноса автомобиля | We get the car's skid angle
  3. {
  4.     new RequiredCarID = GetPlayerVehicleID(playerid), Float:Veh_Z_Angle, Float:Veh_Velocity[3], Float:Speed_Angle, Float:Drift_Angle
  5.     GetVehicleZAngle(RequiredCarID, Veh_Z_Angle)
  6.     GetVehicleVelocity(RequiredCarID, Veh_Velocity[0], Veh_Velocity[1], Veh_Velocity[2])
  7.     Speed_Angle = 360.0 - atan2(Veh_Velocity[0], Veh_Velocity[1])
  8.     Drift_Angle = floatabs(Veh_Z_Angle - Speed_Angle)
  9.     if(Drift_Angle < 0.0 || Drift_Angle > 180.0) Drift_Angle = 360.0 - Drift_Angle
  10.     if(Drift_Angle > 90.0) Drift_Angle = 90.0
  11.     if(Veh_Velocity[0] == 0 || Veh_Velocity[1] == 0 || Veh_Velocity[2] == 0) Drift_Angle = 0.0
  12.     return floatabs(Drift_Angle)
  13. }
Tags: samp pawn Drift
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement