Leonaardo

Untitled

Oct 13th, 2017
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.86 KB | None | 0 0
  1.  
  2. #define PRESSED(%0) \
  3. (((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
  4. #define PastaConcessionaria \
  5. "Concessionaria/Veiculos/Dono_%s.ini"
  6. #define AdicionarVIP \
  7. 0 // Restrição para VIP Comprar carros ! Bote 1 se quiser usar
  8. #define MaxCarros \
  9. 100 // MaxCarros = 50 + 1 NULL !!!!
  10. #define PrecoCarros \
  11. 10000 // Preço dos Carros ao Comprar
  12. #define GranaVenderCarro \
  13. 80000 // Grana ao Vender seu Carro !
  14. #define JFSQuantCarrosTextD \
  15. 98
  16. #define CARROSPAGINA \
  17. 21
  18. #define CARROSLINHA \
  19. 7
  20. #define jCOR_FUNDO \
  21. 0xF0F8FFFF
  22.  
  23.  
  24. #include <a_samp>
  25. #include <dof2>
  26. #include <zcmd>
  27.  
  28.  
  29.  
  30.  
  31. new Float:VRandSpawn[][4] =
  32. {
  33. {533.8918,-1319.3507,16.8116,95.7052},
  34. {533.8918,-1319.3507,16.8116,95.7052},
  35. {533.8918,-1319.3507,16.8116,95.7052},
  36. {533.8918,-1319.3507,16.8116,95.7052},
  37. {533.8918,-1319.3507,16.8116,95.7052},
  38. {533.8918,-1319.3507,16.8116,95.7052},
  39. {2533.8918,-1319.3507,16.8116,95.7052},
  40. {533.8918,-1319.3507,16.8116,95.7052}
  41. };
  42.  
  43. new gItemLists[JFSQuantCarrosTextD] =
  44. {
  45. 400,401,402,404,405,410,411,412,413,414,415,418,419,421,422,424,426,429,434,436,439,440,442,
  46. 443,445, 451,458,459,461,462,463,466,467,468,471,474,475, 477,478,479,480,
  47. 482,483,485,489,491,492,494,495,496,500,502, 503, 504,505,506,507,508, 516,517,518,521,522,
  48. 526,527,529,533,534,535, 526, 540, 541,542,543, 547,549,550,551,555,559,560,561,562, 565,566,
  49. 567,575,576,579,579,580,581, 585,587,589,600,602,603,
  50. };
  51.  
  52. enum JFSInformacoes
  53. {
  54. JFSModelo,
  55. JFSDono[MAX_PLAYER_NAME],
  56. Float:JFSCorX,
  57. Float:JFSCorY,
  58. Float:JFSCorZ,
  59. Float:JFSAngulo,
  60. JFSCor1,
  61. JFSCor2,
  62. JFSCofre,
  63. JFSPlaca
  64. };
  65.  
  66.  
  67.  
  68. new
  69. JFSCarros[MaxCarros][JFSInformacoes],
  70. JFSID[MaxCarros],
  71. CarroJFS[MaxCarros],
  72. gTotalItems = JFSQuantCarrosTextD,
  73. PlayerText:gCurrentPageTextDrawIds[MaxCarros],
  74. PlayerText:gHeaderTextDrawIds[MaxCarros],
  75. PlayerText:gBackgroundTextDrawIds[MaxCarros],
  76. PlayerText:gNextButtonTextDrawIds[MaxCarros],
  77. PlayerText:gPrevButtonTextDrawIds[MaxCarros],
  78. PlayerText:gSelectionItemss[MaxCarros][CARROSPAGINA],
  79. gSelectionItemssTag[MaxCarros][CARROSPAGINA],
  80. gItemAts[MaxCarros],
  81. Celulas1[124],
  82. JFSCheck[MaxCarros]
  83. ;
  84.  
  85.  
  86.  
  87.  
  88. public OnFilterScriptInit()
  89. {
  90. Create3DTextLabel("Concessionária\nAperte 'Y' para utilizar", -1, 548.3907, -1287.7068, 16.7539, 40.0, 0);
  91. format(Celulas1, sizeof(Celulas1), "/Concessionaria");
  92. if(!DOF2::FileExists(Celulas1))
  93. {
  94. for(new x=0; x < 20; ++x) {
  95. print("[Concessionária] - NÃO EXISTE A PASTA Concessionaria NO SCRIPTFILES ! CRIE AGORA !");
  96. }
  97. SendRconCommand("exit");
  98. }
  99. format(Celulas1, sizeof(Celulas1), "/Concessionaria/Veiculos");
  100. if(!DOF2::FileExists(Celulas1))
  101. {
  102. for(new x=0; x < 20; ++x) {
  103. print("[Concessionária] - NÃO EXISTE A PASTA Veiculos EM Concessionaria NOS SCRIPTFILES ! CRIE AGORA !");
  104. }
  105. SendRconCommand("exit");
  106. }
  107. print("[Concessionária] - Carregado com Sucesso !");
  108. return true;
  109. }
  110.  
  111. public OnFilterScriptExit()
  112. {
  113. DOF2::Exit();
  114. return true;
  115. }
  116.  
  117. public OnPlayerConnect(playerid)
  118. {
  119. CarregarCarro(playerid);
  120. gHeaderTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  121. gBackgroundTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  122. gCurrentPageTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  123. gNextButtonTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  124. gPrevButtonTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  125.  
  126. for(new x=0; x < CARROSPAGINA; x++) {
  127. gSelectionItemss[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
  128. }
  129.  
  130. gItemAts[playerid] = 0;
  131.  
  132. return true;
  133. }
  134.  
  135. public OnPlayerDisconnect(playerid)
  136. {
  137. DestruiraoDesconectar(playerid);
  138. return true;
  139. }
  140.  
  141. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  142. {
  143. if(GetPVarInt(playerid, "JFSTextAtivado") == 0) return false;
  144.  
  145. if(clickedid == Text:INVALID_TEXT_DRAW) {
  146. DestroySelectionMenu(playerid);
  147. SetPVarInt(playerid, "JFSTextAtivado", 0);
  148. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  149. return true;
  150. }
  151. return false;
  152. }
  153.  
  154. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  155. {
  156. if(GetPVarInt(playerid, "JFSTextAtivado") == 0) return false;
  157. new curpage = GetPVarInt(playerid, "JFSPagina");
  158.  
  159. if(playertextid == gNextButtonTextDrawIds[playerid])
  160. {
  161. if(curpage < (GETNumeroPaginas() - 1))
  162. {
  163. SetPVarInt(playerid, "JFSPagina", curpage + 1);
  164. ShowPlayerModelPreviews(playerid);
  165. UpdatePageTextDraw(playerid);
  166. PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
  167. } else {
  168. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  169. }
  170. return true;
  171. }
  172. if(playertextid == gPrevButtonTextDrawIds[playerid])
  173. {
  174. if(curpage > 0)
  175. {
  176. SetPVarInt(playerid, "JFSPagina", curpage - 1);
  177. ShowPlayerModelPreviews(playerid);
  178. UpdatePageTextDraw(playerid);
  179. PlayerPlaySound(playerid, 1084, 0.0, 0.0, 0.0);
  180. } else {
  181. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  182. }
  183. return true;
  184. }
  185. new x=0;
  186. while(x != CARROSPAGINA)
  187. {
  188. if(GetPlayerMoney(playerid) < PrecoCarros) return SendClientMessage(playerid, -1, "| ERRO | Você não tem dinheiro suficiente ! R$80.000");
  189. if(playertextid == gSelectionItemss[playerid][x])
  190. {
  191. JFSComprouVeiculo(playerid, x);
  192. PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0);
  193. DestroySelectionMenu(playerid);
  194. CancelSelectTextDraw(playerid);
  195. SetPVarInt(playerid, "JFSTextAtivado", 0);
  196. return true;
  197. }
  198. x++;
  199. }
  200. return false;
  201. }
  202.  
  203. public OnPlayerCommandText(playerid, cmdtext[]) return false;
  204.  
  205. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  206. {
  207. if (PRESSED(KEY_YES))
  208. {
  209. if(IsPlayerInRangeOfPoint(playerid, 1.0, 548.3907, -1287.7068, 16.7539))
  210. {
  211. if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, -1, "| ERRO | Você Não comprar veiculo dentro de um.");
  212. if((CarroJFS[playerid] == 1)) return SendClientMessage(playerid, -1, "| ERRO | Você Já Tem um Veiculo.");
  213. #if(AdicionarVIP == 1)
  214. if(VariavelVIP < 1) return SendClientMessage(playerid, -1, "| ERRO | Você Não é VIP.");
  215. #endif
  216. DestroySelectionMenu(playerid);
  217. SetPVarInt(playerid, "JFSTextAtivado", 1);
  218. CreateSelectionMenu(playerid);
  219. SelectTextDraw(playerid, 0xACCBF1FF);
  220. }
  221. }
  222. return true;
  223. }
  224.  
  225.  
  226. CMD:excluirveiculo(playerid, params[])
  227. {
  228. if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xDEEE20FF, "| ERRO | Comando inválido");
  229. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  230. if(!DOF2::FileExists(Celulas1)) return SendClientMessage(playerid, -1, "Esse Úsuario não tem veiculo!");
  231. format(Celulas1, sizeof(Celulas1), "Arquivo Veiculo_%s.ini Excluido com Sucesso dos ScriptFiles !", PlayerN(playerid));
  232. SendClientMessage(playerid, -1, Celulas1);
  233. DOF2::RemoveFile(Celulas1);
  234. DOF2::SaveFile();
  235. if(IsPlayerConnected(strlen(PlayerN(playerid))))
  236. {
  237. JFSID[strlen(params)] = 0;
  238. DestroyVehicle(JFSID[strlen(PlayerN(playerid))]);
  239. }
  240. return true;
  241. }
  242.  
  243. CMD:menuveiculo(playerid, params[])
  244. {
  245. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  246. if (!DOF2::FileExists(Celulas1)) return SendClientMessage ( playerid , -1 , "| ERRO | Você não tem um veiculo!" ) ;
  247. if (!IsPlayerInVehicle(playerid, JFSID[playerid])) return SendClientMessage (playerid , -1 , "Você não está em seu veiculo." ) ;
  248. ShowPlayerDialog(playerid, 7337, DIALOG_STYLE_LIST, "Menu Veiculo", "Estacionar Aqui\nCor do Veiculo\nVender Veiculo\nPlaca do Veiculo", "Selecionar", "Cancelar");
  249. return true;
  250. }
  251.  
  252. CMD:localizarveiculo(playerid, params[])
  253. {
  254. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  255. if (!DOF2::FileExists(Celulas1)) return SendClientMessage ( playerid , -1 , "| ERRO | Você não tem um veiculo!" ) ;
  256. JFSCheck[playerid] = 1;
  257. static Float:CordX, Float:CordY, Float:CordZ;
  258. GetVehiclePos(JFSID[playerid], CordX, CordY, CordZ);
  259. SetPlayerCheckpoint (playerid , CordX, CordY, CordZ, 10.0);
  260. SendClientMessage(playerid , -1, "| INFO | O Seu Veículo foi Marcado no Mapa!");
  261. return true;
  262. }
  263.  
  264. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  265. {
  266. if(dialogid == 7337)
  267. {
  268. if(response)
  269. {
  270. if(listitem == 0)
  271. {
  272. new VeiculoID = JFSID[playerid];
  273. static Float:CordX, Float:CordY, Float:CordZ, Float:Angulo;
  274. GetVehiclePos(VeiculoID, CordX, CordY, CordZ);
  275. GetVehicleZAngle(VeiculoID, Angulo);
  276. JFSCarros[playerid][JFSCorX] = CordX;
  277. JFSCarros[playerid][JFSCorY] = CordY;
  278. JFSCarros[playerid][JFSCorZ] = CordZ;
  279. JFSCarros[playerid][JFSAngulo] = Angulo;
  280. DestroyVehicle(VeiculoID);
  281. JFSID[playerid] = CreateVehicle(JFSCarros[playerid][JFSModelo], JFSCarros[playerid][JFSCorX], JFSCarros[playerid][JFSCorY], JFSCarros[playerid][JFSCorZ], JFSCarros[playerid][JFSAngulo], JFSCarros[playerid][JFSCor1] , JFSCarros[playerid][JFSCor2], 0);
  282. PutPlayerInVehicle(playerid, JFSID[playerid], 0);
  283. SendClientMessage(playerid, -1, "| INFO | Seu Veiculo vai da Spawn Aqui Agora!");
  284. SalvarArquivos(playerid);
  285. }
  286. if(listitem == 1)
  287. {
  288. ShowPlayerDialog(playerid, 3773, DIALOG_STYLE_INPUT, "Concessionária - Cor", "DIGITE O ID DA COR 1 DE SEU VEICULO\n\n\nPS: As Cores Foram Modificadas na versão 0.3x.", "Comprar", "Cancelar");
  289. }
  290. if(listitem == 2)
  291. {
  292. format(Celulas1, sizeof(Celulas1), "Concessionária - Seu Veiculo Será Vendido Por %d.\n\nCaso Queria Vender seu Veículo, Confirme Abaixo.\n\n", GranaVenderCarro);
  293. ShowPlayerDialog(playerid, 4217, DIALOG_STYLE_MSGBOX, "Concessionária - Vender Veiculo", Celulas1, "Confirmar", "Cancelar");
  294. }
  295. if(listitem == 3)
  296. {
  297. ShowPlayerDialog(playerid, 2461, DIALOG_STYLE_INPUT, "Concessionária - Placa", "DIGITE A PLACA DO SEU VEICULO\n\n", "Trocar", "Cancelar");
  298. }
  299. }
  300. return true;
  301. }
  302. if(dialogid == 4217)
  303. {
  304. if(response)
  305. {
  306. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  307. DOF2::RemoveFile(Celulas1);
  308. DOF2::SaveFile();
  309. DestroyVehicle(JFSID[playerid]);
  310. CarroJFS[playerid] = 0;
  311. RemovePlayerFromVehicle(playerid);
  312. format(Celulas1, sizeof(Celulas1), "| Concessionária | Você Vendeu seu veiculo e ganhou %d.", GranaVenderCarro);
  313. SendClientMessage(playerid, -1, Celulas1);
  314. GivePlayerMoney(playerid, GranaVenderCarro);
  315. }
  316. return true;
  317. }
  318. if(dialogid == 2461)
  319. {
  320. if(response)
  321. {
  322. if(strlen(inputtext) > 1 && strlen(inputtext) < 9)
  323. {
  324. format(Celulas1,sizeof(Celulas1),"%s", inputtext);
  325. static Float:CordX, Float:CordY, Float:CordZ, Float:Angulo;
  326. new VeiculoID = JFSID[playerid];
  327. SetVehicleNumberPlate(VeiculoID, Celulas1);
  328. GetVehiclePos(VeiculoID, CordX, CordY, CordZ);
  329. GetVehicleZAngle(VeiculoID, Angulo);
  330. SetVehicleToRespawn(VeiculoID);
  331. SetVehiclePos(VeiculoID, CordX, CordY, CordZ);
  332. SetVehicleZAngle(VeiculoID, Angulo);
  333. PutPlayerInVehicle(playerid, VeiculoID, 0);
  334. format(JFSCarros[playerid][JFSPlaca] , 9,"%s", inputtext);
  335. SalvarArquivos(playerid);
  336. }
  337. else SendClientMessage(playerid, -1, "{FF0000}| ERRO | Apenas Caractéristicas de 2 a 8 !");
  338. }
  339. return true;
  340. }
  341. if(dialogid == 3773)
  342. {
  343. if(response)
  344. {
  345. new VeiculoID = JFSID[playerid];
  346. if(!strval(inputtext)) return SendClientMessage(playerid, -1, "{FF0000}| ERRO | Apenas Numeros!"), true;
  347. if(strval(inputtext) < 0 || strval(inputtext) > 255) return SendClientMessage(playerid, -1, "{FF0000}| ERRO | Existes Cores Apenas Entre 0 á 255."), true;
  348. JFSCarros[playerid][JFSCor1] = strval(inputtext);
  349. ChangeVehicleColor(VeiculoID, JFSCarros[playerid][JFSCor1], -1);
  350. ShowPlayerDialog(playerid, 7733, DIALOG_STYLE_INPUT, "Concessionária - Cor", "DIGITE O ID DA COR 2 DE SEU VEICULO\n\n\nPS: As Cores Foram Modificadas na versão 0.3x.", "Comprar", "Cancelar");
  351. }
  352. return true;
  353. }
  354. if(dialogid == 7733)
  355. {
  356. if(response)
  357. {
  358. new VeiculoID = JFSID[playerid];
  359. if(!strval(inputtext)) return SendClientMessage(playerid, -1, "{FF0000}| ERRO | Apenas Numeros!"), ShowPlayerDialog(playerid, 7733, DIALOG_STYLE_INPUT, "JFS Concessionária v1.0 - Cor", "DIGITE O ID DA COR 2 DE SEU VEICULO\n\n\nPS: As Cores Foram Modificadas na versão 0.3x.", "Comprar", "Cancelar"), true;
  360. if(strval(inputtext) < 0 || strval(inputtext) > 255) return SendClientMessage(playerid, -1, "{FF0000}| ERRO | Existes Cores Apenas Entre 0 á 255."), ShowPlayerDialog(playerid, 7733, DIALOG_STYLE_INPUT, "JFS Concessionária v1.0 - Cor", "DIGITE O ID DA COR 2 DE SEU VEICULO\n\n\nPS: As Cores Foram Modificadas na versão 0.3x.", "Comprar", "Cancelar"), true;
  361. JFSCarros[playerid][JFSCor2] = strval(inputtext);
  362. ChangeVehicleColor(VeiculoID, JFSCarros[playerid][JFSCor1], JFSCarros[playerid][JFSCor2]);
  363. SendClientMessage(playerid, -1, "| INFO | Cores Definidas com Sucesso!");
  364. SalvarArquivos(playerid);
  365. }
  366. else ShowPlayerDialog(playerid, 7733, DIALOG_STYLE_INPUT, "Concessionária - Cor", "DIGITE O ID DA COR 2 DE SEU VEICULO\n\n\n", "Comprar", "Cancelar");
  367. return true;
  368. }
  369. return true;
  370. }
  371.  
  372. public OnPlayerStateChange(playerid, newstate, oldstate)
  373. {
  374. if(newstate == PLAYER_STATE_DRIVER)
  375. {
  376. for(new carro, JFS = sizeof(JFSCarros); carro != JFS; carro++)
  377. {
  378. if(JFSID[carro] == GetPlayerVehicleID(playerid) && strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], true))
  379. {
  380. format(Celulas1, sizeof(Celulas1), "{FFFF00}| INFO | Este veículo pertence ao jogador{FFFFFF} %s{FFFF00} e você não pode dirigí-lo.", JFSCarros[carro][JFSDono]);
  381. SendClientMessage(playerid, -1, Celulas1);
  382. RemovePlayerFromVehicle(playerid);
  383. }
  384. if(JFSID[carro] == GetPlayerVehicleID(playerid) && !strcmp(PlayerN(playerid), JFSCarros[carro][JFSDono], true))
  385. {
  386. SendClientMessage(playerid, -1, "| INFO | Bem Vindo ao Seu Veiculo Concessionária Use: /menuveiculo");
  387. }
  388. }
  389. }
  390. return true;
  391. }
  392.  
  393. public OnPlayerEnterCheckpoint (playerid)
  394. {
  395. if (JFSCheck[playerid] == 1 )
  396. {
  397. SendClientMessage (playerid , -1 , "| INFO | Aqui Está Seu Veículo!");
  398. DisablePlayerCheckpoint (playerid);
  399. return true;
  400. }
  401. return true;
  402. }
  403.  
  404.  
  405. stock PlayerN(playerid)
  406. {
  407. new Name[MAX_PLAYER_NAME];
  408. GetPlayerName(playerid, Name, sizeof(Name));
  409. return Name;
  410. }
  411.  
  412.  
  413.  
  414. stock SalvarArquivos(playerid)
  415. {
  416. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  417. if(!DOF2::FileExists(Celulas1)) DOF2::CreateFile(Celulas1), DOF2::SetString(Celulas1,"Dono", PlayerN(playerid));
  418. JFSCarros[playerid][JFSDono] = PlayerN(playerid);
  419. format(JFSCarros[playerid][JFSDono], MAX_PLAYER_NAME, DOF2::GetString(Celulas1, "Dono"));
  420. DOF2::SetString(Celulas1,"Dono", JFSCarros[playerid][JFSDono]);
  421. DOF2::SetInt(Celulas1,"Modelo", JFSCarros[playerid][JFSModelo]);
  422. DOF2::SetFloat(Celulas1,"CorX", JFSCarros[playerid][JFSCorX]);
  423. DOF2::SetFloat(Celulas1,"CorY", JFSCarros[playerid][JFSCorY]);
  424. DOF2::SetFloat(Celulas1,"CorZ", JFSCarros[playerid][JFSCorZ]);
  425. DOF2::SetFloat(Celulas1,"Angulo", JFSCarros[playerid][JFSAngulo]);
  426. DOF2::SetInt(Celulas1,"Cor1", JFSCarros[playerid][JFSCor1]);
  427. DOF2::SetInt(Celulas1,"Cor2", JFSCarros[playerid][JFSCor2]);
  428. DOF2::SetString(Celulas1,"Placa", JFSCarros[playerid][JFSPlaca]);
  429. DOF2::SetInt(Celulas1,"Cofre", JFSCarros[playerid][JFSCofre]);
  430.  
  431. format(JFSCarros[playerid][JFSDono], MAX_PLAYER_NAME, DOF2::GetString(Celulas1, "Dono"));
  432. DOF2::GetString(Celulas1, "Dono", JFSCarros[playerid][JFSDono]);
  433. JFSCarros[playerid][JFSModelo] = DOF2::GetInt(Celulas1, "Modelo");
  434. JFSCarros[playerid][JFSCorX] = DOF2::GetFloat(Celulas1, "CorX");
  435. JFSCarros[playerid][JFSCorY] = DOF2::GetFloat(Celulas1, "CorY");
  436. JFSCarros[playerid][JFSCorZ] = DOF2::GetFloat(Celulas1, "CorZ");
  437. JFSCarros[playerid][JFSAngulo] = DOF2::GetFloat(Celulas1, "Angulo");
  438. JFSCarros[playerid][JFSCor1] = DOF2::GetInt(Celulas1, "Cor1");
  439. JFSCarros[playerid][JFSCor2] = DOF2::GetInt(Celulas1, "Cor2");
  440. DOF2::GetString(Celulas1, "Placa", JFSCarros[playerid][JFSPlaca]);
  441. JFSCarros[playerid][JFSCofre] = DOF2::GetInt(Celulas1, "Cofre");
  442. DOF2::SaveFile();
  443. return true;
  444. }
  445.  
  446. stock CarregarCarro(playerid)
  447. {
  448. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  449. if(DOF2::FileExists(Celulas1))
  450. {
  451. format(JFSCarros[playerid][JFSDono], MAX_PLAYER_NAME, DOF2::GetString(Celulas1, "Dono"));
  452. DOF2::GetString(Celulas1, "Dono", JFSCarros[playerid][JFSDono]);
  453. JFSCarros[playerid][JFSModelo] = DOF2::GetInt(Celulas1, "Modelo");
  454. JFSCarros[playerid][JFSCorX] = DOF2::GetFloat(Celulas1, "CorX");
  455. JFSCarros[playerid][JFSCorY] = DOF2::GetFloat(Celulas1, "CorY");
  456. JFSCarros[playerid][JFSCorZ] = DOF2::GetFloat(Celulas1, "CorZ");
  457. JFSCarros[playerid][JFSAngulo] = DOF2::GetFloat(Celulas1, "Angulo");
  458. JFSCarros[playerid][JFSCor1] = DOF2::GetInt(Celulas1, "Cor1");
  459. JFSCarros[playerid][JFSCor2] = DOF2::GetInt(Celulas1, "Cor2");
  460. JFSCarros[playerid][JFSCofre] = DOF2::GetInt(Celulas1, "Cofre");
  461. DOF2::GetString(Celulas1, "Placa", JFSCarros[playerid][JFSPlaca]);
  462. DOF2::SaveFile();
  463. CarregaraoConectar(playerid);
  464. }
  465. return true;
  466. }
  467.  
  468. stock CarregaraoConectar(playerid)
  469. {
  470. CarroJFS[playerid] = 1;
  471. JFSID[playerid] = CreateVehicle(JFSCarros[playerid][JFSModelo], JFSCarros[playerid][JFSCorX], JFSCarros[playerid][JFSCorY], JFSCarros[playerid][JFSCorZ], JFSCarros[playerid][JFSAngulo], JFSCarros[playerid][JFSCor1] , JFSCarros[playerid][JFSCor2], 0);
  472. SetVehicleNumberPlate(JFSID[playerid], JFSCarros[playerid][JFSPlaca]);
  473. return true;
  474. }
  475.  
  476. stock DestruiraoDesconectar(playerid)
  477. {
  478. format(Celulas1, sizeof(Celulas1), PastaConcessionaria, PlayerN(playerid));
  479. if(DOF2::FileExists(Celulas1)) DestroyVehicle(JFSID[playerid]), CarroJFS[playerid] = 0;
  480. return true;
  481. }
  482.  
  483. GETNumeroPaginas()
  484. {
  485. if((gTotalItems >= CARROSPAGINA) && (gTotalItems % CARROSPAGINA) == 0)
  486. {
  487. return (gTotalItems / CARROSPAGINA);
  488. }
  489. else return (gTotalItems / CARROSPAGINA) + 1;
  490. }
  491.  
  492. PlayerText:CreateCurrentPageTextDraw(playerid, Float:Xpos, Float:Ypos)
  493. {
  494. new PlayerText:txtInit;
  495. txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, "0/0");
  496. PlayerTextDrawUseBox(playerid, txtInit, 0);
  497. PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
  498. PlayerTextDrawFont(playerid, txtInit, 1);
  499. PlayerTextDrawSetShadow(playerid, txtInit, 0);
  500. PlayerTextDrawSetOutline(playerid, txtInit, 1);
  501. PlayerTextDrawColor(playerid, txtInit, 0xACCBF1FF);
  502. PlayerTextDrawShow(playerid, txtInit);
  503. return txtInit;
  504. }
  505. PlayerText:CreatePlayerDialogButton(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height, button_text[])
  506. {
  507. new PlayerText:txtInit;
  508. txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, button_text);
  509. PlayerTextDrawUseBox(playerid, txtInit, 1);
  510. PlayerTextDrawBoxColor(playerid, txtInit, 60);
  511. PlayerTextDrawBackgroundColor(playerid, txtInit,5);
  512. PlayerTextDrawLetterSize(playerid, txtInit, 0.4, 1.1);
  513. PlayerTextDrawFont(playerid, txtInit, 1);
  514. PlayerTextDrawSetShadow(playerid, txtInit, 0);
  515. PlayerTextDrawSetOutline(playerid, txtInit, 0);
  516. PlayerTextDrawColor(playerid, txtInit, 0xFFFFFFFF);
  517. PlayerTextDrawSetSelectable(playerid, txtInit, 1);
  518. PlayerTextDrawAlignment(playerid, txtInit, 2);
  519. PlayerTextDrawTextSize(playerid, txtInit, Height, Width);
  520. PlayerTextDrawShow(playerid, txtInit);
  521. return txtInit;
  522. }
  523.  
  524. PlayerText:CreatePlayerHeaderTextDraw(playerid, Float:Xpos, Float:Ypos, header_text[])
  525. {
  526. new PlayerText:txtInit;
  527. txtInit = CreatePlayerTextDraw(playerid, Xpos, Ypos, header_text);
  528. PlayerTextDrawUseBox(playerid, txtInit, 0);
  529. PlayerTextDrawLetterSize(playerid, txtInit, 1.25, 3.0);
  530. PlayerTextDrawFont(playerid, txtInit, 0);
  531. PlayerTextDrawSetShadow(playerid, txtInit, 0);
  532. PlayerTextDrawSetOutline(playerid, txtInit, 1);
  533. PlayerTextDrawColor(playerid, txtInit, 0xFFFFFFFF);
  534. PlayerTextDrawShow(playerid, txtInit);
  535. return txtInit;
  536. }
  537.  
  538. PlayerText:CreatePlayerBackgroundTextDraw(playerid, Float:Xpos, Float:Ypos, Float:Width, Float:Height)
  539. {
  540. new PlayerText:txtBackground = CreatePlayerTextDraw(playerid, Xpos, Ypos,
  541. " ~n~");
  542. PlayerTextDrawUseBox(playerid, txtBackground, 1);
  543. PlayerTextDrawBoxColor(playerid, txtBackground, 60);
  544. PlayerTextDrawLetterSize(playerid, txtBackground, 5.0, 5.0);
  545. PlayerTextDrawFont(playerid, txtBackground, 0);
  546. PlayerTextDrawSetShadow(playerid, txtBackground, 0);
  547. PlayerTextDrawSetOutline(playerid, txtBackground, 0);
  548. PlayerTextDrawColor(playerid, txtBackground, 0xFFFFFFFF);
  549. PlayerTextDrawTextSize(playerid, txtBackground, Width, Height);
  550. PlayerTextDrawBackgroundColor(playerid, txtBackground,0xFFFFFFFF);
  551. PlayerTextDrawShow(playerid, txtBackground);
  552. return txtBackground;
  553. }
  554.  
  555. PlayerText:CreateModelPreviewTextDraw(playerid, modelindex, Float:Xpos, Float:Ypos, Float:width, Float:height)
  556. {
  557. new PlayerText:txtPlayerSprite = CreatePlayerTextDraw(playerid, Xpos, Ypos, "");
  558. PlayerTextDrawFont(playerid, txtPlayerSprite, TEXT_DRAW_FONT_MODEL_PREVIEW);
  559. PlayerTextDrawColor(playerid, txtPlayerSprite, jCOR_FUNDO);
  560. PlayerTextDrawBackgroundColor(playerid, txtPlayerSprite, 0xFFFFFFFF);
  561. PlayerTextDrawTextSize(playerid, txtPlayerSprite, width, height);
  562. PlayerTextDrawSetPreviewModel(playerid, txtPlayerSprite, modelindex);
  563. PlayerTextDrawSetPreviewRot(playerid,txtPlayerSprite, -16.0, 0.0, -55.0);
  564. PlayerTextDrawSetSelectable(playerid, txtPlayerSprite, 1);
  565. PlayerTextDrawShow(playerid,txtPlayerSprite);
  566. return txtPlayerSprite;
  567. }
  568.  
  569. JFSComprouVeiculo(playerid, Modelo)
  570. {
  571. new rand = random(sizeof(VRandSpawn));
  572. JFSCarros[playerid][JFSModelo] = gSelectionItemssTag[playerid][Modelo];
  573. JFSCarros[playerid][JFSCorX] = VRandSpawn[rand][0];
  574. JFSCarros[playerid][JFSCorY] = VRandSpawn[rand][1];
  575. JFSCarros[playerid][JFSCorZ] = VRandSpawn[rand][2];
  576. JFSCarros[playerid][JFSAngulo] = VRandSpawn[rand][3];
  577. JFSCarros[playerid][JFSCor1] = -1;
  578. JFSCarros[playerid][JFSCor2] = -1;
  579. JFSID[playerid] = CreateVehicle(JFSCarros[playerid][JFSModelo], JFSCarros[playerid][JFSCorX], JFSCarros[playerid][JFSCorY], JFSCarros[playerid][JFSCorZ], JFSCarros[playerid][JFSAngulo], JFSCarros[playerid][JFSCor1] , JFSCarros[playerid][JFSCor2], 0);
  580. PutPlayerInVehicle(playerid, JFSID[playerid], 0);
  581. CarroJFS[playerid] = 1;
  582. GivePlayerMoney(playerid, -PrecoCarros);
  583. format(Celulas1, sizeof(Celulas1), "~w~VEICULO COMPRADO POR ~r~%dR$", PrecoCarros);
  584. GameTextForPlayer(playerid, Celulas1 , 5000,4);
  585. SalvarArquivos(playerid);
  586. }
  587.  
  588. DestroyPlayerModelPreviews(playerid)
  589. {
  590. new x=0;
  591. while(x != CARROSPAGINA) {
  592. if(gSelectionItemss[playerid][x] != PlayerText:INVALID_TEXT_DRAW) {
  593. PlayerTextDrawDestroy(playerid, gSelectionItemss[playerid][x]);
  594. gSelectionItemss[playerid][x] = PlayerText:INVALID_TEXT_DRAW;
  595. }
  596. x++;
  597. }
  598. }
  599.  
  600. ShowPlayerModelPreviews(playerid)
  601. {
  602. new x=0;
  603. new Float:BaseX = 75.0;
  604. new Float:BaseY = 130.0 - (70.0 * 0.33);
  605. new linetracker = 0;
  606.  
  607. new itemat = GetPVarInt(playerid, "JFSPagina") * CARROSPAGINA;
  608.  
  609. DestroyPlayerModelPreviews(playerid);
  610. while(x != CARROSPAGINA && itemat < gTotalItems) {
  611. if(linetracker == 0) {
  612. BaseX = 75.0 + 25.0;
  613. BaseY += 70.0 + 1.0;
  614. }
  615. gSelectionItemss[playerid][x] = CreateModelPreviewTextDraw(playerid, gItemLists[itemat], BaseX, BaseY, 60.0, 70.0);
  616. gSelectionItemssTag[playerid][x] = gItemLists[itemat];
  617. BaseX += 60.0 + 1.0;
  618. linetracker++;
  619. if(linetracker == CARROSLINHA) linetracker = 0;
  620. itemat++;
  621. x++;
  622. }
  623. }
  624.  
  625. UpdatePageTextDraw(playerid)
  626. {
  627. new PageText[64+1];
  628. format(PageText, 64, "%d/%d", GetPVarInt(playerid,"JFSPagina") + 1, GETNumeroPaginas());
  629. PlayerTextDrawSetString(playerid, gCurrentPageTextDrawIds[playerid], PageText);
  630. }
  631.  
  632. CreateSelectionMenu(playerid)
  633. {
  634. gBackgroundTextDrawIds[playerid] = CreatePlayerBackgroundTextDraw(playerid, 75.0, 130.0 + 20.0, 550.0, 180.0);
  635. gHeaderTextDrawIds[playerid] = CreatePlayerHeaderTextDraw(playerid, 75.0, 130.0, "Concessionaria");
  636. gCurrentPageTextDrawIds[playerid] = CreateCurrentPageTextDraw(playerid, 550.0 - 30.0, 130.0 + 15.0);
  637. gNextButtonTextDrawIds[playerid] = CreatePlayerDialogButton(playerid, 550.0 - 30.0, 130.0+180.0+100.0, 50.0, 16.0, "Proximo");
  638. gPrevButtonTextDrawIds[playerid] = CreatePlayerDialogButton(playerid, 550.0 - 90.0, 130.0+180.0+100.0, 50.0, 16.0, "Anterior");
  639.  
  640. ShowPlayerModelPreviews(playerid);
  641. UpdatePageTextDraw(playerid);
  642. SendClientMessage(playerid, -1, "| INFO | Para Sair aperte ESC !");
  643. }
  644.  
  645. DestroySelectionMenu(playerid)
  646. {
  647. DestroyPlayerModelPreviews(playerid);
  648.  
  649. PlayerTextDrawDestroy(playerid, gHeaderTextDrawIds[playerid]);
  650. PlayerTextDrawDestroy(playerid, gBackgroundTextDrawIds[playerid]);
  651. PlayerTextDrawDestroy(playerid, gCurrentPageTextDrawIds[playerid]);
  652. PlayerTextDrawDestroy(playerid, gNextButtonTextDrawIds[playerid]);
  653. PlayerTextDrawDestroy(playerid, gPrevButtonTextDrawIds[playerid]);
  654.  
  655. gHeaderTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  656. gBackgroundTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  657. gCurrentPageTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  658. gNextButtonTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  659. gPrevButtonTextDrawIds[playerid] = PlayerText:INVALID_TEXT_DRAW;
  660. }
Advertisement
Add Comment
Please, Sign In to add comment