Advertisement
Guest User

Concessionaria RCL

a guest
Jul 31st, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.21 KB | None | 0 0
  1. #define CARROS 0
  2. #define MAX_CARROS 50
  3. #define SPAWN_X 1941.8912
  4. #define SPAWN_Y 1309.2141
  5. #define SPAWN_Z 9.2578
  6. #define ANGULO 129.7679
  7.  
  8. #define Pasta "Veiculos/%s.ini"
  9.  
  10. #define Car_Landstalker 30000
  11. #define Car_Perenial 30000
  12. #define Car_Solair 30000
  13. #define Car_Regina 30000
  14. #define Car_Rancher 30000
  15. #define Car_Huntley 30000
  16. #define Car_Moonbeam 30000
  17. #define Car_Bravura 30000
  18. #define Car_Manana 30000
  19. #define Car_Esperanto 30000
  20. #define Car_Previon 30000
  21. #define Car_Virgo 30000
  22. #define Car_Blista_Compact 30000
  23. #define Car_Majestic 30000
  24. #define Car_Fortune 30000
  25. #define Car_Cadrona 30000
  26. #define Car_Tampa 30000
  27. #define Car_Club 30000
  28. #define Car_Admiral 30000
  29. #define Car_Glendale 30000
  30. #define Car_Oceanic 30000
  31. #define Car_Greenwood 30000
  32. #define Car_Nebula 30000
  33. #define Car_Williard 30000
  34. #define Car_Intruder 30000
  35. #define Car_Primo 30000
  36. #define Car_Clover 30000
  37. #define Car_Sentinel 30000
  38. #define Car_Washington 30000
  39. #define Car_Premier 30000
  40. #define Car_Elegant 30000
  41. #define Car_Vincent 30000
  42. #define Car_Sunrise 30000
  43. #define Car_Merit 30000
  44. #define Car_Emperor 30000
  45. #define Car_Stafford 30000
  46. #define Car_Buffalo 30000
  47. #define Car_Sabre 30000
  48. #define Car_Phoenix 30000
  49. #define Car_Alpha 30000
  50. #define Car_Buccaneer 30000
  51. #define Car_Stallion 30000
  52. #define Car_Hermes 30000
  53. #define Car_Hustler 30000
  54. #define Car_Bullet 30000
  55. #define Car_Uranus 30000
  56. #define Car_Jester 30000
  57. #define Car_Sultan 30000
  58. #define Car_Stratum 30000
  59. #define Car_Elegy 30000
  60. #define Car_Flash 30000
  61. #define Car_Infernus 30000
  62. #define Car_Cheetah 30000
  63. #define Car_Banshee 30000
  64. #define Car_Hotknife 30000
  65. #define Car_Turismo 30000
  66. #define Car_ZR_350 30000
  67. #define Car_Comet 30000
  68. #define Car_Super_GT 30000
  69. #define Car_Windsor 30000
  70. #define Car_Feltzer 30000
  71. #define Car_Euros 30000
  72. #define Car_Linerunner 30000
  73. #define Car_Mr_Whoopee 30000
  74. #define Car_Flatbed 30000
  75. #define Car_Yankee 30000
  76. #define Car_Boxville 30000
  77. #define Car_Benson 30000
  78. #define Car_Petrol 30000
  79. #define Car_Roadtrain 30000
  80. #define Car_Duneride 30000
  81. #define Car_Pony 30000
  82. #define Car_Bobcat 30000
  83. #define Car_Rumpo 30000
  84. #define Car_Walton 30000
  85. #define Car_Burrito 30000
  86. #define Car_Sadler 30000
  87. #define Car_Yosemite 30000
  88. #define Car_Picador 30000
  89. #define Car_Remington 30000
  90. #define Car_Slamvan 30000
  91. #define Car_Blade 30000
  92. #define Car_Savanna 30000
  93. #define Car_Broadway 30000
  94. #define Car_Tornado 30000
  95. #define Car_Tahoma 30000
  96. #define Car_PCJ_600 30000
  97. #define Car_Faggio 30000
  98. #define Car_Freeway 30000
  99. #define Car_Sanchez 30000
  100. #define Car_BMX 30000
  101. #define Car_Bike 30000
  102. #define Car_Mountain_Bike 30000
  103. #define Car_FCR_900 30000
  104. #define Car_NRG_500 30000
  105. #define Car_BF_400 30000
  106. #define Car_Wayfarer 30000
  107.  
  108. enum cInfo
  109. {
  110. cModel,
  111. Float:cLocationx,
  112. Float:cLocationy,
  113. Float:cLocationz,
  114. Float:cAngle,
  115. cColorOne,
  116. cColorTwo,
  117. cOwner[MAX_PLAYER_NAME],
  118. cValue,
  119. cOwned,
  120. cLock,
  121. cmod1,
  122. cmod2,
  123. cmod3,
  124. cmod4,
  125. cmod5,
  126. cmod6,
  127. cmod7,
  128. cmod8,
  129. cmod9,
  130. cmod10,
  131. cmod11,
  132. cmod12,
  133. cmod13,
  134. cmod14,
  135. cmod15,
  136. };
  137.  
  138. new InfoCarros[MAX_CARROS][cInfo];
  139.  
  140. new
  141. vNames[212][] =
  142. {
  143. "Landstalker", "Bravura", "Buffalo", "Linerunner", "Pereniel", "Sentinel", "Dumper", "Firetruck", "Trashmaster", "Stretch", "Manana", "Infernus",
  144. "Voodoo", "Pony", "Mule", "Cheetah", "Ambulance", "Leviathan", "Moonbeam", "Esperanto", "Taxi", "Washington", "Bobcat", "Mr Whoopee", "BF Injection",
  145. "Hunter", "Premier", "Enforcer", "Securicar", "Banshee", "Predator", "Bus", "Rhino", "Barracks", "Hotknife", "Trailer", "Previon", "Coach", "Cabbie",
  146. "Stallion", "Rumpo", "RC Bandit", "Romero", "Packer", "Monster", "Admiral", "Squalo", "Seasparrow", "Pizzaboy", "Tram", "Trailer", "Turismo", "Speeder",
  147. "Reefer", "Tropic", "Flatbed", "Yankee", "Caddy", "Solair", "Berkley's RC Van", "Skimmer", "PCJ-600", "Faggio", "Freeway", "RC Baron", "RC Raider",
  148. "Glendale", "Oceanic", "Sanchez", "Sparrow", "Patriot", "Quad", "Coastguard", "Dinghy", "Hermes", "Sabre", "Rustler", "ZR-350", "Walton", "Regina",
  149. "Comet", "BMX", "Burrito", "Camper", "Marquis", "Baggage", "Dozer", "Maverick", "News Chopper", "Rancher", "FBI Rancher", "Virgo", "Greenwood",
  150. "Jetmax", "Hotring", "Sandking", "Blista Compact", "Police Maverick", "Boxville", "Benson", "Mesa", "RC Goblin", "Hotring Racer A", "Hotring Racer B",
  151. "Bloodring Banger", "Rancher", "Super GT", "Elegant", "Journey", "Bike", "Mountain Bike", "Beagle", "Cropdust", "Stunt", "Tanker", "RoadTrain",
  152. "Nebula", "Majestic", "Buccaneer", "Shamal", "Hydra", "FCR-900", "NRG-500", "HPV1000", "Cement Truck", "Tow Truck", "Fortune", "Cadrona", "FBI Truck",
  153. "Willard", "Forklift", "Tractor", "Combine", "Feltzer", "Remington", "Slamvan", "Blade", "Freight", "Streak", "Vortex", "Vincent", "Bullet", "Clover",
  154. "Sadler", "Firetruck", "Hustler", "Intruder", "Primo", "Cargobob", "Tampa", "Sunrise", "Merit", "Utility", "Nevada", "Yosemite", "Windsor", "Monster A",
  155. "Monster B", "Uranus", "Jester", "Sultan", "Stratum", "Elegy", "Raindance", "RC Tiger", "Flash", "Tahoma", "Savanna", "Bandito", "Freight", "Trailer",
  156. "Kart", "Mower", "Duneride", "Sweeper", "Broadway", "Tornado", "AT-400", "DFT-30", "Huntley", "Stafford", "BF-400", "Newsvan", "Tug", "Trailer A", "Emperor",
  157. "Wayfarer", "Euros", "Hotdog", "Club", "Trailer B", "Trailer C", "Andromada", "Dodo", "RC Cam", "Launch", "Police Car (LSPD)", "Police Car (SFPD)",
  158. "Police Car (LVPD)", "Police Ranger", "Picador", "S.W.A.T. Van", "Alpha", "Phoenix", "Glendale", "Sadler", "Luggage Trailer A", "Luggage Trailer B",
  159. "Stair Trailer", "Boxville", "Farm Plow", "Utility Trailer"
  160. }
  161. ;
  162. stock ReturnVehicleID(vName[])
  163. {
  164. for(new x; x != 211; x++) if(strfind(vNames[x], vName, true) != -1) return x + 400;
  165. return INVALID_VEHICLE_ID;
  166. }
  167.  
  168. stock split(const strsrc[], strdest[][], delimiter)
  169. {
  170. new i, li;
  171. new aNum;
  172. new len;
  173. while(i <= strlen(strsrc)){
  174. if(strsrc[i]==delimiter || i==strlen(strsrc)){
  175. len = strmid(strdest[aNum], strsrc, li, i, 128);
  176. strdest[aNum][len] = 0;
  177. li = i+1;
  178. aNum++;
  179. }
  180. i++;
  181. }
  182. return 1;
  183. }
  184.  
  185. #pragma tabsize 0
  186.  
  187. new Text:TDEditor_TD[4];
  188. #define DIALOG_CONCE 1
  189. #define DIALOG_CARRO 2
  190. #define DIALOG_CCARRO 3
  191.  
  192. main()
  193. {
  194. print("\n----------------------------------");
  195. print(" Bare Script\n");
  196. print("----------------------------------\n");
  197. }
  198.  
  199. public OnPlayerConnect(playerid)
  200. {
  201. GameTextForPlayer(playerid,"~w~SA-MP: ~r~Bare Script",5000,5);
  202. return 1;
  203. }
  204.  
  205. public OnPlayerCommandText(playerid, cmdtext[])
  206. {
  207. new idx;
  208. new cmd[256];
  209.  
  210. cmd = strtok(cmdtext, idx);
  211.  
  212. if(strcmp(cmd, "/conce", true) == 0) {
  213. TextDrawShowForPlayer(playerid, TDEditor_TD[0]);
  214. TextDrawShowForPlayer(playerid, TDEditor_TD[1]);
  215. TextDrawShowForPlayer(playerid, TDEditor_TD[2]);
  216. TextDrawShowForPlayer(playerid, TDEditor_TD[3]);
  217. SelectTextDraw(playerid, 0xC0C0C0AA);
  218. return 1;
  219. }
  220.  
  221. if(strcmp(cmd, "/grana", true) == 0) {
  222. GivePlayerMoney(playerid, 999999);
  223. return 1;
  224. }
  225.  
  226. if(!strcmp(cmdtext, "/vendercarro", true))
  227. {
  228. if(IsPlayerConnected(playerid))
  229. {
  230. if (!IsPlayerInAnyVehicle(playerid) || !GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) return SendClientMessage(playerid,0xFFFFFF96,"{AFAFAF}** Você não está em um veículo ou ele não é seu!");
  231. new vehid = GetPlayerVehicleID(playerid);
  232. InfoCarros[vehid][cLocationx] = 5000.0;
  233. InfoCarros[vehid][cLocationy] = 5000.0;
  234. InfoCarros[vehid][cLocationz] = 5000.0;
  235. InfoCarros[vehid][cAngle] = 30.0;
  236. strmid(InfoCarros[vehid][cOwner], "Ninguém", 0, 24);
  237. RemovePlayerFromVehicle(playerid);
  238. TogglePlayerControllable(playerid, 1);
  239. GivePlayerMoney(playerid, InfoCarros[vehid][cValue]/2);
  240. SalvarCarros();
  241. DestroyVehicle(vehid);
  242. CreateVehicle(InfoCarros[vehid][cModel],InfoCarros[vehid][cLocationx],InfoCarros[vehid][cLocationy],InfoCarros[vehid][cLocationz]+1.0,InfoCarros[vehid][cAngle],InfoCarros[vehid][cColorOne],InfoCarros[vehid][cColorTwo],60000);
  243. return 1;
  244. }
  245. }
  246. if(strcmp(cmd, "/meucarro", true) == 0) return ShowPlayerDialog(playerid, DIALOG_CARRO, DIALOG_STYLE_LIST, "Meu Carro", "Estacionar\nTrancar Carro\nCor\nConectar Veiculo\nDesconectar Veiculo", "Selecionar", "Sair");
  247. return 0;
  248. }
  249.  
  250.  
  251. public OnPlayerSpawn(playerid)
  252. {
  253. SetPlayerInterior(playerid,0);
  254. TogglePlayerClock(playerid,0);
  255. return 1;
  256. }
  257.  
  258. public OnPlayerDeath(playerid, killerid, reason)
  259. {
  260. return 1;
  261. }
  262.  
  263. SetupPlayerForClassSelection(playerid)
  264. {
  265. SetPlayerInterior(playerid,14);
  266. SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
  267. SetPlayerFacingAngle(playerid, 270.0);
  268. SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
  269. SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
  270. }
  271.  
  272. public OnPlayerRequestClass(playerid, classid)
  273. {
  274. SetupPlayerForClassSelection(playerid);
  275. return 1;
  276. }
  277.  
  278. public OnGameModeInit()
  279. {
  280. SetGameModeText("Bare Script");
  281. ShowPlayerMarkers(1);
  282. ShowNameTags(1);
  283. AllowAdminTeleport(1);
  284.  
  285. AddPlayerClass(265,1958.3783,1343.1572,15.3746,270.1425,0,0,0,0,-1,-1);
  286.  
  287. TDEditor_TD[0] = TextDrawCreate(120.117607, 74.499984, "box");
  288. TextDrawLetterSize(TDEditor_TD[0], 0.000000, 31.223527);
  289. TextDrawTextSize(TDEditor_TD[0], 514.706359, 0.000000);
  290. TextDrawAlignment(TDEditor_TD[0], 1);
  291. TextDrawColor(TDEditor_TD[0], -1);
  292. TextDrawUseBox(TDEditor_TD[0], 1);
  293. TextDrawBoxColor(TDEditor_TD[0], 144);
  294. TextDrawSetShadow(TDEditor_TD[0], 0);
  295. TextDrawSetSelectable(TDEditor_TD[0], true);
  296. TextDrawSetOutline(TDEditor_TD[0], 0);
  297. TextDrawBackgroundColor(TDEditor_TD[0], 255);
  298. TextDrawFont(TDEditor_TD[0], 1);
  299. TextDrawSetProportional(TDEditor_TD[0], 1);
  300. TextDrawSetShadow(TDEditor_TD[0], 0);
  301.  
  302. TDEditor_TD[1] = TextDrawCreate(111.647026, 58.750015, "Concessionaria");
  303. TextDrawLetterSize(TDEditor_TD[1], 0.577881, 2.795834);
  304. TextDrawAlignment(TDEditor_TD[1], 1);
  305. TextDrawColor(TDEditor_TD[1], -1);
  306. TextDrawSetShadow(TDEditor_TD[1], 0);
  307. TextDrawSetOutline(TDEditor_TD[1], 1);
  308. TextDrawBackgroundColor(TDEditor_TD[1], 255);
  309. TextDrawFont(TDEditor_TD[1], 0);
  310. TextDrawSetProportional(TDEditor_TD[1], 1);
  311. TextDrawSetShadow(TDEditor_TD[1], 0);
  312.  
  313. TDEditor_TD[2] = TextDrawCreate(125.235336, 92.000015, "");
  314. TextDrawLetterSize(TDEditor_TD[2], 0.000000, 0.000000);
  315. TextDrawTextSize(TDEditor_TD[2], 90.000000, 90.000000);
  316. TextDrawAlignment(TDEditor_TD[2], 1);
  317. TextDrawColor(TDEditor_TD[2], -1);
  318. TextDrawSetShadow(TDEditor_TD[2], 0);
  319. TextDrawSetOutline(TDEditor_TD[2], 0);
  320. TextDrawBackgroundColor(TDEditor_TD[2], 25168);
  321. TextDrawFont(TDEditor_TD[2], 5);
  322. TextDrawSetProportional(TDEditor_TD[2], 0);
  323. TextDrawSetShadow(TDEditor_TD[2], 0);
  324. TextDrawSetSelectable(TDEditor_TD[2], true);
  325. TextDrawSetPreviewModel(TDEditor_TD[2], 411);
  326. TextDrawSetPreviewRot(TDEditor_TD[2], 0.000000, 0.000000, 0.000000, 1.000000);
  327. TextDrawSetPreviewVehCol(TDEditor_TD[2], 1, 1);
  328.  
  329. TDEditor_TD[3] = TextDrawCreate(217.421783, 91.483383, "");
  330. TextDrawLetterSize(TDEditor_TD[3], 0.000000, 0.000000);
  331. TextDrawTextSize(TDEditor_TD[3], 90.000000, 90.000000);
  332. TextDrawAlignment(TDEditor_TD[3], 1);
  333. TextDrawColor(TDEditor_TD[3], -1);
  334. TextDrawSetShadow(TDEditor_TD[3], 0);
  335. TextDrawSetOutline(TDEditor_TD[3], 0);
  336. TextDrawBackgroundColor(TDEditor_TD[3], 25168);
  337. TextDrawFont(TDEditor_TD[3], 5);
  338. TextDrawSetProportional(TDEditor_TD[3], 0);
  339. TextDrawSetShadow(TDEditor_TD[3], 0);
  340. TextDrawSetSelectable(TDEditor_TD[3], true);
  341. TextDrawSetPreviewModel(TDEditor_TD[3], 412);
  342. TextDrawSetPreviewRot(TDEditor_TD[3], 0.000000, 0.000000, 0.000000, 1.000000);
  343. TextDrawSetPreviewVehCol(TDEditor_TD[3], 1, 1);
  344.  
  345. return 1;
  346. }
  347.  
  348. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  349. {
  350. if(clickedid == TDEditor_TD[2])
  351. {
  352. ShowPlayerDialog(playerid, DIALOG_CONCE, DIALOG_STYLE_MSGBOX, "Concessionaria", "Voce deseja comprar o infernus por R$350", "Sim", "Nao");
  353. EsconderTexts(playerid);
  354. }
  355. return 1;
  356. }
  357. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  358. {
  359. new playername[20];
  360. if(dialogid == DIALOG_CARRO)
  361. {
  362. if(!response) return 0;
  363. switch (listitem)
  364. {
  365. case 0:
  366. {
  367. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder estacioná-lo!");
  368. new Float:x,Float:y,Float:z;
  369. new Float:a;
  370. new carid;
  371. if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) { carid = GetPlayerVehicleID(playerid); }
  372. else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder estacioná-lo!");
  373. GetPlayerName(playerid, playername, sizeof(playername));
  374. GetVehiclePos(carid, x, y, z);
  375. //GetPlayerFacingAngle(playerid, a);
  376. GetVehicleZAngle(carid, a);
  377. if(IsPlayerInVehicle(playerid,carid) && InfoCarros[carid][cOwned] == 1)
  378. {
  379. InfoCarros[carid][cLocationx] = x;
  380. InfoCarros[carid][cLocationy] = y;
  381. InfoCarros[carid][cLocationz] = z;
  382. InfoCarros[carid][cAngle] = a;
  383. SalvarCarros();
  384. DestroyVehicle(carid);
  385. CreateVehicle(InfoCarros[carid][cModel],InfoCarros[carid][cLocationx],InfoCarros[carid][cLocationy],InfoCarros[carid][cLocationz]+1.0,InfoCarros[carid][cAngle],InfoCarros[carid][cColorOne],InfoCarros[carid][cColorTwo],60000);
  386. //SetVehicleHealth(carid, InfoCarros[carid][cDamage]);
  387. TogglePlayerControllable(playerid, 1);
  388. return 1;
  389. }
  390. }
  391. case 1:
  392. {
  393. new string[64];
  394. new keycar = GetPlayerVehicleID(playerid);
  395. new engine, lights, alarm, doors, bonnet, boot, objective;
  396. GetVehicleParamsEx(keycar,engine, lights, alarm, doors, bonnet, boot, objective);
  397. if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid)))
  398. {
  399. if(doors)
  400. {
  401. SetVehicleParamsEx(keycar,engine, lights, alarm, false, bonnet, boot, objective);
  402. format(string, sizeof(string), "~w~Veiculo~n~~g~Destrancado");
  403. GameTextForPlayer(playerid, string, 4000, 3);
  404. InfoCarros[keycar][cLock] = 0;
  405. SalvarCarros();
  406. return 1;
  407. }
  408. else
  409. {
  410. SetVehicleParamsEx(keycar,engine, lights, alarm, true, bonnet, boot, objective);
  411. format(string, sizeof(string), "~w~Veiculo~n~~r~Trancado");
  412. GameTextForPlayer(playerid, string, 4000, 3);
  413. InfoCarros[keycar][cLock] = 1;
  414. SalvarCarros();
  415. return 1;
  416. }
  417. }
  418. else
  419. {
  420. SendClientMessage(playerid, 0xFFFFFFFF, " Você não tem um veiculo no slot 1");
  421. return 1;
  422. }
  423. }
  424. case 2:
  425. {
  426. if(IsPlayerInAnyVehicle(playerid)) return ShowPlayerDialog(playerid, DIALOG_CCARRO, DIALOG_STYLE_INPUT, "Cor do Carro", "Digite abaixo a cor de seu carro.\nDigite a cor 1 e a cor 2 separadas por vírgula\nExemplo: 250,35\nATENÇÃO: A COR DEVE SER ENTRE 1 E 255!!!", "Aceitar", "Voltar");
  427. else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa estar dentro de seu carro para poder pintá-lo!");
  428. }
  429. }
  430. return 1;
  431. }
  432. if(dialogid == DIALOG_CCARRO)
  433. {
  434. if(response)
  435. {
  436. new carid;
  437. if(GetPlayerCarID(playerid, GetPlayerVehicleID(playerid))) { carid = GetPlayerVehicleID(playerid); }
  438. else return SendClientMessage(playerid, 0xFFFFFFFF, "Você precisa ter um carro para poder pintá-lo!");
  439. new arrCoords[2][64];
  440. new color1;
  441. new color2;
  442. split(inputtext, arrCoords, ',');
  443. color1 = strval(arrCoords[0]);
  444. color2 = strval(arrCoords[1]);
  445. if(IsPlayerInVehicle(playerid, carid))
  446. {
  447. InfoCarros[carid][cColorOne] = color1;
  448. InfoCarros[carid][cColorTwo] = color2;
  449. ChangeVehicleColor(carid, color1, color2);
  450. SalvarCarros();
  451. return 1;
  452. }
  453. }
  454. }
  455. if(dialogid == DIALOG_CONCE)
  456. {
  457. if(response)
  458. {
  459. CreateDealershipCar(playerid, "Turismo", Car_Turismo, SPAWN_X, SPAWN_Y, SPAWN_Z, ANGULO);
  460. }
  461. else
  462. {
  463. SendClientMessage(playerid, -1, "Voce cancelou a compra do veiculo!");
  464. }
  465. }
  466. return 1;
  467. }
  468.  
  469. public OnPlayerDisconnect(playerid, reason)
  470. {
  471. SalvarCarros();
  472. DOF2_Exit();
  473. return 1;
  474. }
  475.  
  476. strtok(const string[], &index)
  477. {
  478. new length = strlen(string);
  479. while ((index < length) && (string[index] <= ' '))
  480. {
  481. index++;
  482. }
  483.  
  484. new offset = index;
  485. new result[20];
  486. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  487. {
  488. result[index - offset] = string[index];
  489. index++;
  490. }
  491. result[index - offset] = EOS;
  492. return result;
  493. }
  494.  
  495. stock EsconderTexts(playerid)
  496. {
  497. TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
  498. TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
  499. TextDrawHideForPlayer(playerid, TDEditor_TD[2]);
  500. TextDrawHideForPlayer(playerid, TDEditor_TD[3]);
  501. CancelSelectTextDraw(playerid); // Função para voltar o mouse ao normal
  502. return 1;
  503. }
  504.  
  505. stock SalvarCarros()
  506. {
  507. new file[120];
  508. {
  509. for(new idx = 1; idx < MAX_CARROS; idx ++)
  510. {
  511. format(file, 120, Pasta, CARROS, idx);
  512. while (idx < sizeof(InfoCarros))
  513. if(DOF2_FileExists(file))
  514. DOF2_SetInt(file, "Modelo", InfoCarros[idx][cModel]);
  515. DOF2_SetFloat(file, "LocalX", InfoCarros[idx][cLocationx]);
  516. DOF2_SetFloat(file, "LocalY", InfoCarros[idx][cLocationy]);
  517. DOF2_SetFloat(file, "LocalZ", InfoCarros[idx][cLocationz]);
  518. DOF2_SetFloat(file, "Angulo", InfoCarros[idx][cAngle]);
  519. DOF2_SetInt(file, "Cor1", InfoCarros[idx][cColorOne]);
  520. DOF2_SetInt(file, "Cor2", InfoCarros[idx][cColorTwo]);
  521. DOF2_SetInt(file, "Dono", InfoCarros[idx][cOwner]);
  522. DOF2_SetInt(file, "Valor", InfoCarros[idx][cValue]);
  523. DOF2_SetInt(file, "TemDono", InfoCarros[idx][cOwned]);
  524. DOF2_SetInt(file, "Fechado", InfoCarros[idx][cLock]);
  525. DOF2_SetInt(file, "Cmod1", InfoCarros[idx][cmod1]);
  526. DOF2_SetInt(file, "Cmod2", InfoCarros[idx][cmod2]);
  527. DOF2_SetInt(file, "Cmod3", InfoCarros[idx][cmod3]);
  528. DOF2_SetInt(file, "Cmod4", InfoCarros[idx][cmod4]);
  529. DOF2_SetInt(file, "Cmod5", InfoCarros[idx][cmod5]);
  530. DOF2_SetInt(file, "Cmod6", InfoCarros[idx][cmod6]);
  531. DOF2_SetInt(file, "Cmod7", InfoCarros[idx][cmod7]);
  532. DOF2_SetInt(file, "Cmod8", InfoCarros[idx][cmod8]);
  533. DOF2_SetInt(file, "Cmod9", InfoCarros[idx][cmod9]);
  534. DOF2_SetInt(file, "Cmod10", InfoCarros[idx][cmod10]);
  535. DOF2_SetInt(file, "Cmod11", InfoCarros[idx][cmod11]);
  536. DOF2_SetInt(file, "Cmod12", InfoCarros[idx][cmod12]);
  537. DOF2_SetInt(file, "Cmod13", InfoCarros[idx][cmod13]);
  538. DOF2_SetInt(file, "Cmod14", InfoCarros[idx][cmod14]);
  539. DOF2_SetInt(file, "Cmod15", InfoCarros[idx][cmod15]);
  540. DOF2_SaveFile();
  541. }
  542. }
  543. }
  544.  
  545. stock CarregarCarros()
  546. {
  547. new arrCoords[26][64];
  548. new strFromFile2[256];
  549. new File: file = fopen("Concessionaria.cfg", io_read);
  550. if (file)
  551. {
  552. new idx = CARROS;
  553. while (idx < sizeof(InfoCarros))
  554. {
  555. fread(file, strFromFile2);
  556. split(strFromFile2, arrCoords, '|');
  557. InfoCarros[idx][cModel] = strval(arrCoords[0]);
  558. InfoCarros[idx][cLocationx] = floatstr(arrCoords[1]);
  559. InfoCarros[idx][cLocationy] = floatstr(arrCoords[2]);
  560. InfoCarros[idx][cLocationz] = floatstr(arrCoords[3]);
  561. InfoCarros[idx][cAngle] = floatstr(arrCoords[4]);
  562. InfoCarros[idx][cColorOne] = strval(arrCoords[5]);
  563. InfoCarros[idx][cColorTwo] = strval(arrCoords[6]);
  564. strmid(InfoCarros[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
  565. InfoCarros[idx][cValue] = strval(arrCoords[8]);
  566. InfoCarros[idx][cOwned] = strval(arrCoords[9]);
  567. InfoCarros[idx][cLock] = strval(arrCoords[10]);
  568. InfoCarros[idx][cmod1] = strval(arrCoords[11]);
  569. InfoCarros[idx][cmod2] = strval(arrCoords[12]);
  570. InfoCarros[idx][cmod3] = strval(arrCoords[13]);
  571. InfoCarros[idx][cmod4] = strval(arrCoords[14]);
  572. InfoCarros[idx][cmod5] = strval(arrCoords[15]);
  573. InfoCarros[idx][cmod6] = strval(arrCoords[16]);
  574. InfoCarros[idx][cmod7] = strval(arrCoords[17]);
  575. InfoCarros[idx][cmod8] = strval(arrCoords[18]);
  576. InfoCarros[idx][cmod9] = strval(arrCoords[19]);
  577. InfoCarros[idx][cmod10] = strval(arrCoords[20]);
  578. InfoCarros[idx][cmod11] = strval(arrCoords[21]);
  579. InfoCarros[idx][cmod12] = strval(arrCoords[22]);
  580. InfoCarros[idx][cmod13] = strval(arrCoords[23]);
  581. InfoCarros[idx][cmod14] = strval(arrCoords[24]);
  582. InfoCarros[idx][cmod15] = strval(arrCoords[25]);
  583. idx++;
  584. }
  585. }
  586. }
  587.  
  588. stock CreateDealershipCar(playerid, name[MAX_PLAYER_NAME], price, Float:posX, Float:posY, Float:posZ, Float:angle)
  589. {
  590. new model = ReturnVehicleID(name);
  591. new sendername[20];
  592. if(GetPlayerMoney(playerid) < price) return SendClientMessage(playerid, 0xFFFFFFFF, "Você não tem dinheiro suficiente!");
  593. {
  594. new colorOne = 0 + random(255);
  595. new colorTwo = 0 + random(255);
  596. new idcar = CreateVehicle(model,posX,posY,posZ,angle,colorOne,colorTwo,60000);
  597. InfoCarros[idcar][cModel] = model;
  598. SendClientMessage(playerid, 0xFFFFFFFF, "Parabéns pelo seu carro!");
  599. InfoCarros[idcar][cLocationx] = posX;
  600. InfoCarros[idcar][cLocationy] = posY;
  601. InfoCarros[idcar][cLocationz] = posZ;
  602. InfoCarros[idcar][cAngle] = angle;
  603. InfoCarros[idcar][cColorOne] = colorOne;
  604. InfoCarros[idcar][cColorTwo] = colorTwo;
  605. InfoCarros[idcar][cValue] = price;
  606. InfoCarros[idcar][cOwned] = 1;
  607. GivePlayerMoney(playerid,-price);
  608. GetPlayerName(playerid, sendername, sizeof(sendername));
  609. strmid(InfoCarros[idcar][cOwner], sendername, 0, strlen(sendername), 999);
  610. SalvarCarros();
  611. }
  612. return 1;
  613. }
  614.  
  615. stock GetPlayerCarID(playerid, vehicle)
  616. {
  617. new playername[MAX_PLAYER_NAME];
  618. GetPlayerName(playerid, playername, sizeof(playername));
  619. if(!strcmp(InfoCarros[vehicle][cOwner], playername, true)) return 1;
  620. else return 0;
  621. }
  622.  
  623. stock GetPlayerAllCars(playerid)
  624. {
  625. for(new i = 0; i < sizeof(InfoCarros); i++)
  626. {
  627. new playername[24];
  628. new string[128];
  629. GetPlayerName(playerid, playername, 24);
  630. if(!strcmp(InfoCarros[i][cOwner], playername, true))
  631. {
  632. format(string, 128, "Você possui o carro id: %i **", i);
  633. SendClientMessage(playerid, 0xFFFFFFFF, string);
  634. }
  635. }
  636. return 1;
  637. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement