Giovanni94m

www.GTA-Center.com

Jun 7th, 2011
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.29 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define MAX_SPIKESTRIPS 20
  4.  
  5. enum sInfo
  6. {
  7.     sCreated,
  8.     Float:sX,
  9.     Float:sY,
  10.     Float:sZ,
  11.     sObject,
  12. };
  13. new SpikeInfo[MAX_SPIKESTRIPS][sInfo];
  14.  
  15. stock SpikeStrips_OnPlayerUpdate(playerid)
  16. {
  17.     if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
  18.     {
  19.         for(new i = 0; i < sizeof(SpikeInfo); i++)
  20.         {
  21.             if(IsPlayerInRangeOfPoint(playerid, 3.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
  22.             {
  23.                 if(SpikeInfo[i][sCreated] == 1)
  24.                 {
  25.                     new panels, doors, lights, tires;
  26.                     new carid = GetPlayerVehicleID(playerid);
  27.                     GetVehicleDamageStatus(carid, panels, doors, lights, tires);
  28.                     tires = encode_tires(1, 1, 1, 1);
  29.                     UpdateVehicleDamageStatus(carid, panels, doors, lights, tires);
  30.                     return 0;
  31.                 }
  32.             }
  33.         }
  34.     }
  35.  
  36.     return 1;
  37. }
  38.  
  39. stock CreateStrip(Float:x,Float:y,Float:z,Float:Angle)
  40. {
  41.     for(new i = 0; i < sizeof(SpikeInfo); i++)
  42.     {
  43.         if(SpikeInfo[i][sCreated] == 0)
  44.         {
  45.             SpikeInfo[i][sCreated]=1;
  46.             SpikeInfo[i][sX]=x;
  47.             SpikeInfo[i][sY]=y;
  48.             SpikeInfo[i][sZ]=z-0.7;
  49.             SpikeInfo[i][sObject] = CreateDynamicObject(2899, x, y, z-0.9, 0, 0, Angle-90);
  50.             return 1;
  51.         }
  52.     }
  53.     return 0;
  54. }
  55.  
  56. stock DeleteAllStrip()
  57. {
  58.     for(new i = 0; i < sizeof(SpikeInfo); i++)
  59.     {
  60.         if(SpikeInfo[i][sCreated] == 1)
  61.         {
  62.             SpikeInfo[i][sCreated]=0;
  63.             SpikeInfo[i][sX]=0.0;
  64.             SpikeInfo[i][sY]=0.0;
  65.             SpikeInfo[i][sZ]=0.0;
  66.             DestroyObject(SpikeInfo[i][sObject]);
  67.         }
  68.     }
  69.     return 0;
  70. }
  71.  
  72. stock DeleteClosestStrip(playerid)
  73. {
  74.     for(new i = 0; i < sizeof(SpikeInfo); i++)
  75.     {
  76.         if(IsPlayerInRangeOfPoint(playerid, 2.0, SpikeInfo[i][sX], SpikeInfo[i][sY], SpikeInfo[i][sZ]))
  77.         {
  78.             if(SpikeInfo[i][sCreated] == 1)
  79.             {
  80.                 SpikeInfo[i][sCreated]=0;
  81.                 SpikeInfo[i][sX]=0.0;
  82.                 SpikeInfo[i][sY]=0.0;
  83.                 SpikeInfo[i][sZ]=0.0;
  84.                 DestroyObject(SpikeInfo[i][sObject]);
  85.                 return 1;
  86.             }
  87.         }
  88.     }
  89.     return 0;
  90. }
  91.  
  92. stock encode_tires(tires1, tires2, tires3, tires4) {
  93.  
  94.     return tires1 | (tires2 << 1) | (tires3 << 2) | (tires4 << 3);
  95.  
  96. }
  97.  
  98.  
  99.  
  100.  
  101.  
  102. #define MAX_ROADBLOCKS 20
  103.  
  104. enum rInfo
  105. {
  106.     sCreated,
  107.     Float:sX,
  108.     Float:sY,
  109.     Float:sZ,
  110.     sObject,
  111. };
  112. new Roadblocks[MAX_ROADBLOCKS][rInfo];
  113.  
  114. stock CreateRoadblock(Object,Float:x,Float:y,Float:z,Float:Angle)
  115. {
  116.     for(new i = 0; i < sizeof(Roadblocks); i++)
  117.         {
  118.             if(Roadblocks[i][sCreated] == 0)
  119.             {
  120.             Roadblocks[i][sCreated] = 1;
  121.             Roadblocks[i][sX] = x;
  122.             Roadblocks[i][sY] = y;
  123.             Roadblocks[i][sZ] = z-0.7;
  124.             Roadblocks[i][sObject] = CreateDynamicObject(Object, x, y, z-0.9, 0, 0, Angle);
  125.                 return 1;
  126.             }
  127.         }
  128.         return 0;
  129. }
  130.  
  131. stock DeleteAllRoadblocks(playerid)
  132. {
  133.     for(new i = 0; i < sizeof(Roadblocks); i++)
  134.         {
  135.             if(IsPlayerInRangeOfPoint(playerid, 100, Roadblocks[i][sX], Roadblocks[i][sY], Roadblocks[i][sZ]))
  136.         {
  137.                     if(Roadblocks[i][sCreated] == 1)
  138.                     {
  139.                         Roadblocks[i][sCreated] = 0;
  140.                         Roadblocks[i][sX] = 0.0;
  141.                         Roadblocks[i][sY] = 0.0;
  142.                         Roadblocks[i][sZ] = 0.0;
  143.                         DestroyObject(Roadblocks[i][sObject]);
  144.                     }
  145.             }
  146.         }
  147.     return 0;
  148. }
  149.  
  150. stock DeleteClosestRoadblock(playerid)
  151. {
  152.     for(new i = 0; i < sizeof(Roadblocks); i++)
  153.         {
  154.             if(IsPlayerInRangeOfPoint(playerid, 5.0, Roadblocks[i][sX], Roadblocks[i][sY], Roadblocks[i][sZ]))
  155.         {
  156.                 if(Roadblocks[i][sCreated] == 1)
  157.             {
  158.                 Roadblocks[i][sCreated] = 0;
  159.                 Roadblocks[i][sX] = 0.0;
  160.                 Roadblocks[i][sY] = 0.0;
  161.                 Roadblocks[i][sZ] = 0.0;
  162.                 DestroyObject(Roadblocks[i][sObject]);
  163.                 return 1;
  164.                 }
  165.             }
  166.         }
  167.     return 0;
  168. }
Add Comment
Please, Sign In to add comment