Leonaardo

Untitled

Oct 16th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.82 KB | None | 0 0
  1. #include <a_samp>
  2. #include <DOF2>
  3.  
  4. //Nome dos Carros
  5. new vehName[][] ={
  6. "Landstalker","Bravura","Buffalo","Linerunner","Pereniel","Sentinel","Dumper","Firetruck","Trashmaster",
  7. "Limosine","Manana","Infernus","Voodoo","Pony","Mule","Cheetah","Ambulancia","Leviathan","Moonbeam","Esperanto",
  8. "Taxi","Washington","Bobcat","Mr Whoopee","BF Injection","Hunter","Premier","Enforcer","Securicar","Banshee",
  9. "Predator","Bus","Rhino","Barracks","Hotknife","Trailer","Previon","Coach","Cabbie","Stallion","Rumpo",
  10. "RC Bandit","Romero","Packer","Monster","Admiral","Squalo","Seasparrow","Pizzaboy","Tram","Trailer",
  11. "Turismo","Speeder","Reefer","Tropic","Flatbed","Yankee","Caddy","Solair","Berkley's RC Van","Skimmer",
  12. "PCJ-600","Faggio","Freeway","RC Baron","RC Raider","Glendale","Oceanic","Sanchez","Sparrow","Patriot",
  13. "Quad","Coastguard","Dinghy","Hermes","Sabre","Rustler","ZR-350","Walton","Regina","Comet","BMX",
  14. "Burrito","Camper","Marquis","Baggage","Dozer","Maverick","News Chopper","Rancher","FBI Rancher","Virgo",
  15. "Greenwood","Jetmax","Hotring","Sandking","Blista Compact","Maverick Policial","Boxville","Benson","Mesa",
  16. "RC Goblin","Hotring Racer A","Hotring Racer B","Bloodring Banger","Rancher","Super GT","Elegant",
  17. "Journey","Bike","Mountain Bike","Beagle","Cropdust","Stunt","Tanker","RoadTrain","Nebula","Majestic",
  18. "Buccaneer","Shamal","Hydra","FCR-900","NRG-500","HPV1000","Cement Truck","Tow Truck","Fortune","Cadrona",
  19. "FBI Truck","Willard","Forklift","Tractor","Combine","Feltzer","Remington","Slamvan","Blade","Freight",
  20. "Streak","Vortex","Vincent","Bullet","Clover","Sadler","Firetruck","Hustler","Intruder","Primo","Cargobob",
  21. "Tampa","Sunrise","Merit","Utility","Nevada","Yosemite","Windsor","Monster A","Monster B","Uranus",
  22. "Jester","Sultan","Stratum","Elegy","Raindance","RC Tiger","Flash","Tahoma","Savanna","Bandito","Freight",
  23. "Trailer","Kart","Mower","Duneride","Sweeper","Broadway","Tornado","AT-400","DFT-30","Huntley","Stafford",
  24. "BF-400","Newsvan","Tug","Trailer A","Emperor","Wayfarer","Euros","Hotdog","Club","Trailer B","Trailer C",
  25. "Andromada","Dodo","RC Cam","Launch","Viatura (LSPD)","Viatura (SFPD)","Viatura (LVPD)","Police Ranger",
  26. "Picador","S.W.A.T. Van","Alpha","Phoenix","Glendale","Sadler","Luggage Trailer A","Luggage Trailer B",
  27. "Stair Trailer","Boxville","Farm Plow","Utility Trailer" };
  28.  
  29. //===[ Sistema PART 1 ]===
  30. #define MAX_cCARROS 70// 1 a mais do máximo de carros (Máximo = 50)
  31. #define MAX_DIGITOS 4 //Máximo de digitos (+ 1) personalizados na placa (Máximo = 3)
  32. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  33. forward CarregarCarros();
  34. forward CarregarCarro(cCarroid);
  35. SalvarCarro(cCarroid);
  36. forward ComprarCarro(playerid);
  37. forward FuncaocCarro(playerid);
  38. forward CarroVida(playerid);
  39. PrecoCarro(playerid, modelo);
  40. forward DiniCarro(playerid);
  41. verificarPreco(modelo);
  42. verificarModelo(modelo);
  43. new CarroVidaTimer;
  44. enum cInfo123
  45. {
  46. cDono[MAX_PLAYER_NAME],
  47. cModelo,
  48. Float:cSpawnX,
  49. Float:cSpawnY,
  50. Float:cSpawnZ,
  51. Float:cAngulo,
  52. cCarroON,
  53. cCorUm,
  54. cCorDois,
  55. cChave[MAX_cCARROS],
  56. cCID,
  57. cPlaca[MAX_DIGITOS]
  58. };
  59. new Carro123[MAX_cCARROS][cInfo123];
  60. new cCarro[MAX_cCARROS];
  61. new TaNoCarro[MAX_PLAYERS];
  62. new ModeloCarro[MAX_PLAYERS];
  63. new Text3D:texto3DCarro[MAX_cCARROS];
  64. //------------------------------------------------------------------------------
  65. //===[ Sistema PART 2 ]===
  66. forward CarregarDono(playerid);
  67. forward SalvarDono(playerid);
  68. enum dInfo
  69. {
  70. dChave,
  71. dDono[MAX_PLAYER_NAME],
  72. dModelo
  73. };
  74. new Dono[MAX_PLAYERS][dInfo];
  75.  
  76. #define MAX_TIPOSCARROS 69 //Total de modelos
  77. //Preços
  78. #define PRECO_Bravura 23000
  79. #define PRECO_Buffalo 55000
  80. #define PRECO_Perenniel 46000
  81. #define PRECO_Sentinel 35000
  82. #define PRECO_Limosine 100000
  83. #define PRECO_Manana 30000
  84. #define PRECO_Voodoo 60000
  85. #define PRECO_Cheetah 85000
  86. #define PRECO_Moonbeam 40000
  87. #define PRECO_Esperanto 39000
  88. #define PRECO_Washington 29000
  89. #define PRECO_Premier 25000
  90. #define PRECO_Banshee 70000
  91. #define PRECO_Hotknife 69000
  92. #define PRECO_Previon 45000
  93. #define PRECO_Stallion 23000
  94. #define PRECO_Romero 57000
  95. #define PRECO_Admiral 41000
  96. #define PRECO_Turismo 1500000
  97. #define PRECO_Solair 42000
  98. #define PRECO_Glendale 73000
  99. #define PRECO_Oceanic 75000
  100. #define PRECO_Hermes 78000
  101. #define PRECO_Sabre 76000
  102. #define PRECO_ZR350 78000
  103. #define PRECO_Regina 50000
  104. #define PRECO_Comet 48000
  105. #define PRECO_Camper 33000
  106. #define PRECO_Virgo 51000
  107. #define PRECO_Greenwood 66000
  108. #define PRECO_BlistaCompact 39000
  109. #define PRECO_SuperGT 110000
  110. #define PRECO_Elegant 89000
  111. #define PRECO_Nebula 32000
  112. #define PRECO_Majestic 57000
  113. #define PRECO_Buccaneer 58000
  114. #define PRECO_Fortune 37000
  115. #define PRECO_Cadrona 22000
  116. #define PRECO_Willard 20000
  117. #define PRECO_Feltzer 26000
  118. #define PRECO_Remington 38000
  119. #define PRECO_Slamvan 88000
  120. #define PRECO_Blade 78000
  121. #define PRECO_Vincent 18000
  122. #define PRECO_Bullet 130000
  123. #define PRECO_Clover 19000
  124. #define PRECO_Hustler 44000
  125. #define PRECO_Intruder 21000
  126. #define PRECO_Primo 27000
  127. #define PRECO_Tampa 23000
  128. #define PRECO_Sunrise 49000
  129. #define PRECO_Merit 28000
  130. #define PRECO_Windsor 31000
  131. #define PRECO_Uranus 66000
  132. #define PRECO_Jester 77000
  133. #define PRECO_Sultan 88000
  134. #define PRECO_Stratum 33000
  135. #define PRECO_Elegy 89000
  136. #define PRECO_Flash 49000
  137. #define PRECO_Tahoma 47000
  138. #define PRECO_Savanna 84000
  139. #define PRECO_Broadway 61000
  140. #define PRECO_Tornado 45000
  141. #define PRECO_Stafford 71000
  142. #define PRECO_Emperor 69000
  143. #define PRECO_Euros 88000
  144. #define PRECO_Club 38000
  145. #define PRECO_Alpha 57000
  146. #define PRECO_Phoenix 79000
  147.  
  148. //------------------------------------------------------------------------------
  149.  
  150. strtok(const string[], &index)
  151. {
  152. new length = strlen(string);
  153. while ((index < length) && (string[index] <= ' '))
  154. {
  155. index++;
  156. }
  157.  
  158. new offset = index;
  159. new result[20];
  160. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  161. {
  162. result[index - offset] = string[index];
  163. index++;
  164. }
  165. result[index - offset] = EOS;
  166. return result;
  167. }
  168.  
  169. public CarroVida(playerid)
  170. {
  171. new Float:Vida;
  172. new VID = GetPlayerVehicleID(playerid);
  173. GetVehicleHealth(VID, Vida);
  174. if(Vida < 244)
  175. {
  176. new car = TaNoCarro[playerid];
  177. if(car > 0)
  178. {
  179. Delete3DTextLabel(texto3DCarro[car]);
  180. DestroyVehicle(cCarro[car]);
  181. SendClientMessage(playerid, 0xFFFFFFFF, "{2AC741}~~>{FFFFFF} Seu carro foi destruído por não ter um local de Respawn!");
  182. TaNoCarro[playerid] = 0;
  183. format(Carro123[car][cDono], MAX_PLAYER_NAME, "Ninguem");
  184. KillTimer(CarroVidaTimer);
  185. return 1;
  186. }
  187. }
  188. return 0;
  189. }
  190.  
  191. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  192. {
  193. for(new c = 0; c < MAX_cCARROS; c++)
  194. {
  195. if(Carro123[c][cCID] == vehicleid)
  196. {
  197. new string[256];
  198. format(string, sizeof(string), "{2AC741}~~>{FFFFFF} Esse Veiculo pertence o(a) Jogador(a) {2AC741}%s{FFFFFF}", Carro123[c][cDono]);
  199. SendClientMessage(playerid, 0xFFFFFFFF, string);
  200. }
  201. }
  202. return 1;
  203. }
  204.  
  205. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  206. {
  207. new PlayerNick[MAX_PLAYER_NAME];
  208. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  209. new arquivo[256];
  210. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  211. if(dialogid == 1319)
  212. {
  213. if(response == 1)
  214. {
  215. if(listitem == 0)
  216. {
  217. if(DOF2_FileExists(arquivo))
  218. {
  219. CarregarDono(playerid);
  220. new carro456 = Dono[playerid][dModelo];
  221. new string[256];
  222. format(string, sizeof(string), "{FFFFFF}» Tem certeza que deseja vender seu Veiculo?\nVocê receberá {2AC741}$%d", (verificarPreco(carro456)/2));
  223. ShowPlayerDialog(playerid,1320,DIALOG_STYLE_MSGBOX,"Concessionária",string,"Sim","Não");
  224. }
  225. else
  226. {
  227. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você não tem um Veiculo!");
  228. }
  229. }
  230. if(listitem == 1)
  231. {
  232. new textdialog[3000];
  233. new string[MAX_TIPOSCARROS][256];
  234. for(new c = 0; c < MAX_TIPOSCARROS; c++)
  235. {
  236. format(string[c], sizeof(string), "%s\t{2AC741}$%d\n", vehName[verificarModelo(c)-400] ,verificarPreco(verificarModelo(c)));
  237. strins(textdialog, string[c], strlen(textdialog));
  238. }
  239. ShowPlayerDialog(playerid,1321,DIALOG_STYLE_TABLIST,"{2AC741}Qual carro você deseja comprar?",textdialog,"{FFFFFF}Selecionar","{FFFFFF}Cancelar");
  240. }
  241. }
  242. else
  243. {
  244. //Tudo que vai acontecer no botão direito.
  245. }
  246. }
  247. if(dialogid == 1320)
  248. {
  249. if(response == 1)
  250. {
  251. if(DOF2_FileExists(arquivo))
  252. {
  253. new carro789 = Dono[playerid][dChave];
  254. GivePlayerMoney(playerid, (verificarPreco(Carro123[carro789][cModelo])/2));
  255. format(Carro123[carro789][cDono], MAX_PLAYER_NAME, "Ninguem");
  256. format(Carro123[carro789][cPlaca], MAX_DIGITOS, "RLS");
  257. Carro123[carro789][cCarroON] = 0;
  258. Carro123[carro789][cModelo] = 0;
  259. Carro123[carro789][cSpawnX] = 0.000000;
  260. Carro123[carro789][cSpawnY] = 0.000000;
  261. Carro123[carro789][cSpawnZ] = 0.000000;
  262. Carro123[carro789][cAngulo] = 0.000000;
  263. Carro123[carro789][cCorUm] = 0;
  264. Carro123[carro789][cCorDois] = 0;
  265. Dono[playerid][dChave] = 0;
  266. Dono[playerid][dModelo] = 0;
  267. format(Dono[playerid][dDono], MAX_PLAYER_NAME, "Ninguem");
  268. DOF2_RemoveFile(arquivo);
  269. SalvarCarro(carro789);
  270. Delete3DTextLabel(texto3DCarro[carro789]);
  271. DestroyVehicle(cCarro[carro789]);
  272. SendClientMessage(playerid, -1, "| INFO | Carro vendido com sucesso!");
  273. }
  274. else
  275. {
  276. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você não tem um Veiculo!");
  277. }
  278. }
  279. else
  280. {
  281. SendClientMessage(playerid, -1, "| INFO | Venda do veiculo foi cancelada!");
  282. }
  283. }
  284. if(dialogid == 1321)
  285. {
  286. if(response == 1)
  287. {
  288. if(!DOF2_FileExists(arquivo))
  289. {
  290. if(listitem == 0){ ModeloCarro[playerid] = 401; PrecoCarro(playerid, 401); }
  291. if(listitem == 1){ ModeloCarro[playerid] = 402; PrecoCarro(playerid, 402); }
  292. if(listitem == 2){ ModeloCarro[playerid] = 404; PrecoCarro(playerid, 404); }
  293. if(listitem == 3){ ModeloCarro[playerid] = 405; PrecoCarro(playerid, 405); }
  294. if(listitem == 4){ ModeloCarro[playerid] = 409; PrecoCarro(playerid, 409); }
  295. if(listitem == 5){ ModeloCarro[playerid] = 410; PrecoCarro(playerid, 410); }
  296. if(listitem == 6){ ModeloCarro[playerid] = 412; PrecoCarro(playerid, 412); }
  297. if(listitem == 7){ ModeloCarro[playerid] = 415; PrecoCarro(playerid, 415); }
  298. if(listitem == 8){ ModeloCarro[playerid] = 418; PrecoCarro(playerid, 418); }
  299. if(listitem == 9){ ModeloCarro[playerid] = 419; PrecoCarro(playerid, 419); }
  300. if(listitem == 10){ ModeloCarro[playerid] = 421; PrecoCarro(playerid, 421); }
  301. if(listitem == 11){ ModeloCarro[playerid] = 426; PrecoCarro(playerid, 426); }
  302. if(listitem == 12){ ModeloCarro[playerid] = 429; PrecoCarro(playerid, 429); }
  303. if(listitem == 13){ ModeloCarro[playerid] = 434; PrecoCarro(playerid, 434); }
  304. if(listitem == 14){ ModeloCarro[playerid] = 436; PrecoCarro(playerid, 436); }
  305. if(listitem == 15){ ModeloCarro[playerid] = 439; PrecoCarro(playerid, 439); }
  306. if(listitem == 16){ ModeloCarro[playerid] = 442; PrecoCarro(playerid, 442); }
  307. if(listitem == 17){ ModeloCarro[playerid] = 445; PrecoCarro(playerid, 445); }
  308. if(listitem == 18){ ModeloCarro[playerid] = 451; PrecoCarro(playerid, 451); }
  309. if(listitem == 19){ ModeloCarro[playerid] = 458; PrecoCarro(playerid, 458); }
  310. if(listitem == 20){ ModeloCarro[playerid] = 466; PrecoCarro(playerid, 466); }
  311. if(listitem == 21){ ModeloCarro[playerid] = 467; PrecoCarro(playerid, 467); }
  312. if(listitem == 22){ ModeloCarro[playerid] = 474; PrecoCarro(playerid, 474); }
  313. if(listitem == 23){ ModeloCarro[playerid] = 475; PrecoCarro(playerid, 475); }
  314. if(listitem == 24){ ModeloCarro[playerid] = 477; PrecoCarro(playerid, 477); }
  315. if(listitem == 25){ ModeloCarro[playerid] = 479; PrecoCarro(playerid, 479); }
  316. if(listitem == 26){ ModeloCarro[playerid] = 480; PrecoCarro(playerid, 480); }
  317. if(listitem == 27){ ModeloCarro[playerid] = 483; PrecoCarro(playerid, 483); }
  318. if(listitem == 28){ ModeloCarro[playerid] = 491; PrecoCarro(playerid, 491); }
  319. if(listitem == 29){ ModeloCarro[playerid] = 492; PrecoCarro(playerid, 492); }
  320. if(listitem == 30){ ModeloCarro[playerid] = 496; PrecoCarro(playerid, 496); }
  321. if(listitem == 31){ ModeloCarro[playerid] = 506; PrecoCarro(playerid, 506); }
  322. if(listitem == 32){ ModeloCarro[playerid] = 507; PrecoCarro(playerid, 507); }
  323. if(listitem == 33){ ModeloCarro[playerid] = 516; PrecoCarro(playerid, 516); }
  324. if(listitem == 34){ ModeloCarro[playerid] = 517; PrecoCarro(playerid, 517); }
  325. if(listitem == 35){ ModeloCarro[playerid] = 518; PrecoCarro(playerid, 518); }
  326. if(listitem == 36){ ModeloCarro[playerid] = 526; PrecoCarro(playerid, 526); }
  327. if(listitem == 37){ ModeloCarro[playerid] = 527; PrecoCarro(playerid, 527); }
  328. if(listitem == 38){ ModeloCarro[playerid] = 529; PrecoCarro(playerid, 529); }
  329. if(listitem == 39){ ModeloCarro[playerid] = 533; PrecoCarro(playerid, 533); }
  330. if(listitem == 40){ ModeloCarro[playerid] = 534; PrecoCarro(playerid, 534); }
  331. if(listitem == 41){ ModeloCarro[playerid] = 535; PrecoCarro(playerid, 535); }
  332. if(listitem == 42){ ModeloCarro[playerid] = 536; PrecoCarro(playerid, 536); }
  333. if(listitem == 43){ ModeloCarro[playerid] = 540; PrecoCarro(playerid, 540); }
  334. if(listitem == 44){ ModeloCarro[playerid] = 541; PrecoCarro(playerid, 541); }
  335. if(listitem == 45){ ModeloCarro[playerid] = 542; PrecoCarro(playerid, 542); }
  336. if(listitem == 46){ ModeloCarro[playerid] = 545; PrecoCarro(playerid, 545); }
  337. if(listitem == 47){ ModeloCarro[playerid] = 546; PrecoCarro(playerid, 546); }
  338. if(listitem == 48){ ModeloCarro[playerid] = 547; PrecoCarro(playerid, 547); }
  339. if(listitem == 49){ ModeloCarro[playerid] = 549; PrecoCarro(playerid, 549); }
  340. if(listitem == 50){ ModeloCarro[playerid] = 550; PrecoCarro(playerid, 550); }
  341. if(listitem == 51){ ModeloCarro[playerid] = 551; PrecoCarro(playerid, 551); }
  342. if(listitem == 52){ ModeloCarro[playerid] = 555; PrecoCarro(playerid, 555); }
  343. if(listitem == 53){ ModeloCarro[playerid] = 558; PrecoCarro(playerid, 558); }
  344. if(listitem == 54){ ModeloCarro[playerid] = 559; PrecoCarro(playerid, 559); }
  345. if(listitem == 55){ ModeloCarro[playerid] = 560; PrecoCarro(playerid, 560); }
  346. if(listitem == 56){ ModeloCarro[playerid] = 561; PrecoCarro(playerid, 561); }
  347. if(listitem == 57){ ModeloCarro[playerid] = 562; PrecoCarro(playerid, 562); }
  348. if(listitem == 58){ ModeloCarro[playerid] = 565; PrecoCarro(playerid, 565); }
  349. if(listitem == 59){ ModeloCarro[playerid] = 566; PrecoCarro(playerid, 566); }
  350. if(listitem == 60){ ModeloCarro[playerid] = 567; PrecoCarro(playerid, 567); }
  351. if(listitem == 61){ ModeloCarro[playerid] = 575; PrecoCarro(playerid, 575); }
  352. if(listitem == 62){ ModeloCarro[playerid] = 576; PrecoCarro(playerid, 576); }
  353. if(listitem == 63){ ModeloCarro[playerid] = 580; PrecoCarro(playerid, 580); }
  354. if(listitem == 64){ ModeloCarro[playerid] = 585; PrecoCarro(playerid, 585); }
  355. if(listitem == 65){ ModeloCarro[playerid] = 587; PrecoCarro(playerid, 587); }
  356. if(listitem == 66){ ModeloCarro[playerid] = 589; PrecoCarro(playerid, 589); }
  357. if(listitem == 67){ ModeloCarro[playerid] = 602; PrecoCarro(playerid, 602); }
  358. if(listitem == 68){ ModeloCarro[playerid] = 603; PrecoCarro(playerid, 603); }
  359. }
  360. else
  361. {
  362. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você já tem um veiculo!");
  363. }
  364. }
  365. else
  366. {
  367. SendClientMessage(playerid, -1, "| INFO | Compra de carro cancelada.");
  368. }
  369. }
  370. return 0;
  371. }
  372.  
  373. public OnPlayerConnect(playerid)
  374. {
  375. TaNoCarro[playerid] = 0;
  376. }
  377.  
  378. public OnPlayerDisconnect(playerid)
  379. {
  380. new car = TaNoCarro[playerid];
  381. if(car > 0)
  382. {
  383. Delete3DTextLabel(texto3DCarro[car]);
  384. DestroyVehicle(cCarro[car]);
  385. TaNoCarro[playerid] = 0;
  386. format(Carro123[car][cDono], MAX_PLAYER_NAME, "Ninguem");
  387. return 1;
  388. }
  389. return 0;
  390. }
  391.  
  392. public OnVehicleSpawn(vehicleid)
  393. {
  394. for(new c = 1; c<MAX_cCARROS; c++)
  395. {
  396. if(vehicleid == Carro123[c][cCID])
  397. {
  398. ChangeVehicleColor(vehicleid, Carro123[c][cCorUm], Carro123[c][cCorDois]);
  399. }
  400. }
  401. return 0;
  402. }
  403.  
  404. public OnPlayerExitVehicle(playerid, vehicleid)
  405. {
  406. new tcar = TaNoCarro[playerid];
  407. if(tcar > 0)
  408. {
  409. Delete3DTextLabel(texto3DCarro[tcar]);
  410. DestroyVehicle(cCarro[tcar]);
  411. SendClientMessage(playerid, -1, "");
  412. GivePlayerMoney(playerid, verificarPreco(ModeloCarro[playerid]));
  413. TaNoCarro[playerid] = 0;
  414. format(Carro123[tcar][cDono], MAX_PLAYER_NAME, "Ninguem");
  415. return 1;
  416. }
  417. return 0;
  418. }
  419.  
  420. public OnPlayerCommandText(playerid, cmdtext[])
  421. {
  422. new idx;
  423. new cmd[128];
  424. cmd = strtok(cmdtext, idx);
  425. if(strcmp(cmd, "/Deletarveiculo", true) == 0)
  426. {
  427. if(IsPlayerConnected(playerid))
  428. {
  429. if(IsPlayerAdmin(playerid))
  430. {
  431. new comando[256];
  432. comando = strtok(cmdtext, idx);
  433. if(!strlen(comando))
  434. {
  435. SendClientMessage(playerid, 0xFFFFFFAA, "USE: /Admdestruircarro [ Carro ID ]");
  436. return 1;
  437. }
  438. new carrito = strval(comando);
  439. if(Carro123[carrito][cCarroON] > 0)
  440. {
  441. new arquivo[256];
  442. new arquivo2[256];
  443. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini", carrito);
  444. format(Carro123[carrito][cDono], MAX_PLAYER_NAME, "%s", DOF2_GetString(arquivo,"cDono"));
  445. format(arquivo2, sizeof(arquivo2), "/Concessionaria/Donos/%s.ini",Carro123[carrito][cDono]);
  446. format(Carro123[carrito][cDono], MAX_PLAYER_NAME, "Ninguem");
  447. format(Carro123[carrito][cPlaca], MAX_DIGITOS, "RLS");
  448. Carro123[carrito][cCarroON] = 0;
  449. Carro123[carrito][cModelo] = 0;
  450. Carro123[carrito][cSpawnX] = 0.00000000;
  451. Carro123[carrito][cSpawnY] = 0.00000000;
  452. Carro123[carrito][cSpawnZ] = 0.00000000;
  453. Carro123[carrito][cAngulo] = 0.00000000;
  454. Carro123[carrito][cCorUm] = 0;
  455. Carro123[carrito][cCorDois] = 0;
  456. SalvarCarro(carrito);
  457. DOF2_RemoveFile(arquivo2);
  458. Delete3DTextLabel(texto3DCarro[carrito]);
  459. DestroyVehicle(cCarro[carrito]);
  460. SendClientMessage(playerid, -1, "Carro destruído com sucesso!");
  461. }
  462. else
  463. {
  464. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Esse veiculo não tem dono!");
  465. return 1;
  466. }
  467. }
  468. }
  469. return 1;
  470. }
  471. if(strcmp(cmdtext,"/estacionarcarro",true)==0)
  472. {
  473. if(IsPlayerInAnyVehicle(playerid))
  474. {
  475. new Float:X,Float:Y,Float:Z;
  476. new Float:A;
  477. new VID = GetPlayerVehicleID(playerid);
  478. CarregarDono(playerid);
  479. new PlayerNick[MAX_PLAYER_NAME];
  480. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  481. new arquivo[256];
  482. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  483. if(DOF2_FileExists(arquivo))
  484. {
  485. new carro12 = Dono[playerid][dChave];
  486. if(Carro123[carro12][cCID] == VID)
  487. {
  488. if(strcmp(PlayerNick,Carro123[carro12][cDono],true)==0)
  489. {
  490. CarregarCarro(carro12);
  491. GetVehicleZAngle(VID,A);
  492. GetVehiclePos(VID,X,Y,Z);
  493. Carro123[carro12][cSpawnX] = X;
  494. Carro123[carro12][cSpawnY] = Y;
  495. Carro123[carro12][cSpawnZ] = Z;
  496. Carro123[carro12][cAngulo] = A;
  497. format(Carro123[carro12][cDono], MAX_PLAYER_NAME, "%s", PlayerNick);
  498. Carro123[carro12][cCarroON] = 1;
  499. Delete3DTextLabel(texto3DCarro[carro12]);
  500. DestroyVehicle(cCarro[carro12]);
  501. cCarro[carro12] = AddStaticVehicle(Carro123[carro12][cModelo],Carro123[carro12][cSpawnX],Carro123[carro12][cSpawnY],Carro123[carro12][cSpawnZ],Carro123[carro12][cAngulo],Carro123[carro12][cCorUm],Carro123[carro12][cCorDois]);
  502. //new string[256];
  503. //format(string, sizeof(string), "[PLACA]\n%s-%d", Carro123[carro12][cPlaca], Carro123[carro12][cChave]);
  504. //texto3DCarro[carro12] = Create3DTextLabel(string, 0x3FCFFFFF, 0.0, 0.0, 0.0, 25.0, 0, 1);
  505. Attach3DTextLabelToVehicle( texto3DCarro[carro12], cCarro[carro12], 0.0,-3.0,0.0);
  506. PutPlayerInVehicle(playerid, cCarro[carro12], 0);
  507. Carro123[carro12][cCID] = VID;
  508. SalvarCarro(carro12);
  509. SendClientMessage(playerid, -1, "{2AC741}~~>{FFFFFF} Carro estacionado com sucesso!");
  510. return 1;
  511. }
  512. }
  513. else
  514. {
  515. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Este veiculo não é seu!");
  516. return 1;
  517. }
  518. }
  519. new car = TaNoCarro[playerid];
  520. if(car > 0)
  521. {
  522. CarregarCarro(car);
  523. GetVehicleZAngle(VID,A);
  524. GetVehiclePos(VID,X,Y,Z);
  525. Carro123[car][cSpawnX] = X;
  526. Carro123[car][cSpawnY] = Y;
  527. Carro123[car][cSpawnZ] = Z;
  528. Carro123[car][cAngulo] = A;
  529. Carro123[car][cCarroON] = 1;
  530. Dono[playerid][dChave] = car;
  531. Delete3DTextLabel(texto3DCarro[car]);
  532. DestroyVehicle(cCarro[car]);
  533. cCarro[car] = AddStaticVehicle(ModeloCarro[playerid],Carro123[car][cSpawnX],Carro123[car][cSpawnY],Carro123[car][cSpawnZ],Carro123[car][cAngulo],Carro123[car][cCorUm],Carro123[car][cCorDois]);
  534. //new string[256];
  535. //format(string, sizeof(string), "[PLACA]\n%s-%d", Carro123[car][cPlaca], Carro123[car][cChave]);
  536. //texto3DCarro[car] = Create3DTextLabel(string, 0x3FCFFFFF, 0.0, 0.0, 0.0, 25.0, 0, 1);
  537. Attach3DTextLabelToVehicle( texto3DCarro[car], cCarro[car], 0.0,-3.0,0.0);
  538. PutPlayerInVehicle(playerid, cCarro[car], 0);
  539. Carro123[car][cCID] = VID;
  540. ComprarCarro(playerid);
  541. SalvarCarro(car);
  542. SendClientMessage(playerid, -1, "{2AC741}~~>{FFFFFF} Veiculo estacionado com sucesso!");
  543. TaNoCarro[playerid] = 0;
  544. return 1;
  545. }
  546. else
  547. {
  548. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você não está em seu veiculo concessionaria!");
  549. return 1;
  550. }
  551. }
  552. return 1;
  553. }
  554. if(strcmp(cmdtext,"/concessionaria",true)==0)
  555. {
  556. if(PlayerToPoint(3, playerid, 548.3907, -1287.7068, 16.7539))
  557. {
  558. ShowPlayerDialog(playerid,1319,DIALOG_STYLE_LIST,"Concessionária","Vender Carro\nComprar Um Carro","Selecionar","Cancelar");
  559. TogglePlayerControllable(playerid, 1);
  560. return 1;
  561. }
  562. return 1;
  563. }
  564.  
  565. if(strcmp(cmdtext,"/Respawncarro",true)==0)
  566. {
  567. SetVehicleToRespawn(cCarro[idx]);
  568. return 1;
  569. }
  570.  
  571. if(strcmp(cmdtext,"/inicriar",true)==0)
  572. {
  573. if(IsPlayerAdmin(playerid))
  574. {
  575. DiniCarro(playerid);
  576. return 1;
  577. }
  578. else
  579. {
  580. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Comando Inválido!");
  581. return 1;
  582. }
  583. }
  584. /*if(strcmp(cmd,"/carroplaca",true)==0)
  585. {
  586. if(IsPlayerInAnyVehicle(playerid))
  587. {
  588. CarregarDono(playerid);
  589. new Comando[256];
  590. Comando = strtok(cmdtext, idx);
  591. new PlayerNick[MAX_PLAYER_NAME];
  592. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  593. new arquivo[256];
  594. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  595. if(strlen(Comando)!=(MAX_DIGITOS-1))
  596. {
  597. new string[256];
  598. format(string, sizeof(string), "| ERRO | Digite: /Carroplaca [Texto] (são permitidos %d letras/números)", MAX_DIGITOS-1);
  599. SendClientMessage(playerid, 0xFF0000FF, string);
  600. return 1;
  601. }
  602. if(DOF2_FileExists(arquivo))
  603. {
  604. new carro13 = Dono[playerid][dChave];
  605. if(GetPlayerVehicleID(playerid)==Carro123[carro13][cCID])
  606. {
  607. new string[256];
  608. format(string, sizeof(string), "{2AC741}~~>{FFFFFF} Placa alterada para %s-%d", Comando, Carro123[carro13][cChave]);
  609. SendClientMessage(playerid, 0x3FCFFFFF, string);
  610. //new string2[256];
  611. //format(Carro123[carro13][cPlaca], MAX_DIGITOS, "%s", Comando);
  612. //format(string2, sizeof(string2), "[PLACA]\n%s-%d", Carro123[carro13][cPlaca], Carro123[carro13][cChave]);
  613. //Update3DTextLabelText(texto3DCarro[carro13], 0x3FCFFFFF, string2);
  614. SalvarCarro(carro13);
  615. return 1;
  616. }
  617. else
  618. {
  619. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Este veiculo não é seu!");
  620. return 1;
  621. }
  622. }
  623. else
  624. {
  625. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você não tem um veiculo!");
  626. return 1;
  627. }
  628. }
  629. else
  630. {
  631. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você precisa estar no seu veiculo da concessionaria!");
  632. return 1;
  633. }
  634. }*/
  635. if(strcmp(cmd,"/corcarro",true)==0)
  636. {
  637. if(IsPlayerInAnyVehicle(playerid))
  638. {
  639. CarregarDono(playerid);
  640. new PlayerNick[MAX_PLAYER_NAME];
  641. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  642. new Comando[256];
  643. new Comando2[256];
  644. Comando = strtok(cmdtext, idx);
  645. Comando2 = strtok(cmdtext, idx);
  646. new Cor123;
  647. new Cor234;
  648. Cor123 = strval(Comando);
  649. Cor234 = strval(Comando2);
  650. new arquivo[256];
  651. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  652. if(!strlen(Comando))
  653. {
  654. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Digite: /Carrocor [cor1] [cor2]");
  655. return 1;
  656. }
  657. if(!strlen(Comando2))
  658. {
  659. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Digite: /Carrocor [cor1] [cor2]");
  660. return 1;
  661. }
  662. if(DOF2_FileExists(arquivo))
  663. {
  664. new carro14 = Dono[playerid][dChave];
  665. if(GetPlayerVehicleID(playerid)==Carro123[carro14][cCID])
  666. {
  667. ChangeVehicleColor(cCarro[carro14], Cor123, Cor234);
  668. Carro123[carro14][cCorUm] = Cor123;
  669. Carro123[carro14][cCorDois] = Cor234;
  670. SalvarCarro(carro14);
  671. SendClientMessage(playerid, -1, "{2AC741}~~>{FFFFFF} Carro pintado com sucesso!");
  672. return 1;
  673. }
  674. else
  675. {
  676. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Este veiculo não é seu!");
  677. return 1;
  678. }
  679. }
  680. else
  681. {
  682. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você não tem um veiculo!");
  683. return 1;
  684. }
  685. }
  686. else
  687. {
  688. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você precisa estar no seu veiculo concessionaria!");
  689. return 1;
  690. }
  691. }
  692. return 0;
  693. }
  694.  
  695. public OnPlayerKeyStateChange(playerid,newkeys,oldkeys)
  696. {
  697. if(newkeys == KEY_YES)
  698. {
  699. OnPlayerCommandText(playerid,"/concessionaria");
  700. }
  701. return 1;
  702. }
  703.  
  704. public OnFilterScriptInit()
  705. {
  706. CarregarCarros(); //2AC741
  707. for(new c = 0; c < sizeof(Carro123); c++)
  708. {
  709. if(Carro123[c][cCarroON] == 1)
  710. {
  711.  
  712. cCarro[c] = CreateVehicle(Carro123[c][cModelo],Carro123[c][cSpawnX],Carro123[c][cSpawnY],Carro123[c][cSpawnZ],Carro123[c][cAngulo],Carro123[c][cCorUm],Carro123[c][cCorDois], 60);
  713. Carro123[c][cCID] = cCarro[c];
  714. //new string[256];
  715. //format(string, sizeof(string), "[PLACA]\n%s-%d", Carro123[c][cPlaca], Carro123[c][cChave]);
  716. //texto3DCarro[c] = Create3DTextLabel(string, 0x3FCFFFFF, 0.0, 0.0, 0.0, 25.0, 0, 1);
  717. Attach3DTextLabelToVehicle( texto3DCarro[c], cCarro[c], 0.0,-3.0,0.0);
  718. }
  719. }
  720. CreateObject(19607, 2780.4939,-1812.2635,11.8438, 0, 0, 0);
  721. Create3DTextLabel("{2AC741}Concessionária\n{FFFFFF}Aperte '{2AC741}Y{FFFFFF}' para utilizar",0x3FCFFFFF,548.3907, -1287.7068, 16.7539, 40.0, 0, 50);
  722. return 0;
  723. }
  724.  
  725. public OnFilterScriptExit()
  726. {
  727. SalvarCarros();
  728. DOF2_Exit();
  729. }
  730.  
  731. public CarregarCarro(cCarroid)
  732. {
  733. new arquivo[256];
  734. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini", cCarroid);
  735. format(Carro123[cCarroid][cDono], MAX_PLAYER_NAME, "%s",DOF2_GetString(arquivo,"cDono"));
  736. format(Carro123[cCarroid][cPlaca], MAX_DIGITOS, "%s",DOF2_GetString(arquivo,"cPlaca"));
  737. Carro123[cCarroid][cCarroON] = DOF2_GetInt(arquivo,"cCarroON");
  738. Carro123[cCarroid][cModelo] = DOF2_GetInt(arquivo,"cModelo");
  739. Carro123[cCarroid][cSpawnX] = DOF2_GetFloat(arquivo,"cSpawnX");
  740. Carro123[cCarroid][cSpawnY] = DOF2_GetFloat(arquivo,"cSpawnY");
  741. Carro123[cCarroid][cSpawnZ] = DOF2_GetFloat(arquivo,"cSpawnZ");
  742. Carro123[cCarroid][cAngulo] = DOF2_GetFloat(arquivo,"cAngulo");
  743. Carro123[cCarroid][cCorUm] = DOF2_GetInt(arquivo,"CorUm");
  744. Carro123[cCarroid][cCorDois] = DOF2_GetInt(arquivo,"cCorDois");
  745. Carro123[cCarroid][cChave] = DOF2_GetInt(arquivo,"cChave");
  746. printf("=====[ CARREGANDO CARRO: %d ]=====",cCarroid);
  747. return 1;
  748. }
  749.  
  750. public CarregarCarros()
  751. {
  752. new arquivo[256];
  753. new idx = 1;
  754. while (idx < (MAX_cCARROS))
  755. {
  756. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini",idx);
  757. format(Carro123[idx][cDono], MAX_PLAYER_NAME, "%s",DOF2_GetString(arquivo,"cDono"));
  758. format(Carro123[idx][cPlaca], MAX_DIGITOS, "%s",DOF2_GetString(arquivo,"cPlaca"));
  759. Carro123[idx][cCarroON] = DOF2_GetInt(arquivo,"cCarroON");
  760. Carro123[idx][cModelo] = DOF2_GetInt(arquivo,"cModelo");
  761. Carro123[idx][cSpawnX] = DOF2_GetFloat(arquivo,"cSpawnX");
  762. Carro123[idx][cSpawnY] = DOF2_GetFloat(arquivo,"cSpawnY");
  763. Carro123[idx][cSpawnZ] = DOF2_GetFloat(arquivo,"cSpawnZ");
  764. Carro123[idx][cAngulo] = DOF2_GetFloat(arquivo,"cAngulo");
  765. Carro123[idx][cCorUm] = DOF2_GetInt(arquivo,"CorUm");
  766. Carro123[idx][cCorDois] = DOF2_GetInt(arquivo,"cCorDois");
  767. Carro123[idx][cChave] = DOF2_GetInt(arquivo,"cChave");
  768. printf("=====[ CARREGANDO CARRO: %d ]=====",idx);
  769. idx ++;
  770. }
  771. return 1;
  772. }
  773.  
  774. public DiniCarro(playerid)
  775. {
  776. new arquivo[256];
  777. new idx = 1;
  778. new string[256];
  779. while (idx < (MAX_cCARROS))
  780. {
  781. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini",idx);
  782. if(!DOF2_FileExists(arquivo))
  783. {
  784. new chave = idx;
  785. DOF2_CreateFile(arquivo);
  786. DOF2_SetString(arquivo,"cDono","Ninguem");
  787. DOF2_SetString(arquivo,"cPlaca","RLS");
  788. DOF2_SetInt(arquivo,"cCarroON",Carro123[idx][cCarroON]);
  789. DOF2_SetInt(arquivo,"cModelo",Carro123[idx][cModelo]);
  790. DOF2_SetFloat(arquivo,"cSpawnX",Carro123[idx][cSpawnX]);
  791. DOF2_SetFloat(arquivo,"cSpawnY",Carro123[idx][cSpawnY]);
  792. DOF2_SetFloat(arquivo,"cSpawnZ",Carro123[idx][cSpawnZ]);
  793. DOF2_SetFloat(arquivo,"cAngulo",Carro123[idx][cAngulo]);
  794. DOF2_SetInt(arquivo,"CorUm",Carro123[idx][cCorUm]);
  795. DOF2_SetInt(arquivo,"CorDois",Carro123[idx][cCorDois]);
  796. DOF2_SetInt(arquivo,"cChave", chave);
  797. printf("=====[ DINI, Carro %d ]=====",idx);
  798. format(string, sizeof(string), "[CONCESSIONÁRIA] .INI do Carro ' %d ' criada com sucesso...",idx);
  799. SendClientMessage(playerid, 0x33CCFFAA, string);
  800. idx ++;
  801. CarregarCarro(idx);
  802. }
  803. else
  804. {
  805. format(string, sizeof(string), "[CONCESSIONÁRIA] DINI do Carro ' %d ' já existe....",idx);
  806. SendClientMessage(playerid, 0xFFFFFFAA, string);
  807. idx ++;
  808. }
  809. }
  810. }
  811.  
  812. forward SalvarCarros();
  813. public SalvarCarros()
  814. {
  815. new arquivo[256];
  816. new idx = 1;
  817. while (idx < (MAX_cCARROS))
  818. {
  819. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini",idx);
  820. DOF2_SetString(arquivo,"cDono",Carro123[idx][cDono]);
  821. DOF2_SetString(arquivo,"cPlaca",Carro123[idx][cPlaca]);
  822. DOF2_SetInt(arquivo,"cCarroON",Carro123[idx][cCarroON]);
  823. DOF2_SetInt(arquivo,"cModelo",Carro123[idx][cModelo]);
  824. DOF2_SetFloat(arquivo,"cSpawnX",Carro123[idx][cSpawnX]);
  825. DOF2_SetFloat(arquivo,"cSpawnY",Carro123[idx][cSpawnY]);
  826. DOF2_SetFloat(arquivo,"cSpawnZ",Carro123[idx][cSpawnZ]);
  827. DOF2_SetFloat(arquivo,"cAngulo",Carro123[idx][cAngulo]);
  828. DOF2_SetInt(arquivo,"CorUm",Carro123[idx][cCorUm]);
  829. DOF2_SetInt(arquivo,"CorDois",Carro123[idx][cCorDois]);
  830. printf("=====[ SALVANDO CARRO: %d ]=====",idx);
  831. idx ++;
  832. }
  833. return 1;
  834. }
  835.  
  836. public SalvarCarro(cCarroid)
  837. {
  838. new arquivo[256];
  839. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini",cCarroid);
  840. DOF2_SetString(arquivo,"cDono",Carro123[cCarroid][cDono]);
  841. DOF2_SetString(arquivo,"cPlaca",Carro123[cCarroid][cPlaca]);
  842. DOF2_SetInt(arquivo,"cCarroON",Carro123[cCarroid][cCarroON]);
  843. DOF2_SetInt(arquivo,"cModelo",Carro123[cCarroid][cModelo]);
  844. DOF2_SetFloat(arquivo,"cSpawnX",Carro123[cCarroid][cSpawnX]);
  845. DOF2_SetFloat(arquivo,"cSpawnY",Carro123[cCarroid][cSpawnY]);
  846. DOF2_SetFloat(arquivo,"cSpawnZ",Carro123[cCarroid][cSpawnZ]);
  847. DOF2_SetFloat(arquivo,"cAngulo",Carro123[cCarroid][cAngulo]);
  848. DOF2_SetInt(arquivo,"CorUm",Carro123[cCarroid][cCorUm]);
  849. DOF2_SetInt(arquivo,"CorDois",Carro123[cCarroid][cCorDois]);
  850. printf("=====[ SALVANDO CARRO: %d ]=====",cCarroid);
  851. return DOF2_SaveFile();
  852. }
  853.  
  854. public CarregarDono(playerid)
  855. {
  856. new PlayerNick[MAX_PLAYER_NAME];
  857. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  858. new arquivo[256];
  859. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  860. if(DOF2_FileExists(arquivo))
  861. {
  862. strmid(Dono[playerid][dDono], DOF2_GetString(arquivo,"dDono"), 0, strlen(DOF2_GetString(arquivo,"dDono")), 32);
  863. Dono[playerid][dChave] = DOF2_GetInt(arquivo,"dChave");
  864. Dono[playerid][dModelo] = DOF2_GetInt(arquivo,"dModelo");
  865. }
  866. return 1;
  867. }
  868.  
  869. public SalvarDono(playerid)
  870. {
  871. new PlayerNick[MAX_PLAYER_NAME];
  872. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  873. new arquivo[256];
  874. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  875. DOF2_SetString(arquivo,"dDono",Dono[playerid][dDono]);
  876. DOF2_SetInt(arquivo,"dChave",Dono[playerid][dChave]);
  877. DOF2_SetInt(arquivo,"dModelo",Dono[playerid][dModelo]);
  878. return 1;
  879. }
  880.  
  881. public ComprarCarro(playerid)
  882. {
  883. for(new i=0; i<MAX_PLAYERS; i++)
  884. {
  885. new PlayerNick[MAX_PLAYER_NAME];
  886. GetPlayerName(i,PlayerNick,sizeof(PlayerNick));
  887. new arquivo[256];
  888. new arquivo2[256];
  889. new car = TaNoCarro[i];
  890. if(car > 0)
  891. {
  892. format(arquivo, sizeof(arquivo), "/Concessionaria/Carros/Carro%d.ini", car);
  893. strmid(Carro123[car][cDono], PlayerNick, 0, strlen(PlayerNick), MAX_PLAYER_NAME);
  894. DOF2_SetString(arquivo,"cDono",PlayerNick);
  895. Carro123[car][cModelo] = ModeloCarro[playerid];
  896. DOF2_SetInt(arquivo,"cCarroON",Carro123[car][cCarroON]);
  897. DOF2_SetInt(arquivo,"cModelo",Carro123[car][cModelo]);
  898. DOF2_SetFloat(arquivo,"cSpawnX",Carro123[car][cSpawnX]);
  899. DOF2_SetFloat(arquivo,"cSpawnY",Carro123[car][cSpawnY]);
  900. DOF2_SetFloat(arquivo,"cSpawnZ",Carro123[car][cSpawnZ]);
  901. DOF2_SetFloat(arquivo,"cAngulo",Carro123[car][cAngulo]);
  902. DOF2_SetInt(arquivo,"CorUm",Carro123[car][cCorUm]);
  903. DOF2_SetInt(arquivo,"CorDois",Carro123[car][cCorDois]);
  904. format(arquivo2, sizeof(arquivo2), "/Concessionaria/Donos/%s.ini",PlayerNick);
  905. if(!DOF2_FileExists(arquivo2))
  906. {
  907. DOF2_CreateFile(arquivo2);
  908. DOF2_SetString(arquivo2,"dDono",PlayerNick);
  909. DOF2_SetInt(arquivo2,"dChave",Dono[i][dChave]);
  910. DOF2_SetInt(arquivo2,"dModelo",ModeloCarro[playerid]);
  911. ModeloCarro[playerid] = 0;
  912. }
  913. return 1;
  914. }
  915. }
  916. return 1;
  917. }
  918.  
  919. verificarModelo(modelo)
  920. {
  921. if(modelo == 0){ return 401; }
  922. if(modelo == 1){ return 402; }
  923. if(modelo == 2){ return 404; }
  924. if(modelo == 3){ return 405; }
  925. if(modelo == 4){ return 409; }
  926. if(modelo == 5){ return 410; }
  927. if(modelo == 6){ return 412; }
  928. if(modelo == 7){ return 415; }
  929. if(modelo == 8){ return 418; }
  930. if(modelo == 9){ return 419; }
  931. if(modelo == 10){ return 421; }
  932. if(modelo == 11){ return 426; }
  933. if(modelo == 12){ return 429; }
  934. if(modelo == 13){ return 434; }
  935. if(modelo == 14){ return 436; }
  936. if(modelo == 15){ return 439; }
  937. if(modelo == 16){ return 442; }
  938. if(modelo == 17){ return 445; }
  939. if(modelo == 18){ return 451; }
  940. if(modelo == 19){ return 458; }
  941. if(modelo == 20){ return 466; }
  942. if(modelo == 21){ return 467; }
  943. if(modelo == 22){ return 474; }
  944. if(modelo == 23){ return 475; }
  945. if(modelo == 24){ return 477; }
  946. if(modelo == 25){ return 479; }
  947. if(modelo == 26){ return 480; }
  948. if(modelo == 27){ return 483; }
  949. if(modelo == 28){ return 491; }
  950. if(modelo == 29){ return 492; }
  951. if(modelo == 30){ return 496; }
  952. if(modelo == 31){ return 506; }
  953. if(modelo == 32){ return 507; }
  954. if(modelo == 33){ return 516; }
  955. if(modelo == 34){ return 517; }
  956. if(modelo == 35){ return 518; }
  957. if(modelo == 36){ return 526; }
  958. if(modelo == 37){ return 527; }
  959. if(modelo == 38){ return 529; }
  960. if(modelo == 39){ return 533; }
  961. if(modelo == 40){ return 534; }
  962. if(modelo == 41){ return 535; }
  963. if(modelo == 42){ return 536; }
  964. if(modelo == 43){ return 540; }
  965. if(modelo == 44){ return 541; }
  966. if(modelo == 45){ return 542; }
  967. if(modelo == 46){ return 545; }
  968. if(modelo == 47){ return 546; }
  969. if(modelo == 48){ return 547; }
  970. if(modelo == 49){ return 549; }
  971. if(modelo == 50){ return 550; }
  972. if(modelo == 51){ return 551; }
  973. if(modelo == 52){ return 555; }
  974. if(modelo == 53){ return 558; }
  975. if(modelo == 54){ return 559; }
  976. if(modelo == 55){ return 560; }
  977. if(modelo == 56){ return 561; }
  978. if(modelo == 57){ return 562; }
  979. if(modelo == 58){ return 565; }
  980. if(modelo == 59){ return 566; }
  981. if(modelo == 60){ return 567; }
  982. if(modelo == 61){ return 575; }
  983. if(modelo == 62){ return 576; }
  984. if(modelo == 63){ return 580; }
  985. if(modelo == 64){ return 585; }
  986. if(modelo == 65){ return 587; }
  987. if(modelo == 66){ return 589; }
  988. if(modelo == 67){ return 602; }
  989. if(modelo == 68){ return 603; }
  990. return 1;
  991. }
  992.  
  993.  
  994. verificarPreco(modelo)
  995. {
  996. if(modelo == 401){ return PRECO_Bravura; }
  997. if(modelo == 402){ return PRECO_Buffalo; }
  998. if(modelo == 404){ return PRECO_Perenniel; }
  999. if(modelo == 405){ return PRECO_Sentinel; }
  1000. if(modelo == 409){ return PRECO_Limosine; }
  1001. if(modelo == 410){ return PRECO_Manana; }
  1002. if(modelo == 412){ return PRECO_Voodoo; }
  1003. if(modelo == 415){ return PRECO_Cheetah; }
  1004. if(modelo == 418){ return PRECO_Moonbeam; }
  1005. if(modelo == 419){ return PRECO_Esperanto; }
  1006. if(modelo == 421){ return PRECO_Washington; }
  1007. if(modelo == 426){ return PRECO_Premier; }
  1008. if(modelo == 429){ return PRECO_Banshee; }
  1009. if(modelo == 434){ return PRECO_Hotknife; }
  1010. if(modelo == 436){ return PRECO_Previon; }
  1011. if(modelo == 439){ return PRECO_Stallion; }
  1012. if(modelo == 442){ return PRECO_Romero; }
  1013. if(modelo == 445){ return PRECO_Admiral; }
  1014. if(modelo == 451){ return PRECO_Turismo; }
  1015. if(modelo == 458){ return PRECO_Solair; }
  1016. if(modelo == 466){ return PRECO_Glendale; }
  1017. if(modelo == 467){ return PRECO_Oceanic; }
  1018. if(modelo == 474){ return PRECO_Hermes; }
  1019. if(modelo == 475){ return PRECO_Sabre; }
  1020. if(modelo == 477){ return PRECO_ZR350; }
  1021. if(modelo == 479){ return PRECO_Regina; }
  1022. if(modelo == 480){ return PRECO_Comet; }
  1023. if(modelo == 483){ return PRECO_Camper; }
  1024. if(modelo == 491){ return PRECO_Virgo; }
  1025. if(modelo == 492){ return PRECO_Greenwood; }
  1026. if(modelo == 496){ return PRECO_BlistaCompact; }
  1027. if(modelo == 506){ return PRECO_SuperGT; }
  1028. if(modelo == 507){ return PRECO_Elegant; }
  1029. if(modelo == 516){ return PRECO_Nebula; }
  1030. if(modelo == 517){ return PRECO_Majestic; }
  1031. if(modelo == 518){ return PRECO_Buccaneer; }
  1032. if(modelo == 526){ return PRECO_Fortune; }
  1033. if(modelo == 527){ return PRECO_Cadrona; }
  1034. if(modelo == 529){ return PRECO_Willard; }
  1035. if(modelo == 533){ return PRECO_Feltzer; }
  1036. if(modelo == 534){ return PRECO_Remington; }
  1037. if(modelo == 535){ return PRECO_Slamvan; }
  1038. if(modelo == 536){ return PRECO_Blade; }
  1039. if(modelo == 540){ return PRECO_Vincent; }
  1040. if(modelo == 541){ return PRECO_Bullet; }
  1041. if(modelo == 542){ return PRECO_Clover; }
  1042. if(modelo == 545){ return PRECO_Hustler; }
  1043. if(modelo == 546){ return PRECO_Intruder; }
  1044. if(modelo == 547){ return PRECO_Primo; }
  1045. if(modelo == 549){ return PRECO_Tampa; }
  1046. if(modelo == 550){ return PRECO_Sunrise; }
  1047. if(modelo == 551){ return PRECO_Merit; }
  1048. if(modelo == 555){ return PRECO_Windsor; }
  1049. if(modelo == 558){ return PRECO_Uranus; }
  1050. if(modelo == 559){ return PRECO_Jester; }
  1051. if(modelo == 560){ return PRECO_Sultan; }
  1052. if(modelo == 561){ return PRECO_Stratum; }
  1053. if(modelo == 562){ return PRECO_Elegy; }
  1054. if(modelo == 565){ return PRECO_Flash; }
  1055. if(modelo == 566){ return PRECO_Tahoma; }
  1056. if(modelo == 567){ return PRECO_Savanna; }
  1057. if(modelo == 575){ return PRECO_Broadway; }
  1058. if(modelo == 576){ return PRECO_Tornado; }
  1059. if(modelo == 580){ return PRECO_Stafford; }
  1060. if(modelo == 585){ return PRECO_Emperor; }
  1061. if(modelo == 587){ return PRECO_Euros; }
  1062. if(modelo == 589){ return PRECO_Club; }
  1063. if(modelo == 602){ return PRECO_Alpha; }
  1064. if(modelo == 603){ return PRECO_Phoenix; }
  1065. return 1;
  1066. }
  1067.  
  1068. PrecoCarro(playerid, modelo)
  1069. {
  1070. new valor = verificarPreco(modelo);
  1071. if(GetPlayerMoney(playerid) > valor)
  1072. {
  1073. GivePlayerMoney(playerid, -valor);
  1074. FuncaocCarro(playerid);
  1075. }
  1076. }
  1077.  
  1078. public FuncaocCarro(playerid)
  1079. {
  1080. if(IsPlayerConnected(playerid))
  1081. {
  1082.  
  1083. new PlayerNick[MAX_PLAYER_NAME];
  1084. GetPlayerName(playerid,PlayerNick,sizeof(PlayerNick));
  1085. new arquivo[256];
  1086. format(arquivo, sizeof(arquivo), "/Concessionaria/Donos/%s.ini",PlayerNick);
  1087. if(!DOF2_FileExists(arquivo))
  1088. {
  1089. if(ModeloCarro[playerid] > 0)
  1090. {
  1091. if(TaNoCarro[playerid] == 0)
  1092. {
  1093. new idx = 1;
  1094. while (idx < (MAX_cCARROS))
  1095. {
  1096. if(strcmp(Carro123[idx][cDono],"Ninguem",true)==0)
  1097. {
  1098. CarregarCarro(idx);
  1099. //new string[256];
  1100. //format(string, sizeof(string), "[PLACA]\n%s-%d",Carro123[idx][cPlaca], idx);
  1101. strmid(Carro123[idx][cDono], PlayerNick, 0, strlen(PlayerNick), MAX_PLAYER_NAME);
  1102. cCarro[idx] = AddStaticVehicle(ModeloCarro[playerid],533.8918,-1319.3507,16.8116,95.7052,0,0);
  1103. //texto3DCarro[idx] = Create3DTextLabel(string, 0x3FCFFFFF, 0.0, 0.0, 0.0, 25.0, 0, 1);
  1104. //Attach3DTextLabelToVehicle( texto3DCarro[idx], cCarro[idx], 0.0,-3.0,0.0);
  1105. PutPlayerInVehicle(playerid, cCarro[idx], 0);
  1106. TaNoCarro[playerid] = idx;
  1107. SendClientMessage(playerid, -1, "» Parabéns! Você acabou de comprar um veiculo novo!");
  1108. SendClientMessage(playerid, -1, "» Estacione ele usando '{2AC741}/EstacionarCarro{FFFFFF}', caso contrário ele será {FFFF00}destruído{FFFFFF}!");
  1109. SendClientMessage(playerid, -1, "» Use '/CorCarro [Cor1][Cor2]' para alterar as cores, depois de estacionar.");
  1110. //SendClientMessage(playerid, -1, "» Use '/CarroPlaca [Texto]' para alterar as três primeiras letras da placa.");
  1111. //SendClientMessage(playerid, -1, string);
  1112. CarroVidaTimer = SetTimer("CarroVida", 1000, 1);
  1113. return 1;
  1114. }
  1115. else
  1116. {
  1117. idx++;
  1118. }
  1119. }
  1120. }
  1121. else
  1122. {
  1123. SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Você já está em um veiculo da concessionária!");
  1124. return 1;
  1125. }
  1126. }
  1127. else
  1128. {
  1129. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você não definiu qual veiculo você quer!");
  1130. return 1;
  1131. }
  1132. }
  1133. else
  1134. {
  1135. SendClientMessage(playerid, 0xFF0000FF, "| ERRO | Você ja tem um veiculo concessionaria!");
  1136. }
  1137. }
  1138. return 1;
  1139. }
  1140.  
  1141. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  1142. {
  1143. if(IsPlayerConnected(playerid))
  1144. {
  1145. new Float:oldposx, Float:oldposy, Float:oldposz;
  1146. new Float:tempposx, Float:tempposy, Float:tempposz;
  1147. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  1148. tempposx = (oldposx -x);
  1149. tempposy = (oldposy -y);
  1150. tempposz = (oldposz -z);
  1151. //printf("DEBUG: X:%f Y:%f Z:%f",posx,posy,posz);
  1152. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  1153. {
  1154. return 1;
  1155. }
  1156. }
  1157. return 0;
  1158. }
Advertisement
Add Comment
Please, Sign In to add comment