Aleks11

Backward driving

Mar 8th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <a_samp>
  2. main() {}
  3. forward MObject();
  4. public OnPlayerCommandText(playerid,cmdtext[])
  5. {
  6. SetTimer("MObject",500,1);
  7. return 1;
  8. }
  9. public MObject() {
  10. new veh = GetPlayerVehicleID(0);
  11.  
  12. new str[64];
  13.  
  14. new Float:x, Float:y, Float:z, Float:a1;
  15. GetVehicleVelocity(veh, x, y, z);
  16.  
  17. GetVehicleZAngle(veh, a1);
  18.  
  19. new Float:c = floatsqroot(x * x + y * y);
  20. new Float:a = asin(y / c);
  21.  
  22. if (x < 0) a = 90 - a;
  23. else a = 270 + a;
  24.  
  25. if (a1 >= 180.0) a1 -= 180.0;
  26. else a1 += 180.0;
  27.  
  28. if (floatabs(a1-a) < 10.0 && c > 1.0) format(str, 64, "You drive backward!");
  29.  
  30. format(str, 64, "%s Angle 1: %.2f, Angle 2: %.2f", str, a, a1);
  31. SendClientMessage(0, 0xFFFFFFFF, str);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment