Guest User

Mechanic

a guest
Mar 14th, 2011
581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.44 KB | None | 0 0
  1. /**************************************************************
  2. * TICKET SYSTEM *
  3. * ^^ *
  4. * (o )o) (o )o) *
  5. * <-- | --> .: By Iron Smith :. <-- | --> *
  6. * / \ / \ *
  7. ***************************************************************/
  8. //======================================COLORS==================================
  9. //===============================COLORS=========================================
  10. #include <a_samp>
  11. #include <zcmd>
  12. #include <colors>
  13. #include <sscanf2>
  14. //======================================COLORS==================================
  15. //===============================COLORS=========================================
  16. #define COLOR_PURPLE 0xC2A2DAAA
  17. #define COLOR_WHITE 0xFFFFFFAA
  18. #define COLOR_ASKQ 0xFF0000FF
  19. #define COLOR_RED 0xAA3333AA
  20. //======================================NEWS====================================
  21. //===============================NEWS===========================================
  22. new pilet;
  23. new mehaanikugaraaz;
  24. new Info[2];
  25. new MechanicTicket[MAX_PLAYERS];
  26. //======================================FORWARDS================================
  27. //===============================FORWARDS=======================================
  28. forward Mechanic();
  29. forward Mechanic1();
  30. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  31. //======================================MECHANIC FORWARDS=======================
  32. //===============================MECHANIC FORWARDS==============================
  33. forward Meha(playerid);
  34. //======================================COMMANDS================================
  35. //===============================COMMANDS=======================================
  36. COMMAND:mechanicpark(playerid, params[])
  37. {
  38. if(MechanicTicket[playerid] == 0) return SendClientMessage(playerid, 0xDEEE20FF, "{CC0000}You don't have ticket ! {00FF66}Go in ticket shop !{6600FF} Or use /TicketShop");
  39. if (PlayerToPoint(15, playerid,777.81134033203,-1384.7808837891,14.396675109863))
  40. {
  41. MoveObject(pilet,769.81134033203, -1384.7808837891, 14.396675109863, 1.5);
  42. SetTimer("Mechanic", 9000, 0);
  43. SendClientMessage(playerid, COLOR_WHITE, "{FF0066}Drive {CC0000}in / out{00FF66} now !");
  44. return 1;
  45. }
  46. else if(MechanicTicket[playerid] == 0) return SendClientMessage(playerid, 0xDEEE20FF, "{CC0000}You don't have ticket !{00FF66} Go in ticket shop !{6600FF} Or use /TicketShop");
  47. else if (PlayerToPoint(15, playerid,778.13708496094, -1330.2126464844, 14.225667953491))
  48. {
  49. MoveObject(mehaanikugaraaz,769.13708496094, -1330.2126464844, 14.225667953491, 1.5);
  50. SetTimer("Mechanic1", 9000, 0);
  51. SendClientMessage(playerid, COLOR_WHITE, "{FF0066}Drive {CC0000}in / out{00FF66} now !");
  52. return 1;
  53. }
  54. return 0;
  55. }
  56. //------------------------------------------------------------------------------
  57. COMMAND:ticketshop(playerid, params[])
  58. {
  59. SendClientMessage(playerid, COLOR_BLUE,"{6600FF}Mechanic Park positsion is on your mobile .{FF0066} (( For Deleting, use /ticketoff ))");
  60. SetPlayerCheckpoint(playerid, 781.8751,-1389.6136,13.6079, 5.0);
  61. return 1;
  62. }
  63. //------------------------------------------------------------------------------
  64. COMMAND:ticketoff(playerid, params[])
  65. {
  66. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have deleted your positsion !{6600FF} See you soon :D");
  67. DisablePlayerCheckpoint(playerid);
  68. return 1;
  69. }
  70. //======================================PUBLICS=================================
  71. //===============================PUBLICS========================================
  72. public OnFilterScriptInit()
  73. {
  74. print("\n--------------------------------------");
  75. print(" Ticket system by Iron is loaded (Y)");
  76. print("--------------------------------------\n");
  77.  
  78. Info[0] = CreatePickup(1318, 23, 783.2847,-1387.5400,13.6589);
  79. Info[1] = CreatePickup(1318, 23, 784.5626,-1327.5691,13.5469);
  80.  
  81. Create3DTextLabel("{330066}Ticket shop is here,{FF0066} come here !",COLOR_ASKQ,783.2847,-1387.5400,13.6589,25.0, 0);
  82. Create3DTextLabel("{330066}Ticket shop is here,{FF0066} come here !",COLOR_ASKQ,784.5626,-1327.5691,13.5469,25.0, 0);
  83.  
  84. CreateObject(4640,783.89770508,-1385.90368652,14.40236187,0.00000000,0.00000000,0.00000000); //object(paypark_lan03) (1)
  85. CreateObject(4640,783.94940186,-1329.18432617,14.24345493,0.00000000,0.00000000,178.00000000); //object(paypark_lan03) (2)
  86. CreateObject(10282,737.29687500,-1346.92773438,13.52520275,0.00000000,0.00000000,90.00000000); //object(mich_int_sfe) (2)
  87. CreateObject(18262,739.90002441,-1345.47143555,13.00000000,0.00000000,0.00000000,86.00000000); //object(cw2_phroofstuf) (1)
  88. CreateObject(18262,739.90002441,-1348.21899414,13.00000000,0.00000000,0.00000000,85.99548340); //object(cw2_phroofstuf) (2)
  89. CreateObject(18262,739.70910645,-1336.09509277,13.00000000,0.00000000,0.00000000,85.99548340); //object(cw2_phroofstuf) (3)
  90. CreateObject(18262,739.59436035,-1332.68688965,13.00000000,0.00000000,0.00000000,85.99548340); //object(cw2_phroofstuf) (4)
  91. CreateObject(11546,765.02795410,-1377.86315918,12.56000042,0.00000000,0.00000000,178.00000000); //object(desn_fuelpay) (1)
  92. CreateObject(13629,739.83087158,-1370.50683594,25.00000000,0.00000000,0.00000000,338.25000000); //object(8screen01) (1)
  93. CreateObject(1262,782.00000000,-1385.15441895,14.65887070,0.00000000,0.00000000,130.00000000); //object(mtraffic4) (1)
  94. CreateObject(1262,782.14532471,-1329.94104004,14.69999981,0.00000000,0.00000000,39.99951172); //object(mtraffic4) (2)
  95. CreateObject(1297,760.55468750,-1375.64123535,15.98021412,0.00000000,0.00000000,222.00000000); //object(lamppost1) (1)
  96. CreateObject(1297,786.36230469,-1385.85156250,16.10507393,0.00000000,0.00000000,73.99841309); //object(lamppost1) (2)
  97. CreateObject(1297,773.06933594,-1386.11328125,16.07824516,0.00000000,0.00000000,111.99462891); //object(lamppost1) (3)
  98. CreateObject(1297,785.18035889,-1327.83386230,15.94111538,0.00000000,0.00000000,327.99682617); //object(lamppost1) (4)
  99. CreateObject(1297,769.36230469,-1376.08496094,15.99693775,0.00000000,0.00000000,327.99682617); //object(lamppost1) (5)
  100. CreateObject(1297,773.63970947,-1329.04907227,15.94111538,0.00000000,0.00000000,245.99682617); //object(lamppost1) (6)
  101. CreateObject(1676,763.70001221,-1364.49792480,14.29849052,0.00000000,0.00000000,272.00000000); //object(washgaspump) (1)
  102. CreateObject(1676,769.29998779,-1364.52282715,14.29849052,0.00000000,0.00000000,271.99951172); //object(washgaspump) (2)
  103. CreateObject(7391,771.73547363,-1379.66796875,17.51349258,0.00000000,0.00000000,307.99926758); //object(vgngassign102) (2)
  104. CreateObject(11393,736.04071045,-1339.85119629,14.05368042,0.00000000,0.00000000,180.00000000); //object(hubprops1_sfs) (1)
  105. CreateObject(14826,744.92382812,-1353.22949219,13.00000000,0.00000000,0.00000000,0.00000000); //object(int_kbsgarage2) (1)
  106. CreateObject(18452,766.51763916,-1365.56457520,15.46762371,0.00000000,0.00000000,270.00000000); //object(cw_tscanopy01) (1)
  107. CreateObject(1676,769.29998779,-1366.72656250,14.29849052,0.00000000,0.00000000,271.99951172); //object(washgaspump) (3)
  108. CreateObject(1676,763.70001221,-1366.58398438,14.29849052,0.00000000,0.00000000,271.99951172); //object(washgaspump) (4)
  109. CreateObject(7391,758.70452881,-1357.18896484,17.38476562,0.00000000,0.00000000,47.99621582); //object(vgngassign102) (3)
  110. CreateObject(18283,785.12756348,-1335.71240234,12.50000000,0.00000000,0.00000000,270.00000000); //object(cw_fuelpay) (1)
  111. CreateObject(3091,768.56091309,-1342.04394531,13.16643047,0.00000000,0.00000000,182.00000000); //object(imy_track_barrier) (1)
  112. CreateObject(3091,770.97229004,-1344.51916504,13.16937351,0.00000000,0.00000000,89.99499512); //object(imy_track_barrier) (2)
  113. CreateObject(3091,768.23760986,-1346.22644043,13.16603470,0.00000000,0.00000000,359.99548340); //object(imy_track_barrier) (3)
  114. CreateObject(3091,765.94140625,-1344.03808594,13.16323185,0.00000000,0.00000000,271.99401855); //object(imy_track_barrier) (4)
  115. CreateObject(1215,763.53466797,-1362.52746582,13.28194714,0.00000000,0.00000000,0.00000000); //object(bollardlight) (1)
  116. CreateObject(1215,769.42266846,-1362.42810059,13.28194714,0.00000000,0.00000000,0.00000000); //object(bollardlight) (2)
  117. CreateObject(1215,766.39758301,-1342.51452637,13.08711052,0.00000000,0.00000000,0.00000000); //object(bollardlight) (3)
  118. CreateObject(1215,763.76605225,-1368.69274902,13.28909016,0.00000000,0.00000000,0.00000000); //object(bollardlight) (4)
  119. CreateObject(1215,769.34277344,-1368.72656250,13.28194714,0.00000000,0.00000000,0.00000000); //object(bollardlight) (5)
  120. CreateObject(1215,770.26171875,-1346.01660156,13.08778954,0.00000000,0.00000000,0.00000000); //object(bollardlight) (6)
  121. CreateObject(1215,766.51269531,-1346.02343750,13.08320999,0.00000000,0.00000000,0.00000000); //object(bollardlight) (7)
  122. CreateObject(1215,770.28131104,-1342.56762695,13.08781242,0.00000000,0.00000000,0.00000000); //object(bollardlight) (8)
  123. CreateObject(955,786.26312256,-1340.64294434,12.89999962,0.00000000,0.00000000,0.00000000); //object(cj_ext_sprunk) (1)
  124. CreateObject(956,784.01739502,-1340.50170898,12.89999962,0.00000000,0.00000000,0.00000000); //object(cj_ext_candy) (1)
  125. CreateObject(9833,767.97589111,-1343.87658691,15.72321701,0.00000000,0.00000000,0.00000000); //object(fountain_sfw) (1)
  126.  
  127. pilet = CreateObject(975,777.81134033,-1384.78088379,14.39667511,0.00000000,0.00000000,0.00000000);
  128. mehaanikugaraaz = CreateObject(975,778.13708496,-1330.21264648,14.22566795,0.00000000,0.00000000,359.00000000);
  129. return 1;
  130. }
  131. //------------------------------------------------------------------------------
  132. public OnFilterScriptExit()
  133. {
  134. print("\n--------------------------------------");
  135. print(" Ticket system by Iron is unloaded (N)");
  136. print("--------------------------------------\n");
  137. return 1;
  138. }
  139. //------------------------------------------------------------------------------
  140. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  141. {
  142. if(response)
  143. {
  144. if(dialogid == 9985)
  145. {
  146. if(listitem == 0)
  147. {
  148. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}5 minuts.{00FF66} You can use /mechanicpark!");
  149. GivePlayerMoney(playerid,-150);
  150. SetTimerEx("Meha", 300000, false, "i", playerid);
  151. MechanicTicket[playerid] = 1;
  152. }
  153. if(listitem == 1)
  154. {
  155. GivePlayerMoney(playerid,-200);
  156. SetTimerEx("Meha", 600000, false, "i", playerid);
  157. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}10 minuts.{00FF66} You can use /mechanicpark!");
  158. MechanicTicket[playerid] = 1;
  159. }
  160. if(listitem == 2)
  161. {
  162. GivePlayerMoney(playerid,-250);
  163. SetTimerEx("Meha", 900000, false, "i", playerid);
  164. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}15 minuts.{00FF66} You can use /mechanicpark!");
  165. MechanicTicket[playerid] = 1;
  166. }
  167. if(listitem == 3)
  168. {
  169. GivePlayerMoney(playerid,-300);
  170. SetTimerEx("Meha", 1200000, false, "i", playerid);
  171. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}20 minuts.{00FF66} You can use /mechanicpark!");
  172. MechanicTicket[playerid] = 1;
  173. }
  174. if(listitem == 4)
  175. {
  176. GivePlayerMoney(playerid,-350);
  177. SetTimerEx("Meha", 1500000, false, "i", playerid);
  178. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}25 minuts.{00FF66} You can use /mechanicpark!");
  179. MechanicTicket[playerid] = 1;
  180. }
  181. if(listitem == 5)
  182. {
  183. GivePlayerMoney(playerid,-400);
  184. SetTimerEx("Meha", 1800000, false, "i", playerid);
  185. SendClientMessage(playerid, COLOR_BLUE,"{FF0066}You have now ticket for {CC0000}30 minuts.{00FF66} You can use /mechanicpark!");
  186. MechanicTicket[playerid] = 1;
  187. }
  188. if(listitem == 6)
  189. {
  190. SendClientMessage(playerid, COLOR_BLUE,"{6600FF}Okei,{CC0000} see you soon !");
  191. }
  192. }
  193. }
  194. return 0;
  195. }
  196. //------------------------------------------------------------------------------
  197. stock ShowDialog(playerid, dialog)
  198. {
  199. switch(dialog)
  200. {
  201. case 9985: ShowPlayerDialog(playerid, dialog,DIALOG_STYLE_LIST,"{003399}T{00FF66}icket {003399}S{00FF66}hop", "{6600CC}Buy Mechanic Ticket 5 Minuts ($150)\n{990033}Buy Mechanic Ticket 10 Minuts ($200)\n{339933}Buy Mechanic Ticket 15 Minuts ($250)\n{FF6600}Buy Mechanic Ticket 20 Minuts ($300)\n{FFCC33}Buy Mechanic Ticket 25 Minuts ($350)\n{006600}Buy Mechanic Ticket 30 Minuts ($400)\n{FF0066}I Don't Wan't Nothing","Buy", "Cancel");
  202. }
  203. return 0;
  204. }
  205. //------------------------------------------------------------------------------
  206. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  207. {
  208. if(IsPlayerConnected(playerid))
  209. {
  210. new Float:oldposx, Float:oldposy, Float:oldposz;
  211. new Float:tempposx, Float:tempposy, Float:tempposz;
  212. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  213. tempposx = (oldposx -x);
  214. tempposy = (oldposy -y);
  215. tempposz = (oldposz -z);
  216. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  217. {
  218. return 1;
  219. }
  220. }
  221. return 0;
  222. }
  223. //------------------------------------------------------------------------------
  224. public OnPlayerPickUpPickup(playerid, pickupid)
  225. {
  226. if (pickupid == Info[0])
  227. {
  228. ShowDialog(playerid, 9985);
  229. PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
  230. }
  231. if (pickupid == Info[1])
  232. {
  233. ShowDialog(playerid, 9985);
  234. PlayerPlaySound(playerid, 1139, 0.0, 0.0, 0.0);
  235. }
  236. }
  237. //------------------------------------------------------------------------------
  238. public Mechanic()
  239. {
  240. MoveObject(pilet, 777.81134033203, -1384.7808837891, 14.396675109863, 1.5);
  241. return 1;
  242. }
  243. //------------------------------------------------------------------------------
  244. public Mechanic1()
  245. {
  246. MoveObject(mehaanikugaraaz, 778.13708496094, -1330.2126464844, 14.225667953491, 1.5);
  247. return 1;
  248. }
  249. //------------------------------------------------------------------------------
  250. public Meha(playerid)
  251. {
  252. if(IsPlayerConnected(playerid))
  253. {
  254. new string[256];
  255. format(string, sizeof(string), "{FF0066}You cant use your mechanic ticket anymore!");
  256. SendClientMessage(playerid, COLOR_RED, string);
  257. MechanicTicket[playerid] = 0;
  258. }
  259. return 1;
  260. }
  261. //==============================================================================
  262. //===============================END OF ALL=====================================
Advertisement
Add Comment
Please, Sign In to add comment