Advertisement
ipsBruno

(Pawn) Pegar metros/kilometros

Jun 16th, 2012
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.97 KB | None | 0 0
  1. // -----------------------------------------------------------
  2.  
  3. #include a_samp
  4.  
  5. // -----------------------------------------------------------
  6.  
  7.  
  8. new
  9.     gMetrosRodados[MAX_VEHICLES] = {0, ...}
  10. ;
  11.  
  12. // -----------------------------------------------------------
  13.  
  14. #define MetrosRodados(%0)  \
  15.         gMetrosRodados[%0]
  16.  
  17.  
  18. #define KilometrosRodados(%0)  \
  19.         (gMetrosRodados[%0] / 1000)
  20.  
  21. // -----------------------------------------------------------
  22.  
  23.  
  24. public OnFilterScriptInit() {
  25.     SetTimer("metrosRodados", 1000, true);
  26.     return true;
  27. }
  28.  
  29. // -----------------------------------------------------------
  30. forward metrosRodados();
  31. public metrosRodados() {
  32.  
  33.     static
  34.         Float:x,
  35.         Float:y,
  36.         Float:z;
  37.  
  38.     for(new i; i != MAX_VEHICLES; ++i) {
  39.         if(GetVehicleModel(i)) {
  40.             GetVehicleVelocity(i, x, y, z);
  41.             gMetrosRodados[i] += (floatround(floatsqroot(x*x + y*y + z*z ) * 180 / 3.6));
  42.         }
  43.     }
  44.     return true;
  45. }
  46.  
  47. // -----------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement