Advertisement
Guest User

MC

a guest
Nov 8th, 2014
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.72 KB | None | 0 0
  1. //Includes Fundamentais HAHA *-*
  2. #include <a_samp>
  3. #include <zcmd>
  4. #include <sscanf2>
  5. //Defines Times
  6. #define Caminhoneiro 1
  7. #define CorCaminhoneiro 0xAAF1FAFF
  8. //Defines Macros
  9. #define SCM SendClientMessage
  10. #define SCMA SendClientMessageToAll
  11. //Define Dialogo!
  12. #define DialogoTrabalhos 155
  13. enum CaminhoneiroMissao //Essa enum só serve para as missões,não retire,se quiser modifique!
  14. {
  15. ID,
  16. NomeCarregar[128],
  17. Float:CarregarX,
  18. Float:CarregarY,
  19. Float:CarregarZ,
  20. NomeDescarregar[128],
  21. Float:DescarregarX,
  22. Float:DescarregarY,
  23. Float:DescarregarZ,
  24. Pagamento,
  25. NomeCarga[128]
  26. }
  27. enum MissaoInfo
  28. {
  29. Classe,
  30. Trabalhando
  31. }
  32. new Missao[MAX_PLAYERS][MissaoInfo];
  33. new MisCaminhoneiro[][CaminhoneiroMissao] =
  34. {
  35. {0, "Missão 1", 0.0, 0.0, 0.0, "Missão 2", 0.0, 0.0, 0.0, 1000, "Cimento"},
  36. {1, "Missão 3", 0.0, 0.0, 0.0, "Missão 4", 0.0, 0.0, 0.0, 1000, "Cimento"},
  37. {2, "Missão 5", 0.0, 0.0, 0.0, "Missão 6", 0.0, 0.0, 0.0, 1000, "Cimento"},
  38. {3, "Missão 7", 0.0, 0.0, 0.0, "Missão 8", 0.0, 0.0, 0.0, 1000, "Cimento"},
  39. {4, "Missão 9", 0.0, 0.0, 0.0, "Missão 10", 0.0, 0.0, 0.0, 1000, "Cimento"}
  40. }; //{ID, "Nome do Lugar de Carregar", Coordenadas de carregar, "Nome do Lugar de Descarregar", Coordenadas de descarregar, Pagamento, "Oque Carregar"},
  41.  
  42. new Float:SpawnCaminhoneiro[][4] = //Spawn Escolha os SpawnsRandoms!
  43. {
  44. {-1574.3555, -2747.2380, 48.5391},
  45. {-1574.3555, -2747.2380, 48.5391},
  46. {-1574.3555, -2747.2380, 48.5391}
  47. };
  48. forward Descongelar(playerid);
  49. public Descongelar(playerid)
  50. {
  51. TogglePlayerControllable(playerid, true);
  52. return 1;
  53. }
  54. public OnGameModeInit()
  55. {
  56. //Classe
  57. AddPlayerClass(6, 00.00, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);//Caminhoneiro 0
  58. AddPlayerClass(32, 00.00, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);//Caminhoneiro 1
  59. AddPlayerClass(131, 00.00, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0);//Caminhoneiro 2
  60. //Carros Spawn 1,2,3
  61. AddStaticVehicleEx(515,-1545.1810000,-2747.9026000,49.5388000,169.5600000,-1,-1,15); //Roadtrain
  62. AddStaticVehicleEx(515,-1540.5913000,-2750.2205000,49.4988000,169.5600000,-1,-1,15); //Roadtrain
  63. AddStaticVehicleEx(515,-1535.9431000,-2753.1897000,49.5188000,169.5600000,-1,-1,15); //Roadtrain
  64. AddStaticVehicleEx(435,-1531.0387000,-2754.3723000,49.0663000,168.7800000,-1,-1,15); //Trailer 1
  65. AddStaticVehicleEx(435,-1526.4016000,-2756.6875000,49.0663000,168.7800000,-1,-1,15); //Trailer 1
  66. return 1;
  67. }
  68. public OnGameModeExit()
  69. {
  70. return 1;
  71. }
  72. public OnPlayerRequestClass(playerid, classid)
  73. {
  74. switch(classid)
  75. {
  76. case 0,1,2:
  77. {
  78. GameTextForPlayer(playerid, "~y~~h~~h~Caminhoneiro", 3000, 4);
  79. Missao[playerid][Classe] = Caminhoneiro;
  80. SetPlayerPos(playerid, 2179.413574, 1285.552368, 42.549133);
  81. SetPlayerFacingAngle(playerid, 89.761169);
  82. SetPlayerCameraLookAt(playerid, 2179.413574, 1285.552368, 42.549133);
  83. SetPlayerCameraPos(playerid, 2179.413574 + (5 * floatsin(-89.761169, degrees)), 1285.552368 + (5 * floatcos(-89.761169, degrees)), 42.549133);
  84. }
  85. }
  86. if(Missao[playerid][Classe] == Caminhoneiro)
  87. {
  88. SetPlayerColor(playerid, CorCaminhoneiro);
  89. }
  90. return 1;
  91. }
  92. public OnPlayerSpawn(playerid)
  93. {
  94. if(Missao[playerid][Classe] == Caminhoneiro)
  95. {
  96. new rand = random(sizeof(SpawnCaminhoneiro));
  97. SetPlayerPos(playerid, SpawnCaminhoneiro[rand][0], SpawnCaminhoneiro[rand][1], SpawnCaminhoneiro[rand][2]);
  98. SetPlayerFacingAngle(playerid, SpawnCaminhoneiro[rand][3]);
  99. }
  100. return 1;
  101. }
  102. public OnPlayerEnterCheckpoint(playerid)
  103. {
  104. if(Missao[playerid][Trabalhando] == 1)
  105. {
  106. switch(Missao[playerid][Classe])
  107. {
  108. case Caminhoneiro:
  109. {
  110. new vID = GetPlayerVehicleID(playerid);
  111. if(GetVehicleModel(vID) == 403 || GetVehicleModel(vID) == 515 || GetVehicleModel(vID) == 514 || GetVehicleModel(vID) == 455 || GetVehicleModel(vID) == 578)
  112. {
  113. if(!IsTrailerAttachedToVehicle(vID)) return SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você está sem trailer !!");
  114. TogglePlayerControllable(playerid, false);
  115. GameTextForPlayer(playerid, "Descarregue Agora!", 5000, 4);
  116. GameTextForPlayer(playerid, "Carregando...", 3000, 4);
  117. SetTimerEx("Descongelar", 5000, false, "i", playerid);
  118. DisablePlayerCheckpoint(playerid);
  119. SetPlayerCheckpoint(playerid, MisCaminhoneiro[playerid][DescarregarX], MisCaminhoneiro[playerid][DescarregarY], MisCaminhoneiro[playerid][DescarregarZ], 10.0);
  120. Missao[playerid][Trabalhando] = 2;
  121. }
  122. else
  123. {
  124. SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você deve está dentro de um caminhão para Carregar!");
  125. }
  126. }
  127. }
  128. }
  129. else if(Missao[playerid][Trabalhando] == 2)
  130. {
  131. switch(Missao[playerid][Classe])
  132. {
  133. case Caminhoneiro:
  134. {
  135. new vID = GetPlayerVehicleID(playerid);
  136. if(GetVehicleModel(vID) == 403 || GetVehicleModel(vID) == 515 || GetVehicleModel(vID) == 514 || GetVehicleModel(vID) == 455 || GetVehicleModel(vID) == 578)
  137. {
  138. if(!IsTrailerAttachedToVehicle(vID)) return SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você está sem trailer !!");
  139. TogglePlayerControllable(playerid, false);
  140. GameTextForPlayer(playerid, "Trabalho Concluido!", 5000, 4);
  141. GameTextForPlayer(playerid, "Descarregando...", 3000, 4);
  142. SetTimerEx("Descongelar", 5000, false, "i", playerid);
  143. DisablePlayerCheckpoint(playerid);
  144. Missao[playerid][Trabalhando] = 0;
  145. GivePlayerMoney(playerid, MisCaminhoneiro[playerid][Pagamento]);
  146. SetPlayerScore(playerid, GetPlayerScore(playerid)+2);
  147. new Linha[100];
  148. format(Linha, sizeof(Linha), "{FF0000}[INFO]{FFFFFF}: Você concluiu seu trabalho e ganhou : R$ %d e 2 Scores !", MisCaminhoneiro[playerid][Pagamento]);
  149. SCM(playerid, -1, Linha);
  150. format(Linha, sizeof(Linha), "{FF0000}[INFO]{FFFFFF}: Você transportou %s, de %s para %s !", MisCaminhoneiro[playerid][NomeCarga], MisCaminhoneiro[playerid][NomeCarregar], MisCaminhoneiro[playerid][NomeDescarregar]);
  151. SCM(playerid, -1, Linha);
  152. }
  153. else
  154. {
  155. SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você deve está dentro de um caminhão para Descarregar!");
  156. }
  157. }
  158. }
  159. }
  160. return 1;
  161. }
  162. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  163. {
  164. switch(dialogid)
  165. {
  166. case DialogoTrabalhos:
  167. {
  168. switch(listitem)
  169. {
  170. case 0 .. 10:
  171. {
  172. if(Missao[playerid][Classe] == Caminhoneiro)
  173. {
  174. new Linha[160];
  175. SetPlayerCheckpoint(playerid, MisCaminhoneiro[listitem][CarregarX], MisCaminhoneiro[listitem][CarregarY], MisCaminhoneiro[listitem][CarregarZ], 10.0);
  176. format(Linha, sizeof(Linha), "{FF0000}[TRABALHO]{FFFFFF}: Leve a Carga: {FFFF00}%s{FFFFFF} de{FFFF00} %s {FFFFFF}Para{FFFF00} %s",MisCaminhoneiro[listitem][NomeCarga], MisCaminhoneiro[listitem][NomeCarregar], MisCaminhoneiro[listitem][NomeDescarregar]);
  177. SCM(playerid, -1, Linha);
  178. Missao[playerid][Trabalhando] = 1;
  179. }
  180. }
  181. }
  182. }
  183. }
  184. return 1;
  185. }
  186. CMD:trabalhar(playerid)
  187. {
  188. new Msg[400], Linha[100];
  189. if(Missao[playerid][Trabalhando] > 1) return SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você já está trabalhando !");
  190. if(Missao[playerid][Classe] == Caminhoneiro)
  191. {
  192. new vID = GetPlayerVehicleID(playerid);
  193. if(GetVehicleModel(vID) == 403 || GetVehicleModel(vID) == 515 || GetVehicleModel(vID) == 514 || GetVehicleModel(vID) == 455 || GetVehicleModel(vID) == 578)
  194. {
  195. if(!IsTrailerAttachedToVehicle(vID)) return SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você está sem trailer !!");
  196. for(new tb = 0; tb < sizeof MisCaminhoneiro; tb++)
  197. {
  198. if(IsPlayerInRangeOfPoint(playerid, 10000, MisCaminhoneiro[tb][CarregarX], MisCaminhoneiro[tb][CarregarY], MisCaminhoneiro[tb][CarregarZ]))
  199. {
  200. format(Linha, sizeof(Linha), "Transporte %s - De %s - Para %s\n",MisCaminhoneiro[tb][NomeCarga], MisCaminhoneiro[tb][NomeCarregar], MisCaminhoneiro[tb][NomeDescarregar]);
  201. strcat(Msg, Linha);
  202. Missao[playerid][Trabalhando] = 1;
  203. }
  204. }
  205. }
  206. else
  207. {
  208. SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você deve está dentro de um caminhão para iniciar o trabalho!");
  209. }
  210. ShowPlayerDialog(playerid, DialogoTrabalhos, DIALOG_STYLE_LIST, "Escolha sua Carga", Msg, "Selecionar", "Cancelar");
  211. }
  212. return 1;
  213. }
  214. CMD:parartrabalho(playerid)
  215. {
  216. if(Missao[playerid][Trabalhando] == 0) return SCM(playerid, -1, "{FF0000}[ERRO]{FFFFFF}: Você não está trabalhando para cancelar!");
  217. DisablePlayerCheckpoint(playerid);
  218. Missao[playerid][Trabalhando] = 0;
  219. SCM(playerid, -1, "{FF0000}[INFO]{FFFFFF}: Você cancelou o seu trabalho e pagou :{FF0000} R$ 500");
  220. GivePlayerMoney(playerid, -500);
  221. return 1;
  222. }
  223. CMD:mudar(playerid)
  224. {
  225. ForceClassSelection(playerid);
  226. SetPlayerHealth(playerid, 0.0);
  227. return 1;
  228. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement