Advertisement
Guest User

Untitled

a guest
Mar 15th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.25 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3.  
  4. #define COLOR_ORANGE 0xFFA500FF
  5. #define COLOR_LIMEGREEN 0x32CD32FF
  6. #define COLOR_ROYALBLUE 0x4169E1FF
  7. #define COLOR_PINK 0xFA8072FF
  8. #define COLOR_GREY 0xAFAFAFAA
  9. #define COLOR_GREEN 0x33AA33AA
  10. #define COLOR_RED 0xFF0000C8
  11. #define COLOR_YELLOW 0xFFFF00AA
  12. #define COLOR_WHITE 0xFFFFFFAA
  13. #define COLOR_BLUE 0x0000BBAA
  14. #define COLOR_LIGHTBLUE 0x33CCFFAA
  15. #define COLOR_INDIGO 0x1E90FFAA
  16.  
  17. enum {
  18. STAGE_IDLE,
  19. STAGE_LOAD,
  20. STAGE_UNLOAD
  21. }
  22.  
  23. enum {
  24. STAGE_IDL,
  25. STAGE_LOA,
  26. STAGE_UNLOA
  27. }
  28.  
  29. new MissionStge[MAX_PLAYERS];
  30.  
  31. new Float: qPickupCPs[][] = {
  32. { 2520.4902,1299.3765,10.8125},//
  33. { 2078.8430,1618.3031,10.8203 },//
  34. { 1726.2607,1529.2054,10.8203 },//
  35. { 2079.0376,1009.1650,10.8203 },//
  36. { 1772.3185,-1859.1658,13.4141},//
  37. { 1455.9867,-1739.3135,13.5469},//
  38. { 1107.7612,-1718.7412,13.5469},//
  39. { -292.6930,-2168.5618,28.5569},//
  40. { -226.7563,-264.2542,1.4219},//
  41. { 72.6294,98.2194,2.2922}
  42. };
  43.  
  44. new Float: qDeliverCPs[][] = {
  45. { 2121.8547,1431.1693,10.8203},//
  46. { 1844.1877,2264.9973,11.2288 },//
  47. { 1996.1808,824.2429,6.8624 },//
  48. { 1716.4343,1373.8458,10.6406 },//
  49. { 2158.5112,1871.4792,10.8203 },//
  50. { 1638.2766,-2323.8223,13.3828 },//
  51. { 1560.9440,-1808.5863,13.5469 },//
  52. { 826.4546,-1635.2385,13.5469 },//
  53. { 375.6268,-1908.5886,7.8359 },//
  54. { -378.5306,-1405.5066,25.1902 },//
  55. { -157.0472,-351.0927,1.4297 }
  56. };
  57.  
  58. new MissionStage[MAX_PLAYERS];
  59.  
  60.  
  61. new Float: gPickupCPs[][] = {
  62. { 1708.1753,1447.5897,10.8183},//
  63. { 2020.1150,1281.8982,10.8203 },//
  64. { 1605.1226,1845.6368,10.8203 },//
  65. { 1624.7622,2591.9053,10.6719 },//
  66. { 2572.1851,1379.5211,10.8203},//
  67. { 1945.4916,168.0763,37.2813},//
  68. { -139.8199,214.4663,7.7478},//
  69. { -2172.1980,-90.0761,35.1719},//
  70. { -1412.2441,-304.1318,14.1411},//
  71. { 341.2981,-1803.4674,4.6585},
  72. { 774.9841,-1792.0835,13.0311},
  73. { 1663.0458,-2250.7988,13.3554},
  74. { 1934.3203,-1928.5203,13.3860},
  75. { 2607.8840,-1450.5083,32.9954}
  76. };
  77.  
  78. new Float: gDeliverCPs[][] = {
  79. { 2715.4163,-1121.9978,69.5781},//
  80. { 2168.6951,-1629.7954,14.4724 },//
  81. { 1996.5559,-1713.5670,13.5469},//
  82. { 119.0267,-1560.5231,8.4564 },//
  83. { -2019.3076,164.8913,28.2674 },//
  84. { -1541.7216,495.1849,7.1797 },//
  85. { 1239.2821,350.3404,19.4063 },//
  86. { 2352.4280,154.6426,26.4692 },//
  87. { 2296.4382,665.6402,10.8203 },//
  88. { 1044.0485,1043.5970,10.1577 },//
  89. { 1863.2518,1097.7646,10.7056 }
  90. };
  91.  
  92.  
  93. public OnPlayerConnect(playerid) {
  94. MissionStage[playerid] = STAGE_IDLE;
  95. MissionStge[playerid] = STAGE_IDL;
  96. return true;
  97. }
  98.  
  99. DeliveryMissionn(playerid) {
  100. if(MissionStage[playerid] == STAGE_IDLE) {
  101. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 420) {
  102. new
  103. idx,
  104. Float: tmp,
  105. Float: dist = GetPlayerDistanceFromPoint(playerid, gPickupCPs[0][0], gPickupCPs[0][1], gPickupCPs[0][2])
  106. ;
  107. for(new i = 1; i < sizeof gPickupCPs; ++i) {
  108. tmp = GetPlayerDistanceFromPoint(playerid, gPickupCPs[i][0], gPickupCPs[i][1], gPickupCPs[i][2]);
  109.  
  110. if(tmp < dist) {
  111. dist = tmp;
  112. idx = i;
  113. }
  114. }
  115. MissionStage[playerid] = STAGE_LOAD;
  116. return SetPlayerCheckpoint(playerid, gPickupCPs[idx][0], gPickupCPs[idx][1], gPickupCPs[idx][2], 20.0);
  117. }
  118. } else {
  119. MissionStage[playerid] = STAGE_IDLE;
  120. return DisablePlayerCheckpoint(playerid);
  121. }
  122. return false;
  123. }
  124.  
  125. DeliveryMissio(playerid) {
  126. if(MissionStge[playerid] == STAGE_IDL) {
  127. if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 437) {
  128. new
  129. idx,
  130. Float: tmp,
  131. Float: dist = GetPlayerDistanceFromPoint(playerid, qPickupCPs[0][0], qPickupCPs[0][1], qPickupCPs[0][2])
  132. ;
  133. for(new i = 1; i < sizeof qPickupCPs; ++i) {
  134. tmp = GetPlayerDistanceFromPoint(playerid, qPickupCPs[i][0], qPickupCPs[i][1], qPickupCPs[i][2]);
  135.  
  136. if(tmp < dist) {
  137. dist = tmp;
  138. idx = i;
  139. }
  140. }
  141. MissionStge[playerid] = STAGE_LOA;
  142. return SetPlayerCheckpoint(playerid, qPickupCPs[idx][0], qPickupCPs[idx][1], qPickupCPs[idx][2], 20.0);
  143. }
  144. } else {
  145. MissionStge[playerid] = STAGE_IDL;
  146. return DisablePlayerCheckpoint(playerid);
  147. }
  148. return false;
  149. }
  150.  
  151. public OnPlayerCommandText(playerid, cmdtext[]) {
  152. if (strcmp("/Bus", cmdtext, true) == 0) {
  153. if(MissionStge[playerid] != STAGE_IDL) {
  154. return SendClientMessage(playerid, COLOR_RED, "You are already in a work!");
  155. }
  156. if(DeliveryMissio(playerid)) {
  157. return 1;
  158. }
  159. }
  160. if (strcmp("/Stopbus", cmdtext, true) == 0) {
  161. if(MissionStge[playerid] == STAGE_IDL) {
  162. return SendClientMessage(playerid, COLOR_RED, "You aren't doing any work!");
  163. }
  164. if(DeliveryMissio(playerid)) {
  165. GivePlayerMoney(playerid,-10000)
  166. return SendClientMessage(playerid, COLOR_RED, "You had Paid $10,000 for stopping your Work!");
  167. }
  168. return 1;
  169. if (strcmp("/Taxi", cmdtext, true) == 0) {
  170. if(MissionStage[playerid] != STAGE_IDLE) {
  171. return SendClientMessage(playerid, COLOR_RED, "You are already in a work!");
  172. }
  173. if(DeliveryMissionn(playerid)) {
  174. SendClientMessage(playerid, COLOR_INDIGO, "You have Started your Work !");
  175. return 1;
  176. }
  177. }
  178. if (strcmp("/StopTaxi", cmdtext, true) == 0) {
  179. if(MissionStage[playerid] == STAGE_IDLE) {
  180. return SendClientMessage(playerid, COLOR_RED, "You aren't doing any work!");
  181. }
  182. if(DeliveryMissionn(playerid)) {
  183. GivePlayerMoney(playerid,-10000)
  184. return SendClientMessage(playerid, COLOR_RED, "You had Paid $10,000 for stopping your Work!");
  185. }
  186. return 1;
  187. }
  188. return 0;
  189. }
  190.  
  191.  
  192. public OnPlayerEnterCheckpoint(playerid) {
  193. switch(MissionStage[playerid]) {
  194. case STAGE_LOAD: {
  195. new
  196. rand = random(sizeof gDeliverCPs)
  197. ;
  198. DisablePlayerCheckpoint(playerid);
  199. GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4);
  200. TogglePlayerControllable(playerid, false); // Freeze the player
  201. SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze
  202. SetPlayerCheckpoint(playerid, gDeliverCPs[rand][0], gDeliverCPs[rand][1], gDeliverCPs[rand][2], 10.0);
  203.  
  204. MissionStage[playerid] = STAGE_UNLOAD;
  205. }
  206. case STAGE_UNLOAD: {
  207. DisablePlayerCheckpoint(playerid);
  208.  
  209. GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4);
  210. TogglePlayerControllable(playerid, false); // Freeze the player
  211. SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze
  212. SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
  213. new cash = random(8000);
  214. GivePlayerMoney(playerid, cash);
  215. new
  216. string[64]
  217. ;
  218. GetPlayerName(playerid, string, MAX_PLAYER_NAME);
  219. strcat(string, " Completed a Taxi Mission!");
  220. SendClientMessageToAll(COLOR_ORANGE, string);
  221.  
  222. MissionStage[playerid] = STAGE_IDLE;
  223. }
  224.  
  225. switch(MissionStge[playerid]) {
  226. case STAGE_LOA: {
  227. new
  228. rand = random(sizeof qDeliverCPs)
  229. ;
  230. DisablePlayerCheckpoint(playerid);
  231. GameTextForPlayer(playerid, "~g~Passengers Boarding !", 2000, 4);
  232. TogglePlayerControllable(playerid, false); // Freeze the player
  233. SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze
  234. SetPlayerCheckpoint(playerid, qDeliverCPs[rand][0], qDeliverCPs[rand][1], qDeliverCPs[rand][2], 10.0);
  235.  
  236. MissionStge[playerid] = STAGE_UNLOA;
  237. }
  238. case STAGE_UNLOA: {
  239. DisablePlayerCheckpoint(playerid);
  240.  
  241. GameTextForPlayer(playerid, "~g~Passengers UnLoading !", 2000, 4);
  242. TogglePlayerControllable(playerid, false); // Freeze the player
  243. SetTimerEx("Unfreeze", 3000, false, "i", playerid); // Make a 3 second timer for that player to get unfroze
  244. SetPlayerScore(playerid, GetPlayerScore(playerid) + 1);
  245. new cash = random(8000);
  246. GivePlayerMoney(playerid, cash);
  247. new
  248. string[64]
  249. ;
  250. GetPlayerName(playerid, string, MAX_PLAYER_NAME);
  251. strcat(string, " Completed a Bus Haul!");
  252. SendClientMessageToAll(COLOR_ORANGE, string);
  253.  
  254. MissionStge[playerid] = STAGE_IDL;
  255. }
  256. }
  257. return false;
  258. }
  259. }
  260. return false;
  261. }
  262.  
  263. public OnPlayerDeath(playerid, killerid, reason){
  264. MissionStge[playerid] = STAGE_IDL;
  265. DisablePlayerCheckpoint(playerid);
  266. MissionStage[playerid] = STAGE_IDLE;
  267. DisablePlayerCheckpoint(playerid);
  268. return true;
  269. }
  270.  
  271. forward Unfreeze(playerid);
  272. public Unfreeze(playerid)
  273. {
  274. TogglePlayerControllable(playerid, true); // Unfreeze the player after 5 seconds
  275. return 1;
  276. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement