Advertisement
Johurt

[FNC] FixTire

Dec 25th, 2014
488
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.40 KB | None | 0 0
  1. /*
  2.         FixTire by Johurt, 2014/12/25
  3. */
  4. stock FixTire(vehicleid, tireid, bool:isbike = false)
  5. {
  6.     new p, d, l, tirestate;
  7.     GetVehicleDamageStatus(vehicleid, p, d, l, tirestate);
  8.     new c, t[4];
  9.     if(!isbike)
  10.     {
  11.         if(!(0 < tireid < 5)) return 1;
  12.         while(tirestate > 15) tirestate -= 16;
  13.         new v_t[16][4] =
  14.         {
  15.             {0, 0, 0, 0},
  16.                 {0, 0, 0, 1},
  17.                 {0, 1, 0, 0},
  18.                 {0, 1, 0, 1},
  19.             {0, 0, 1, 0},
  20.             {0, 0, 1, 1},
  21.             {0, 1, 1, 0},
  22.             {0, 1, 1, 1},
  23.             {1, 0, 0, 0},
  24.             {1, 0, 0, 1},
  25.             {1, 1, 0, 0},
  26.             {1, 1, 0, 1},
  27.             {1, 0, 1, 0},
  28.             {1, 0, 1, 1},
  29.             {1, 1, 1, 0},
  30.             {1, 1, 1, 1}
  31.         };
  32.         t[0] = v_t[tirestate][0];
  33.         t[1] = v_t[tirestate][1];
  34.         t[2] = v_t[tirestate][2];
  35.         t[3] = v_t[tirestate][3];
  36.         t[tireid-1] = 0;
  37.         for(c = 0; c < 16; c++)
  38.         {
  39.             if(t[0] == v_t[c][0] && t[1] == v_t[c][1] && t[2] == v_t[c][2] && t[3] == v_t[c][3])
  40.                 {
  41.                 UpdateVehicleDamageStatus(vehicleid, p, d, l, c);
  42.                     break;
  43.                 }
  44.         }
  45.     }
  46.     else
  47.     {
  48.         if(!(0 < tireid < 3)) return 1;
  49.         while(tirestate > 3) tirestate -= 4;
  50.             new m_t[4][2] =
  51.         {
  52.             {0, 0},
  53.                 {0, 1},
  54.                 {1, 0},
  55.                 {1, 1}
  56.         };
  57.         t[0] = m_t[tirestate][0];
  58.         t[1] = m_t[tirestate][1];
  59.         t[tireid-1] = 0;
  60.         for(c = 0; c < 4; c++)
  61.         {
  62.             if(t[0] == m_t[c][0] && t[1] == m_t[c][1])
  63.             {
  64.                 UpdateVehicleDamageStatus(vehicleid, p, d, l, c);
  65.                     break;
  66.                 }
  67.         }
  68.     }
  69.     return 1;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement