Guest User

Untitled

a guest
Aug 9th, 2014
430
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. #define FILTERSCRIPT
  5.  
  6. forward FlasherFunc();
  7.  
  8. new obj[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
  9. new obj2[MAX_VEHICLES] = { INVALID_OBJECT_ID, ... };
  10. new LightPwr[MAX_VEHICLES];
  11. new Flasher[MAX_VEHICLES] = 0;
  12. new FlasherState[MAX_VEHICLES];
  13. new FlashTimer;
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. print("\n--------------------------------------");
  18. print(" Policijska Rotacija");
  19. print(" By .Fortress");
  20. print("--------------------------------------\n");
  21.  
  22. for (new x=0; x<MAX_VEHICLES; x++)
  23. {
  24. LightPwr[x]=1;
  25. Flasher[x]=0;
  26. FlasherState[x]=0;
  27. }
  28.  
  29. FlashTimer = SetTimer("FlasherFunc",200,1); // "200" is the speed from the flashing headlights
  30. return 1;
  31. }
  32.  
  33. public OnFilterScriptExit()
  34. {
  35. KillTimer(FlashTimer);
  36. for (new i = 0; i < MAX_VEHICLES; i++)
  37. {
  38. DestroyObject(obj[i]);
  39. DestroyObject(obj2[i]);
  40. }
  41. return 1;
  42. }
  43.  
  44.  
  45.  
  46.  
  47. public OnVehicleSpawn(vehicleid)
  48. {
  49. DestroyObject(obj[vehicleid]);
  50. DestroyObject(obj2[vehicleid]);
  51. Flasher[vehicleid] = 0;
  52. return 1;
  53. }
  54.  
  55. public OnVehicleDeath(vehicleid, killerid)
  56. {
  57. DestroyObject(obj[vehicleid]);
  58. DestroyObject(obj2[vehicleid]);
  59. Flasher[vehicleid] = 0;
  60. return 1;
  61. }
  62.  
  63. command(flash, playerid, params[])
  64. {
  65. new vehicleid,panels,doors,lights,tires;
  66. vehicleid = GetPlayerVehicleID(playerid);
  67. if(!Flasher[vehicleid]) {
  68. if (GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  69. {
  70. return SendClientMessage(playerid, -1, "* Vi niste vozac!");
  71. }
  72. if (!GetVehicleModel(vehicleid)) return SendClientMessage(playerid, -1, "* Niste u vozilu!");
  73. if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid]))
  74. {
  75. SendClientMessage(playerid, -1, "Ugasili ste rotaciju."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);
  76. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  77. if(LightPwr[vehicleid] == 1)
  78. UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
  79. else
  80. UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
  81. Flasher[vehicleid] = 0;
  82. }
  83. switch (GetVehicleModel(vehicleid))
  84. {
  85. case 596:
  86. {
  87. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  88. obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  89. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
  90. AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
  91. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  92. Flasher[vehicleid] = 1;
  93. }
  94. case 597:
  95. {
  96. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  97. obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  98. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
  99. AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.599999,-0.375000,0.899999,0.000000,0.000000,0.000000);
  100.  
  101. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  102. Flasher[vehicleid] = 1;
  103. }
  104. case 598:
  105. {
  106. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  107. obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  108. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
  109. AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999, -0.300000, 0.899999, 0.000000, 0.000000, 0.000000);
  110. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  111. Flasher[vehicleid] = 1;
  112. }
  113. case 599:
  114. {
  115. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  116. obj2[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  117. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
  118. AttachObjectToVehicle(obj2[vehicleid], vehicleid, -0.524999,0.000000,1.125000,0.000000,0.000000,0.000000);
  119. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  120. Flasher[vehicleid] = 1;
  121. }
  122. case 541://bullet
  123. {
  124. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  125. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.375000,0.524999,0.375000,0.000000,0.000000,0.000000);
  126.  
  127. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  128. Flasher[vehicleid] = 1;
  129. }
  130. case 426://premier
  131. {
  132. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  133. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.524999,0.749999,0.375000,0.000000,0.000000,0.000000);
  134.  
  135. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  136. Flasher[vehicleid] = 1;
  137. }
  138. case 427://enforcer
  139. {
  140. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  141. Flasher[vehicleid] = 1;
  142. }
  143. case 416://Ambulance
  144. {
  145. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  146. Flasher[vehicleid] = 1;
  147. }
  148. case 407://FireTruck
  149. {
  150. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  151. Flasher[vehicleid] = 1;
  152. }
  153. case 560://sultan
  154. {
  155. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  156. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.225000,0.750000,0.449999,0.000000,0.000000,0.000000);
  157. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  158. Flasher[vehicleid] = 1;
  159. }
  160. case 490://FBI
  161. {
  162. obj[vehicleid] = CreateObject(18646, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  163. AttachObjectToVehicle(obj[vehicleid], vehicleid, 0.000000,1.125000,0.599999,0.000000,0.000000,0.000000);
  164. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  165. Flasher[vehicleid] = 1;
  166. }
  167. default:
  168. {
  169. return SendClientMessage(playerid, -1, "Niste u Policijskom vozilu kompatibilnom za rotaciju!");
  170. }
  171. }
  172. return SendClientMessage(playerid, -1, "Rotacija upaljena, trenutno vozite pod rotacijom!");
  173. } else {
  174. if (IsValidObject(obj[vehicleid]) || IsValidObject(obj2[vehicleid])) {
  175. SendClientMessage(playerid, -1, "Ugasili ste rotaciju."), DestroyObject(obj[vehicleid]), DestroyObject(obj2[vehicleid]);
  176. }
  177. GetVehicleDamageStatus(vehicleid,panels,doors,lights,tires);
  178. if(LightPwr[vehicleid] == 1)
  179. UpdateVehicleDamageStatus(vehicleid, panels, doors, 0, tires);
  180. else
  181. UpdateVehicleDamageStatus(vehicleid, panels, doors, 5, tires);
  182. Flasher[vehicleid] = 0;
  183. }
  184. return 1;
  185. }
  186.  
  187. public FlasherFunc() {
  188. new panelsx,doorsx,lightsx,tiresx;
  189. for (new p=0; p<MAX_VEHICLES; p++)
  190. {
  191. if (Flasher[p] == 1)
  192. {
  193. if (FlasherState[p] == 1)
  194. {
  195. GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
  196. UpdateVehicleDamageStatus(p, panelsx, doorsx, 4, tiresx);
  197. FlasherState[p] = 0;
  198. }
  199. else
  200. {
  201. GetVehicleDamageStatus(p,panelsx,doorsx,lightsx,tiresx);
  202. UpdateVehicleDamageStatus(p, panelsx, doorsx, 1, tiresx);
  203. FlasherState[p] = 1;
  204. }
  205. }
  206. }
  207. return 1;
  208. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×