Advertisement
Guest User

Untitled

a guest
Oct 28th, 2013
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. /*
  2. Don't remove credits
  3. Filterscript by: Jake Hunter
  4. Engine starts on press 2
  5. */
  6. #define FILTERSCRIPT
  7.  
  8. #include <a_samp>
  9.  
  10. #define COL_GRESKA "{FF0000}"
  11. #define COL_RWHITE "{FFFFFF}"
  12. #define COL_INFO "{37F906}"
  13. #define COLOR_GRAD1 0xB4B5B7FF
  14. #define COLOR_GRAD2 0xBFC0C2FF
  15. #define COLOR_GRAD3 0xCBCCCEFF
  16. #define COLOR_GRAD4 0xD8D8D8FF
  17. #define COLOR_GRAD5 0xE3E3E3FF
  18. #define COLOR_GRAD6 0xF0F0F0FF
  19. #define COLOR_GREY 0xAFAFAFAA
  20. #define COLOR_GREEN 0x33AA33AA
  21. #define COLOR_RED 0xAA3333AA
  22. #define COLOR_LIGHTRED 0xFF6347AA
  23. #define COLOR_LIGHTBLUE 0x33CCFFAA
  24. #define COLOR_LIGHTGREEN 0x9ACD32AA
  25. #define COLOR_YELLOW 0xFFFF00AA
  26. #define COLOR_YELLOW2 0xF5DEB3AA
  27. #define COLOR_WHITE 0xFFFFFFAA
  28. #define COLOR_FADE1 0xE6E6E6E6
  29. #define COLOR_FADE2 0xC8C8C8C8
  30. #define COLOR_FADE3 0xAAAAAAAA
  31. #define COLOR_FADE4 0x8C8C8C8C
  32. #define COLOR_FADE5 0x6E6E6E6E
  33. #define COLOR_PURPLE 0xC2A2DAAA
  34.  
  35.  
  36.  
  37.  
  38. forward HEngine(playerid,vehicleid);
  39. forward ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5);
  40. forward ProxDetectorS(Float:radi, playerid, targetid);
  41.  
  42. new bool:EngineState[MAX_VEHICLES];
  43. new Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective;
  44.  
  45. #if defined FILTERSCRIPT
  46.  
  47.  
  48. public OnFilterScriptInit()
  49. {
  50. print("\n--------------------------------------");
  51. print(" Engine System:Jake Hunter");
  52. print("--------------------------------------\n");
  53. print(" Engine System:Jake Hunter Loaded....");
  54. for(new Vehicles = 0; Vehicles < MAX_VEHICLES; Vehicles++)
  55. {
  56. GetVehicleParamsEx(Vehicles, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  57. SetVehicleParamsEx(Vehicles, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  58. }
  59. return 1;
  60. }
  61.  
  62. public OnFilterScriptExit()
  63. {
  64. return 1;
  65. }
  66.  
  67. #else
  68.  
  69. main()
  70. {
  71. print("\n----------------------------------------");
  72. print(" To start the vehicle engine press 2");
  73. print("----------------------------------------\n");
  74. }
  75.  
  76. #endif
  77.  
  78. public HEngine(playerid,vehicleid)
  79. {
  80. GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  81. if(EngineState[vehicleid]==false)
  82. {
  83. SetVehicleParamsEx(vehicleid, 1, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  84. new pName[24];
  85. new string[128];
  86. GetPlayerName(playerid, pName, 24);
  87. format(string, 128, "|%s turning the key.", pName);
  88. format(string, 128, "|%s starts the engine.", pName);
  89. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  90. SendClientMessage(playerid, COLOR_WHITE,"Engine is {33AA33}Started!");
  91. EngineState[vehicleid] = true;
  92. }
  93. else
  94. {
  95. SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  96. SendClientMessage(playerid, COLOR_WHITE,"Engine is {FF0000}OFF!");
  97. EngineState[vehicleid] = false;
  98. }
  99. }
  100.  
  101. public OnVehicleSpawn(vehicleid)
  102. {
  103. GetVehicleParamsEx(vehicleid, Hengine, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  104. SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  105. EngineState[vehicleid] = false;
  106. return 1;
  107. }
  108.  
  109. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  110. {
  111. if(!ispassenger)
  112. {
  113. SetVehicleParamsEx(vehicleid, 0, Hlights, Halarm, Hdoors, Hbonnet, Hboot, Hobjective);
  114. EngineState[vehicleid] = false;
  115. SendClientMessage(playerid,COLOR_LIGHTRED,"{37F906}INFO:{FFFFFF}Press 2 to start the engine");
  116. }
  117. return 1;
  118. }
  119.  
  120. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  121. {
  122. if(newkeys == KEY_SUBMISSION)
  123. {
  124. new vehicleid;
  125. vehicleid = GetPlayerVehicleID(playerid);
  126. new playerState = GetPlayerState(playerid);
  127. if (playerState == PLAYER_STATE_DRIVER)
  128. {
  129. if(EngineState[vehicleid] == true)
  130. {
  131. new pName[24];
  132. new string[128];
  133. GetPlayerName(playerid, pName, 24);
  134. format(string, 128, "|%s disconnect the engine.", pName);
  135. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  136. SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
  137. }
  138. else
  139. {
  140. SetTimerEx("HEngine",1,0,"dd",playerid,vehicleid);
  141. EngineState[vehicleid] = false;
  142. }
  143. }
  144. }
  145. return 1;
  146. }
  147.  
  148. public ProxDetector(Float:radi, playerid, string[],col1,col2,col3,col4,col5)
  149. {
  150. if(IsPlayerConnected(playerid))
  151. {
  152. new Float:posx, Float:posy, Float:posz;
  153. new Float:oldposx, Float:oldposy, Float:oldposz;
  154. new Float:tempposx, Float:tempposy, Float:tempposz;
  155. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  156. for(new i = 0; i < MAX_PLAYERS; i++)
  157. {
  158. if(IsPlayerConnected(i) && (GetPlayerVirtualWorld(playerid) == GetPlayerVirtualWorld(i)))
  159. {
  160. GetPlayerPos(i, posx, posy, posz);
  161. tempposx = (oldposx -posx);
  162. tempposy = (oldposy -posy);
  163. tempposz = (oldposz -posz);
  164. if (((tempposx < radi/16) && (tempposx > -radi/16)) && ((tempposy < radi/16) && (tempposy > -radi/16)) && ((tempposz < radi/16) && (tempposz > -radi/16)))
  165. {
  166. SendClientMessage(i, col1, string);
  167. }
  168. else if (((tempposx < radi/8) && (tempposx > -radi/8)) && ((tempposy < radi/8) && (tempposy > -radi/8)) && ((tempposz < radi/8) && (tempposz > -radi/8)))
  169. {
  170. SendClientMessage(i, col2, string);
  171. }
  172. else if (((tempposx < radi/4) && (tempposx > -radi/4)) && ((tempposy < radi/4) && (tempposy > -radi/4)) && ((tempposz < radi/4) && (tempposz > -radi/4)))
  173. {
  174. SendClientMessage(i, col3, string);
  175. }
  176. else if (((tempposx < radi/2) && (tempposx > -radi/2)) && ((tempposy < radi/2) && (tempposy > -radi/2)) && ((tempposz < radi/2) && (tempposz > -radi/2)))
  177. {
  178. SendClientMessage(i, col4, string);
  179. }
  180. else if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  181. {
  182. SendClientMessage(i, col5, string);
  183. }
  184. }
  185. else
  186. {
  187. SendClientMessage(i, col1, string);
  188. }
  189. }
  190. }
  191. return 1;
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement