Advertisement
Guest User

Untitled

a guest
Apr 17th, 2019
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 59.74 KB | None | 0 0
  1. /*
  2. Garage system (include) by Edison for Burned RPG gamemode.
  3. Started date: 05.11.2017, 9:38 AM
  4. Version: 0.1
  5.  
  6. Mentinuti:
  7. > Adaugat in baza de date la vehicule un nou rand cu Virtual World
  8. */
  9. #include <YSI\y_hooks>
  10.  
  11. #define MAX_GARAGES 10
  12. #define SELL_GARAGE_PRICE 100000
  13.  
  14. #define DIALOG_CREATEGARAGE 600
  15. #define DIALOG_MOVEGARAGE 601
  16. #define DIALOG_BUYGARAGE 602
  17. #define DIALOG_SELLGARAGE 603
  18. #define DIALOG_PARKVEHICLE 604
  19.  
  20. enum gInfo {
  21. gID,
  22. gOwner[32],
  23. gUserID,
  24. gPrice,
  25. gVirtualID,
  26. gPickup,
  27. Text3D:garageLabel,
  28. Float:gPos[3],
  29. Float:gAngle
  30. };
  31.  
  32. new Float: garageCamera[10][3] = {
  33. {489.4090, -407.8293, 2759.0259},
  34. {487.9755, -413.0212, 2758.8210},
  35. {488.2816, -417.9112, 2759.0208},
  36. {487.9942, -422.5949, 2758.6604},
  37. {488.0660, -427.1760, 2758.8335},
  38. {487.4478, -407.2060, 2759.0398},
  39. {487.2461, -413.1223, 2759.0398},
  40. {487.0870, -418.3049, 2759.0398},
  41. {486.8073, -423.0642, 2759.0398},
  42. {486.5077, -427.8227, 2759.0398}
  43. };
  44.  
  45. new Float: garageCamera_at[10][3] = {
  46. {488.5297, -407.3569, 2758.8579},
  47. {487.1125, -412.5193, 2758.7012},
  48. {487.3769, -417.4890, 2758.8955},
  49. {487.0796, -422.1945, 2758.5706},
  50. {487.1324, -426.8218, 2758.6987},
  51. {488.4458, -407.2309, 2758.8540},
  52. {488.2441, -413.1472, 2758.8540},
  53. {488.0849, -418.3358, 2758.8540},
  54. {487.8037, -423.1270, 2758.8589},
  55. {487.5041, -427.8854, 2758.8589}
  56. };
  57.  
  58. new
  59. garageInfo[MAX_GARAGES][gInfo], garages,
  60. PlayerText: BarTD, BarTimer[MAX_PLAYERS], Step[MAX_PLAYERS],
  61. PlayerText: GaragePTD[3], Text: GarageTD[5];
  62.  
  63. hook OnGameModeInit() {
  64. SetTimer("LoadGarages", 1000, false);
  65. load_garage_map();
  66.  
  67. GarageTD[0] = TextDrawCreate(537.499511, 331.866485, "My Garage");
  68. TextDrawLetterSize(GarageTD[0], 0.215999, 1.222517);
  69. TextDrawTextSize(GarageTD[0], 0.000000, 128.000000);
  70. TextDrawAlignment(GarageTD[0], 2);
  71. TextDrawColor(GarageTD[0], -1);
  72. TextDrawUseBox(GarageTD[0], 1);
  73. TextDrawBoxColor(GarageTD[0], 255);
  74. TextDrawSetShadow(GarageTD[0], 0);
  75. TextDrawSetOutline(GarageTD[0], 1);
  76. TextDrawBackgroundColor(GarageTD[0], 62);
  77. TextDrawFont(GarageTD[0], 2);
  78. TextDrawSetProportional(GarageTD[0], 1);
  79. TextDrawSetShadow(GarageTD[0], 0);
  80.  
  81. GarageTD[1] = TextDrawCreate(466.199737, 392.188903, "LD_BEAT:chit");
  82. TextDrawLetterSize(GarageTD[1], 0.000000, 0.000000);
  83. TextDrawTextSize(GarageTD[1], 26.000000, 28.000000);
  84. TextDrawAlignment(GarageTD[1], 1);
  85. TextDrawColor(GarageTD[1], 255);
  86. TextDrawSetShadow(GarageTD[1], 0);
  87. TextDrawSetOutline(GarageTD[1], 0);
  88. TextDrawBackgroundColor(GarageTD[1], 255);
  89. TextDrawFont(GarageTD[1], 4);
  90. TextDrawSetProportional(GarageTD[1], 0);
  91. TextDrawSetShadow(GarageTD[1], 0);
  92.  
  93. GarageTD[2] = TextDrawCreate(586.300292, 392.259368, "LD_BEAT:chit");
  94. TextDrawLetterSize(GarageTD[2], 0.000000, 0.000000);
  95. TextDrawTextSize(GarageTD[2], 26.000000, 28.000000);
  96. TextDrawAlignment(GarageTD[2], 1);
  97. TextDrawColor(GarageTD[2], 255);
  98. TextDrawSetShadow(GarageTD[2], 0);
  99. TextDrawSetOutline(GarageTD[2], 0);
  100. TextDrawBackgroundColor(GarageTD[2], 255);
  101. TextDrawFont(GarageTD[2], 4);
  102. TextDrawSetProportional(GarageTD[2], 0);
  103. TextDrawSetShadow(GarageTD[2], 0);
  104.  
  105. GarageTD[3] = TextDrawCreate(472.366821, 399.140869, "LD_BEAT:left");
  106. TextDrawLetterSize(GarageTD[3], 0.000000, 0.000000);
  107. TextDrawTextSize(GarageTD[3], 13.000000, 15.000000);
  108. TextDrawAlignment(GarageTD[3], 1);
  109. TextDrawColor(GarageTD[3], 8388827);
  110. TextDrawSetShadow(GarageTD[3], 0);
  111. TextDrawSetOutline(GarageTD[3], 0);
  112. TextDrawBackgroundColor(GarageTD[3], 255);
  113. TextDrawFont(GarageTD[3], 4);
  114. TextDrawSetProportional(GarageTD[3], 0);
  115. TextDrawSetShadow(GarageTD[3], 0);
  116. TextDrawSetSelectable(GarageTD[3], true);
  117.  
  118. GarageTD[4] = TextDrawCreate(594.000183, 398.851959, "LD_BEAT:right");
  119. TextDrawLetterSize(GarageTD[4], 0.000000, 0.000000);
  120. TextDrawTextSize(GarageTD[4], 13.000000, 15.000000);
  121. TextDrawAlignment(GarageTD[4], 1);
  122. TextDrawColor(GarageTD[4], 8388827);
  123. TextDrawSetShadow(GarageTD[4], 0);
  124. TextDrawSetOutline(GarageTD[4], 0);
  125. TextDrawBackgroundColor(GarageTD[4], 255);
  126. TextDrawFont(GarageTD[4], 4);
  127. TextDrawSetProportional(GarageTD[4], 0);
  128. TextDrawSetShadow(GarageTD[4], 0);
  129. TextDrawSetSelectable(GarageTD[4], true);
  130. }
  131.  
  132. hook OnPlayerConnect(playerid) {
  133. BarTD = CreatePlayerTextDraw(playerid, -41.333301, -35.244438, "box");
  134. PlayerTextDrawLetterSize(playerid, BarTD, 0.000000, 99.100013);
  135. PlayerTextDrawTextSize(playerid, BarTD, 1125.000000, 0.000000);
  136. PlayerTextDrawAlignment(playerid, BarTD, 1);
  137. PlayerTextDrawColor(playerid, BarTD, -1);
  138. PlayerTextDrawUseBox(playerid, BarTD, 1);
  139. PlayerTextDrawBoxColor(playerid, BarTD, 0x000000FF);
  140. PlayerTextDrawSetShadow(playerid, BarTD, 0);
  141. PlayerTextDrawSetOutline(playerid, BarTD, 0);
  142. PlayerTextDrawBackgroundColor(playerid, BarTD, 255);
  143. PlayerTextDrawFont(playerid, BarTD, 1);
  144. PlayerTextDrawSetProportional(playerid, BarTD, 1);
  145. PlayerTextDrawSetShadow(playerid, BarTD, 0);
  146.  
  147. GaragePTD[0] = CreatePlayerTextDraw(playerid, 537.999572, 347.214721, "Vehicle: Infernus~n~Odometer: 565 km~n~Doors: ~r~~h~Locked~w~~h~~n~Plate: IS 001 EDD");
  148. PlayerTextDrawLetterSize(playerid, GaragePTD[0], 0.215999, 1.222517);
  149. PlayerTextDrawTextSize(playerid, GaragePTD[0], 0.000000, 128.000000);
  150. PlayerTextDrawAlignment(playerid, GaragePTD[0], 2);
  151. PlayerTextDrawColor(playerid, GaragePTD[0], -1);
  152. PlayerTextDrawUseBox(playerid, GaragePTD[0], 1);
  153. PlayerTextDrawBoxColor(playerid, GaragePTD[0], 67);
  154. PlayerTextDrawSetShadow(playerid, GaragePTD[0], 0);
  155. PlayerTextDrawSetOutline(playerid, GaragePTD[0], 1);
  156. PlayerTextDrawBackgroundColor(playerid, GaragePTD[0], 62);
  157. PlayerTextDrawFont(playerid, GaragePTD[0], 2);
  158. PlayerTextDrawSetProportional(playerid, GaragePTD[0], 1);
  159. PlayerTextDrawSetShadow(playerid, GaragePTD[0], 0);
  160.  
  161. GaragePTD[1] = CreatePlayerTextDraw(playerid, 539.432678, 401.889160, "Slot 1 (empty)");
  162. PlayerTextDrawLetterSize(playerid, GaragePTD[1], 0.221664, 1.006814);
  163. PlayerTextDrawTextSize(playerid, GaragePTD[1], 0.000000, 105.000000);
  164. PlayerTextDrawAlignment(playerid, GaragePTD[1], 2);
  165. PlayerTextDrawColor(playerid, GaragePTD[1], -1);
  166. PlayerTextDrawUseBox(playerid, GaragePTD[1], 1);
  167. PlayerTextDrawBoxColor(playerid, GaragePTD[1], 255);
  168. PlayerTextDrawSetShadow(playerid, GaragePTD[1], 0);
  169. PlayerTextDrawSetOutline(playerid, GaragePTD[1], 1);
  170. PlayerTextDrawBackgroundColor(playerid, GaragePTD[1], 62);
  171. PlayerTextDrawFont(playerid, GaragePTD[1], 2);
  172. PlayerTextDrawSetProportional(playerid, GaragePTD[1], 1);
  173. PlayerTextDrawSetShadow(playerid, GaragePTD[1], 0);
  174.  
  175. GaragePTD[2] = CreatePlayerTextDraw(playerid, 546.999328, 289.400024, "");
  176. PlayerTextDrawLetterSize(playerid, GaragePTD[2], 0.000000, 0.000000);
  177. PlayerTextDrawTextSize(playerid, GaragePTD[2], 65.000000, 73.000000);
  178. PlayerTextDrawAlignment(playerid, GaragePTD[2], 1);
  179. PlayerTextDrawColor(playerid, GaragePTD[2], -1);
  180. PlayerTextDrawSetShadow(playerid, GaragePTD[2], 0);
  181. PlayerTextDrawSetOutline(playerid, GaragePTD[2], 0);
  182. PlayerTextDrawBackgroundColor(playerid, GaragePTD[2], 0);
  183. PlayerTextDrawFont(playerid, GaragePTD[2], 5);
  184. PlayerTextDrawSetProportional(playerid, GaragePTD[2], 0);
  185. PlayerTextDrawSetShadow(playerid, GaragePTD[2], 0);
  186. PlayerTextDrawSetPreviewModel(playerid, GaragePTD[2], 565);
  187. PlayerTextDrawSetPreviewRot(playerid, GaragePTD[2], 0.000000, 0.000000, 31.000000, 1.000000);
  188. PlayerTextDrawSetPreviewVehCol(playerid, GaragePTD[2], 1, 1);
  189. }
  190.  
  191. show_garage_tds(playerid) {
  192. new
  193. string[128],
  194. slot = garage_slot(playerid, GetPVarInt(playerid, "garageSlot"));
  195.  
  196. if(slot == -1) {
  197. PlayerTextDrawHide(playerid, GaragePTD[0]);
  198. PlayerTextDrawHide(playerid, GaragePTD[2]);
  199. TextDrawHideForPlayer(playerid, GarageTD[0]);
  200.  
  201. format(string, sizeof(string), "~g~~h~Slot %d (empty)", GetPVarInt(playerid, "garageSlot")+1);
  202. PlayerTextDrawSetString(playerid, GaragePTD[1], string);
  203. PlayerTextDrawShow(playerid, GaragePTD[1]);
  204. for(new i = 1; i < 5; i++) TextDrawShowForPlayer(playerid, GarageTD[i]);
  205. }
  206. else {
  207. new status[32], idd = PlayerInfo[playerid][pCarKey][slot];
  208.  
  209. if(CarInfo[idd][cLock] == 1) status = "Doors: ~r~~h~Locked~w~~h~";
  210. else status = "Doors: ~g~~h~Unlocked~w~~h~";
  211.  
  212. format(string, sizeof(string), "%s~n~Odometer: %.2f~n~%s~n~Fuel: %s%d", aVehicleNames[CarInfo[idd][cModel]-400], CarInfo[idd][KM], status, "%", CarInfo[idd][cFuel]);
  213. PlayerTextDrawSetString(playerid, GaragePTD[0], string);
  214.  
  215. if(CarInfo[idd][Spawned] != 0) format(string, sizeof(string), "Slot %d (%s)", GetPVarInt(playerid, "garageSlot")+1, aVehicleNames[CarInfo[idd][cModel]-400]);
  216. else format(string, sizeof(string), "~r~Slot %d (%s)", GetPVarInt(playerid, "garageSlot")+1, aVehicleNames[CarInfo[idd][cModel]-400]);
  217. PlayerTextDrawSetString(playerid, GaragePTD[1], string);
  218.  
  219. PlayerTextDrawSetPreviewModel(playerid, GaragePTD[2], CarInfo[idd][cModel]);
  220. PlayerTextDrawSetPreviewVehCol(playerid, GaragePTD[2], CarInfo[idd][cColorOne], CarInfo[idd][cColorTwo]);
  221.  
  222. for(new i = 0; i < 3; i++) PlayerTextDrawShow(playerid, GaragePTD[i]);
  223. for(new i = 0; i < 5; i++) TextDrawShowForPlayer(playerid, GarageTD[i]);
  224. }
  225. return 1;
  226. }
  227.  
  228. hide_garage_tds(playerid) {
  229. for(new i = 0; i < 3; i++) PlayerTextDrawHide(playerid, GaragePTD[i]);
  230. for(new i = 0; i < 5; i++) TextDrawHideForPlayer(playerid, GarageTD[i]);
  231. SetCameraBehindPlayer(playerid);
  232. TogglePlayerControllable(playerid, 1);
  233. return 1;
  234. }
  235.  
  236. garage_camera(playerid, now = 0) {
  237. new last = GetPVarInt(playerid, "lastGarage");
  238. SetPVarInt(playerid, "lastGarage", now);
  239. InterpolateCameraPos(playerid, garageCamera[last][0], garageCamera[last][1], garageCamera[last][2], garageCamera[now][0], garageCamera[now][1], garageCamera[now][2], 2000);
  240. InterpolateCameraLookAt(playerid, garageCamera_at[last][0], garageCamera_at[last][1], garageCamera_at[last][2], garageCamera_at[now][0], garageCamera_at[now][1], garageCamera_at[now][2], 2000);
  241. return 1;
  242. }
  243.  
  244. hook OnPlayerSpawn(playerid) {
  245. if(GetPVarInt(playerid, "inGarage") == 1) {
  246. SetPVarInt(playerid, "inGarage", 0);
  247. hide_garage_tds(playerid);
  248. }
  249. return 1;
  250. }
  251.  
  252. hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { //aici
  253. if((newkeys & KEY_SECONDARY_ATTACK) && !IsPlayerInAnyVehicle(playerid) || newkeys & KEY_CROUCH) {
  254. for(new i = 1; i < MAX_GARAGES; i++) {
  255. if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2]) && garageInfo[i][gUserID] != 0) {
  256. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  257. if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_GRAD3, "Nu poti intra in garaj cand ai wanted!");
  258. if(GetPVarInt(playerid, "inGarage") != 0) return 1;
  259. SetPVarInt(playerid, "inGarage", i);
  260.  
  261. if(IsPlayerInAnyVehicle(playerid)) {
  262. if(garageInfo[i][gPrice] > 0) return SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}You can not come with a vehicle if the garage is for sale.");
  263. if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_GRAD3, "Poti intra doar cu vehiculele personale!");
  264. if(vehicles_in_garage(playerid) == 10 && vehicle_in_garage(playerid, GetPlayerVehicleID(playerid)) == -1) return 1;
  265. new slot = vehicle_in_garage(playerid, GetPlayerVehicleID(playerid));
  266. if(slot == -1) ShowPlayerDialog(playerid, DIALOG_PARKVEHICLE, DIALOG_STYLE_MSGBOX, "Park", "Esti sigur ca vrei sa-l adaugi in garaj?", "Yes", "No");
  267. else {
  268. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculul tau personal a fost adaugat in garaj!");
  269. SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), i);
  270. SetVehicleToRespawn(GetPlayerVehicleID(playerid));
  271. SetPVarInt(playerid, "inGarage", 0);
  272. }
  273. }
  274. else {
  275. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}PENTRU A CONTROLA POZITIA FOLOSITI: NUM4(stanga), NUM6(dreapta), Enter(selectare vehicul) si Space (iesire).");
  276. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Inaintea parcarii oricarui vehicul trebuie sa-l parcati langa garaj (/park) apoi sa-l bagati in garaj (apasati H langa garaj din vehicul).");
  277. SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculele trebuie sa fie spawnate pentru a putea fii vizibile in garaj!");
  278.  
  279. SetPlayerPosEx2(playerid, 487.5861,-437.8022,2758.2688);
  280. SetPlayerVirtualWorld(playerid, i);
  281.  
  282. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  283. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  284.  
  285. SetPVarInt(playerid, "garageSlot", 0);
  286. show_garage_tds(playerid);
  287. garage_camera(playerid);
  288. TogglePlayerControllable(playerid, 0);
  289. }
  290.  
  291.  
  292. Freezed[playerid] = 1;
  293. }
  294. }
  295. }
  296.  
  297. if(newkeys & KEY_SECONDARY_ATTACK) {
  298. if(GetPVarInt(playerid, "inGarage") != 0 && GetPlayerVirtualWorld(playerid) != 0 && IsPlayerInRangeOfPoint(playerid, 100.0, 487.9106,-431.6140,2757.9956)) {
  299. new id = GetPVarInt(playerid, "inGarage"), vehid;
  300. if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) != -1) vehid = CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, GetPVarInt(playerid, "garageSlot"))]][Spawned];
  301. if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) == -1) return SendClientMessage(playerid, COLOR_WARNING, "Nu ai adaugat un vehicul pe acest slot din garaj!");
  302. else if(GetVehicleVirtualWorld(vehid) == 0) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul a fost scos din garaj deja!");
  303. else if(vehid == 0 && vehicle_in_garage(playerid, vehid)) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul nu este spawnat!");
  304. hide_garage_tds(playerid);
  305.  
  306. SetVehiclePos(vehid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  307. PutPlayerInVehicle(playerid, vehid, 0);
  308. SetVehicleZAngleEx(GetPlayerVehicleID(playerid), garageInfo[id][gAngle]);
  309. SetPlayerVirtualWorld(playerid, 0);
  310. SetVehicleVirtualWorld(vehid, 0);
  311. SetPVarInt(playerid, "inGarage", 0);
  312.  
  313. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  314. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  315. }
  316. }
  317.  
  318. if(GetPVarInt(playerid, "inGarage") != 0) {
  319. if(newkeys & KEY_ANALOG_LEFT) {
  320. // left
  321. new slot = GetPVarInt(playerid, "garageSlot");
  322. if(slot == 9) slot = -1;
  323. SetPVarInt(playerid, "garageSlot", slot+1);
  324. show_garage_tds(playerid);
  325. garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
  326. }
  327. if(newkeys & KEY_ANALOG_RIGHT) {
  328. // right
  329. new slot = GetPVarInt(playerid, "garageSlot");
  330. if(slot == 0) slot = 10;
  331. SetPVarInt(playerid, "garageSlot", slot-1);
  332. show_garage_tds(playerid);
  333. garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
  334. }
  335. if(newkeys & KEY_SPRINT) {
  336. hide_garage_tds(playerid);
  337. new id = GetPVarInt(playerid, "inGarage");
  338. SetPlayerPosEx2(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  339. SetPlayerVirtualWorld(playerid, 0);
  340. if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
  341. BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
  342. SetPVarInt(playerid, "inGarage", 0);
  343. TogglePlayerControllable(playerid, 1);
  344. Freezed[playerid] = 0;
  345. }
  346. }
  347. return 1;
  348. }
  349.  
  350. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
  351. switch(dialogid) {
  352. case DIALOG_GARAGE1: {
  353. if(!response) return ShowPlayerVehicle(playerid);
  354. new vsid = sVehicle[5][playerid];
  355. new string[128];
  356. switch(listitem) {
  357. case 0: { // info
  358. new locktext[15];
  359. if(CarInfo[vsid][cLock] > 0) {locktext = "Locked";}
  360. else {locktext = "Unlocked";}
  361. format(string, sizeof(string), "Model: %s (%d)\nStatus: %s\nColor 1: %d\nColor 2: %d\nOdometer: %.2f km\nInsurance points: %d\nInsurance tax: $%s", aVehicleNames[CarInfo[vsid][cModel]-400], CarInfo[vsid][Spawned], locktext, CarInfo[vsid][cColorOne], CarInfo[vsid][cColorTwo], CarInfo[vsid][KM], CarInfo[vsid][cPoints], FormatNumber(CarInfo[vsid][cTax]));
  362. ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Vehicle info", string, "Close", "");
  363. }
  364. case 1: { // find
  365. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!");
  366. if(CP[playerid] != 0) return ShowPlayerDialog(playerid, DIALOG_CHECKPOINT, DIALOG_STYLE_MSGBOX, "Checkpoint", "Ai deja un checkpoint activ.\nDoresti sa-l anulezi? Daca da, apasa pe 'Ok'.", "Ok", "Exit");
  367. new Float:vehx, Float:vehy, Float:vehz;
  368. GetVehiclePos(CarInfo[vsid][Spawned], vehx, vehy, vehz);
  369. SetPlayerCheckpointEx(playerid, vehx, vehy, vehz, 3.0);
  370. new szZone[128];
  371. GetPlayer3DZone2(vehx, vehy, vehz, szZone, sizeof(szZone));
  372. format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been located and in %s.", aVehicleNames[CarInfo[vsid][cModel]-400], szZone);
  373. SendClientMessage(playerid, COLOR_GOLD, string);
  374. CP[playerid] = 53;
  375. }
  376. case 2: { // tow
  377. if(GetPlayerCash(playerid) < 1000) return SendClientMessage(playerid, COLOR_GREY, "Nu ai $1000!");
  378. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!");
  379. if(CarInfo[vsid][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu).");
  380. if(CarInfo[vsid][Spawned] == 0) SpawnPlayerCar(vsid);
  381. else {
  382. if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!");
  383. SetVehicleToRespawn(CarInfo[vsid][Spawned]);
  384. }
  385. SetTunning(vsid);
  386. GivePlayerCash(playerid, -1000);
  387. BizzInfo[19][bBalance] += 1000;
  388. mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30);
  389. mysql_tquery(SQL, string, "", "");
  390. format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been respawned.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  391. SendClientMessage(playerid, COLOR_GOLD, string);
  392. }
  393. case 3: { // tow
  394. if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!");
  395. if(GetPlayerCash(playerid) < 1000) return SendClientMessage(playerid, COLOR_GREY, "Nu ai $1000!");
  396. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!");
  397.  
  398. if(CarInfo[vsid][Spawned] != 0) {
  399. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], CarInfo[vsid][cLastPos][0], CarInfo[vsid][cLastPos][1], CarInfo[vsid][cLastPos][2]);
  400. }
  401. else SpawnPlayerCar(vsid);
  402. GivePlayerCash(playerid, -1000);
  403. BizzInfo[19][bBalance] += 1000;
  404. mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30);
  405. mysql_tquery(SQL, string, "", "");
  406. format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been respawned.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  407. SendClientMessage(playerid, COLOR_GOLD, string);
  408. }
  409. case 4: { // despawn & spawn
  410. if(CarInfo[vsid][Spawned] == 0) {
  411. if(CarInfo[vsid][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu).");
  412. SpawnPlayerCar(vsid);
  413. }
  414. else {
  415. if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!");
  416. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!");
  417. DestroyPlayerCar(vsid);
  418. format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been despawned.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  419. SendClientMessage(playerid, COLOR_GOLD, string);
  420. }
  421. }
  422. case 5: { // Debug
  423. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!");
  424. if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!");
  425. if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!");
  426. if(CP[playerid] != 0) return ShowPlayerDialog(playerid, DIALOG_CHECKPOINT, DIALOG_STYLE_MSGBOX, "Checkpoint", "Ai deja un checkpoint activ.\nDoresti sa-l anulezi? Daca da, apasa pe 'Ok'.", "Ok", "Exit");
  427. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], 1688.9471,1306.3896,10.9159);
  428. SetVehicleZAngleEx(CarInfo[vsid][Spawned], 359.3103);
  429. SetVehicleVirtualWorld(CarInfo[vsid][Spawned], 0);
  430. CP[playerid] = 53;
  431. if(IsAFLYCar(CarInfo[vsid][Spawned])) {
  432. format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  433. SendClientMessage(playerid, COLOR_YELLOW, string);
  434. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], -1649.1798, -159.0667, 17.3618);
  435. SetVehicleZAngleEx(CarInfo[vsid][Spawned], -44.1000);
  436. new randspawn = random(sizeof(HeliVehPos));
  437. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], HeliVehPos[randspawn][0], HeliVehPos[randspawn][1], HeliVehPos[randspawn][2]);
  438. SetVehicleZAngleEx(CarInfo[vsid][Spawned], 44.4000);
  439. SetPlayerCheckpointEx(playerid, HeliVehPos[randspawn][0], HeliVehPos[randspawn][1], HeliVehPos[randspawn][2], 5.0);
  440. return 1;
  441. }
  442. else if(IsABOATCar(CarInfo[vsid][Spawned])) {
  443. format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  444. SendClientMessage(playerid, COLOR_YELLOW, string);
  445. new randspawn = random(sizeof(BoatVehPos));
  446. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], BoatVehPos[randspawn][0], BoatVehPos[randspawn][1], BoatVehPos[randspawn][2]);
  447. SetVehicleZAngleEx(CarInfo[vsid][Spawned], -173.4001);
  448. SetPlayerCheckpointEx(playerid, BoatVehPos[randspawn][0], BoatVehPos[randspawn][1], BoatVehPos[randspawn][2], 5.0);
  449. return 1;
  450. }
  451. else {
  452. format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]);
  453. SendClientMessage(playerid, COLOR_YELLOW, string);
  454. new randspawn = random(sizeof(DealerCarPos));
  455. SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], DealerCarPos[randspawn][0], DealerCarPos[randspawn][1], DealerCarPos[randspawn][2]);
  456. SetVehicleZAngleEx(CarInfo[vsid][Spawned], -173.4001);
  457. SetPlayerCheckpointEx(playerid, DealerCarPos[randspawn][0], DealerCarPos[randspawn][1], DealerCarPos[randspawn][2], 5.0);
  458. return 1;
  459. }
  460. }
  461. case 6: { // sell
  462. if(strlen(PlayerInfo[playerid][pPin]) != 0 && PlayerInfo[playerid][pPinLogged] == 0) {
  463. SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda deoarece nu te-ai autentificat cu codul de securitate.");
  464. SendClientMessage(playerid, COLOR_GREY, "Pentru a te autentifica, foloseste comanda '/loginpin'!");
  465. return 1;
  466. }
  467. if(TradeID[playerid] != -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta comanda atata timp cat esti implicat intr-o afacere!");
  468. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!");
  469. //if(CarInfo[vsid][cSpecial] == 1) return SendClientMessage(playerid, -1, "Acces interzis!");
  470. if(!PlayerToPoint(5.0,playerid,1449.8494,-2287.2141,13.5469)) return SendClientMessage(playerid, COLOR_WHITE, "Trebuie sa fii la dealership. Foloseste /gps pentru a afla unde este.");
  471. if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!");
  472. new value;
  473. value = CarPriceValid(CarInfo[vsid][cModel]) / 2;
  474. format(string, sizeof(string), "Esti sigur ca vrei sa-ti vinzi %s pentru %s$ ?",aVehicleNames[CarInfo[vsid][cModel]-400],FormatNumber(value));
  475. ShowPlayerDialog(playerid, DIALOG_SELLCAR, DIALOG_STYLE_MSGBOX, "Dealership", string, "Da", "Nu");
  476. PlayerSellCar[playerid] = vsid;
  477. if(CP[playerid] == 43 || CP[playerid] == 53) { CP[playerid] = 0; DisablePlayerCheckpointEx(playerid); }
  478. }
  479. case 7: ShowPlayerDialog(playerid, DIALOG_INSURANCE, DIALOG_STYLE_INPUT, "Asigurare", "Scrie mai jos cate puncte de asigurare vrei sa cumperi.\nPoti avea maxim 10 puncte iar pretul este in functie de taxele masinii.", "Cumpara", "Close");
  480. case 8: {
  481. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!");
  482. if(valid_vip_vehicle(CarInfo[vsid][cModel]) == 0) return SCM(playerid, COLOR_GREY, "Acest vehicul nu poate fi upgradat!");
  483. if(strlen(CarInfo[vsid][cText]) > 3) return SCM(playerid, -1, "Acest vehicul este deja unul VIP!");
  484. if(PlayerInfo[playerid][pPremiumPoints] < 1008) return SCM(playerid, -1, "Nu ai destule puncte premium.");
  485. SetPVarInt(playerid, "VehicleID", vsid);
  486. ShowPlayerDialog(playerid, DIALOG_UPGRADEVIP, DIALOG_STYLE_MSGBOX, "Upgrade to VIP Vehicle", "Esti sigur ca vrei sa faci acest lucru?\nVei pierde 1200 puncte premium.", "Da", "Nu");
  487. }
  488. case 9: { // rem tunn
  489. if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!");
  490. new car = CarInfo[vsid][Spawned];
  491. if(CarInfo[vsid][mod0] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod0]);
  492. if(CarInfo[vsid][mod1] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod1]);
  493. if(CarInfo[vsid][mod2] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod2]);
  494. if(CarInfo[vsid][mod3] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod3]);
  495. if(CarInfo[vsid][mod4] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod4]);
  496. if(CarInfo[vsid][mod5] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod5]);
  497. if(CarInfo[vsid][mod6] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod6]);
  498. if(CarInfo[vsid][mod7] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod7]);
  499. if(CarInfo[vsid][mod8] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod8]);
  500. if(CarInfo[vsid][mod9] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod9]);
  501. if(CarInfo[vsid][mod10] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod10]);
  502. if(CarInfo[vsid][mod11] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod11]);
  503. if(CarInfo[vsid][mod12] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod12]);
  504. if(CarInfo[vsid][mod13] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod13]);
  505. CarInfo[vsid][mod0] = 0;
  506. CarInfo[vsid][mod1] = 0;
  507. CarInfo[vsid][mod2] = 0;
  508. CarInfo[vsid][mod3] = 0;
  509. CarInfo[vsid][mod4] = 0;
  510. CarInfo[vsid][mod5] = 0;
  511. CarInfo[vsid][mod6] = 0;
  512. CarInfo[vsid][mod7] = 0;
  513. CarInfo[vsid][mod8] = 0;
  514. CarInfo[vsid][mod9] = 0;
  515. CarInfo[vsid][mod10] = 0;
  516. CarInfo[vsid][mod11] = 0;
  517. CarInfo[vsid][mod12] = 0;
  518. CarInfo[vsid][mod13] = 0;
  519. CarInfo[vsid][paintjob] = 3;
  520. ChangeVehiclePaintjob(CarInfo[vsid][Spawned], 3);
  521. new query[128];
  522. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod0='%d' WHERE id=%d",CarInfo[vsid][mod0],vsid);
  523. mysql_tquery(SQL, query, "", "");
  524. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod1='%d' WHERE id=%d",CarInfo[vsid][mod1],vsid);
  525. mysql_tquery(SQL, query, "", "");
  526. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod2='%d' WHERE id=%d",CarInfo[vsid][mod2],vsid);
  527. mysql_tquery(SQL, query, "", "");
  528. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod3='%d' WHERE id=%d",CarInfo[vsid][mod3],vsid);
  529. mysql_tquery(SQL, query, "", "");
  530. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod4='%d' WHERE id=%d",CarInfo[vsid][mod4],vsid);
  531. mysql_tquery(SQL, query, "", "");
  532. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod5='%d' WHERE id=%d",CarInfo[vsid][mod5],vsid);
  533. mysql_tquery(SQL, query, "", "");
  534. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod6='%d' WHERE id=%d",CarInfo[vsid][mod6],vsid);
  535. mysql_tquery(SQL, query, "", "");
  536. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod7='%d' WHERE id=%d",CarInfo[vsid][mod7],vsid);
  537. mysql_tquery(SQL, query, "", "");
  538. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod8='%d' WHERE id=%d",CarInfo[vsid][mod8],vsid);
  539. mysql_tquery(SQL, query, "", "");
  540. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod9='%d' WHERE id=%d",CarInfo[vsid][mod9],vsid);
  541. mysql_tquery(SQL, query, "", "");
  542. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod10='%d' WHERE id=%d",CarInfo[vsid][mod10],vsid);
  543. mysql_tquery(SQL, query, "", "");
  544. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod11='%d' WHERE id=%d",CarInfo[vsid][mod11],vsid);
  545. mysql_tquery(SQL, query, "", "");
  546. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod12='%d' WHERE id=%d",CarInfo[vsid][mod12],vsid);
  547. mysql_tquery(SQL, query, "", "");
  548. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod13='%d' WHERE id=%d",CarInfo[vsid][mod13],vsid);
  549. mysql_tquery(SQL, query, "", "");
  550. mysql_format(SQL, query, sizeof(query), "UPDATE cars SET paintjob='%d' WHERE id=%d",CarInfo[vsid][paintjob],vsid);
  551. mysql_tquery(SQL, query, "", "");
  552. }
  553. case 10: {
  554. if(CarInfo[vsid][Confiscated] == 0) return 1;
  555. if(GetPlayerCash(playerid) < CarInfo[vsid][cTax]) return SCM(playerid, -1, "Nu ai suma necesara de bani!");
  556. ShowPlayerDialog(playerid, DIALOG_TAX, DIALOG_STYLE_MSGBOX, "Plateste amenda",
  557. "Esti sigur ca vrei sa platesti amenda pentru parcarea neregulamentara?\nDaca consideri ca a fost luata aiurea, cere o dovada pe forum.", "Da", "Nu");
  558. }
  559. }
  560. }
  561. case DIALOG_TOWCAR: {
  562. if(!response) return 1;
  563. if(GetPlayerCash(playerid) < 50) return SCM(playerid, COLOR_GREY, "Ai nevoie de $50 pentru a respawna un vehicul personal!");
  564. new idd, string[128];
  565. if(PlayerInfo[playerid][pCarKey][listitem] == 0) return 1;
  566. else idd = PlayerInfo[playerid][pCarKey][listitem];
  567. if(CarInfo[idd][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu).");
  568. GivePlayerCash(playerid, -50);
  569. BizzInfo[19][bBalance] += 5000;
  570. mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30);
  571. mysql_tquery(SQL, string, "", "");
  572. format(string, sizeof(string), "Vehiculul tau, %s, a fost (re)spawnat.", aVehicleNames[CarInfo[idd][cModel]-400]);
  573. SendClientMessage(playerid, COLOR_GOLD, string);
  574. if(CarInfo[idd][Spawned] != 0) {
  575. if(IsVehicleOccupied(CarInfo[idd][Spawned])) return SendClientMessage(playerid, -1, "Vehiculul este ocupat!");
  576. SetVehiclePosEx(playerid, CarInfo[idd][Spawned], CarInfo[idd][cLocationx], CarInfo[idd][cLocationy], CarInfo[idd][cLocationz]);
  577. SetVehicleZAngleEx(CarInfo[idd][Spawned], CarInfo[idd][cAngle]);
  578. }
  579. else SpawnPlayerCar(idd);
  580. }
  581.  
  582. case DIALOG_CREATEGARAGE: {
  583. if(!response) return 1;
  584. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  585. if(garages >= MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "There are too many garages!");
  586. new id = garage_id_empty();
  587. if(id == -1) return SendClientMessage(playerid, COLOR_WARNING, "Error with garage ID!");
  588.  
  589. new
  590. Float: Pos[3],
  591. Float:Angle,
  592. query[150];
  593.  
  594. GetPlayerFacingAngle(playerid, Angle);
  595. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  596. mysql_format(SQL, query, sizeof(query), "INSERT INTO `garages` (`Price`, `X`, `Y`, `Z`, `Angle`) VALUES ('%d', '%f', '%f', '%f', '%f')", GetPVarInt(playerid, "garagePrice"), Pos[0], Pos[1], Pos[2], Angle);
  597. mysql_tquery(SQL, query, "", "");
  598.  
  599. format(garageInfo[id][gOwner], 32, "The State");
  600. garageInfo[id][gID] = id;
  601. garageInfo[id][gVirtualID] = id;
  602. garageInfo[id][gPrice] = GetPVarInt(playerid, "garagePrice");
  603. garageInfo[id][gPos][0] = Pos[0];
  604. garageInfo[id][gPos][1] = Pos[1];
  605. garageInfo[id][gPos][2] = Pos[2];
  606. garageInfo[id][gAngle] = Angle;
  607.  
  608. garageInfo[id][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  609. garage_label(id);
  610.  
  611. SendClientMessage(playerid, 0xFFA200FF, "You have successfully added a garage!");
  612.  
  613. DeletePVar(playerid, "garagePrice");
  614. }
  615. case DIALOG_MOVEGARAGE: {
  616. if(!response) return 1;
  617. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  618.  
  619. new
  620. id = GetPVarInt(playerid, "garageID"),
  621. query[126],
  622. Float: Pos[3],
  623. Float: Angle;
  624.  
  625. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  626. GetPlayerFacingAngle(playerid, Angle);
  627.  
  628. mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `X`='%f', `Y`='%f', `Z`='%f', `Angle`='%f' WHERE `ID`='%d'", Pos[0], Pos[1], Pos[2], Angle, id);
  629. mysql_tquery(SQL, query, "", "");
  630.  
  631. garageInfo[id][gPos][0] = Pos[0];
  632. garageInfo[id][gPos][1] = Pos[1];
  633. garageInfo[id][gPos][2] = Pos[2];
  634. garageInfo[id][gAngle] = Angle;
  635.  
  636. DestroyDynamicPickup(garageInfo[id][gPickup]);
  637. garageInfo[id][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  638. garage_label(id);
  639.  
  640. SendClientMessage(playerid, 0xFFA200FF, "You've successfully moved the garage!");
  641.  
  642. DeletePVar(playerid, "garageID");
  643. }
  644. case DIALOG_BUYGARAGE: {
  645. if(!response) return 1;
  646. new id = GetPVarInt(playerid, "garageID");
  647. if(garageInfo[id][gPrice] == 0) return SendClientMessage(playerid, COLOR_GRAD3, "This garage is not available!");
  648. if(GetPlayerCash(playerid) < garageInfo[id][gPrice]) return SendClientMessage(playerid, COLOR_GRAD3, "You do not have that amount of money!");
  649. new string[128];
  650. GivePlayerCash(playerid, -garageInfo[id][gPrice]);
  651.  
  652.  
  653. if(garageInfo[id][gUserID] != 0) {
  654. new
  655. idd = GetPlayerID(garageInfo[id][gOwner]),
  656. szQuery[128],
  657. moneys,
  658. newmoneys;
  659.  
  660. if(idd != INVALID_PLAYER_ID) {
  661. PlayerInfo[idd][pAccount] += garageInfo[id][gPrice];
  662. format(string, sizeof(string), "* %s ti-a cumparat garajul pentru {19CF2E}$%s{239931}. Banii au fost transferati in contul tau bancar.", GetName(playerid), FormatNumber(garageInfo[id][gPrice]));
  663. format(szQuery,sizeof(szQuery),"UPDATE users SET `Bank`='%d' WHERE `ID`='%d'",PlayerInfo[id][pAccount],PlayerInfo[id][pSQLID]);
  664. }
  665. else {
  666. format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `ID` = '%s'", garageInfo[id][gUserID]);
  667. new Cache: result = mysql_query(SQL, szQuery);
  668. if(cache_get_row_count() != 0) {
  669. cache_get_field_content(0, "Bank", string); moneys = strval(string), newmoneys = moneys + garageInfo[id][gPrice];
  670. }
  671. cache_delete(result);
  672. format(szQuery,sizeof(szQuery),"UPDATE users SET `Bank`='%d' WHERE `ID`='%d'",newmoneys,garageInfo[id][gUserID]);
  673. }
  674.  
  675. SendClientMessage(id, 0x239931FF, string);
  676. mysql_query(SQL,szQuery);
  677. }
  678.  
  679. format(garageInfo[id][gOwner], 32, GetName(playerid));
  680. garageInfo[id][gUserID] = PlayerInfo[playerid][pSQLID];
  681.  
  682. UpdateGarage_str(id, "Owner", GetName(playerid));
  683. UpdateGarage_int(id, "UserID", PlayerInfo[playerid][pSQLID]);
  684. UpdateGarage_int(id, "Price", 0);
  685.  
  686. format(string, sizeof(string), "You successfully bought this garage with $%s.", FormatNumber(garageInfo[id][gPrice]));
  687. SendClientMessage(playerid, COLOR_MONEY, string);
  688. SendClientMessage(playerid, COLOR_MONEY, "To see your garage commands, use /garagehelp.");
  689.  
  690. garageInfo[id][gPrice] = 0;
  691. garage_label(id);
  692.  
  693. DeletePVar(playerid, "garageID");
  694. }
  695. case DIALOG_SELLGARAGE: {
  696. if(!response) return 1;
  697. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  698. new id = user_garage(playerid);
  699.  
  700. format(garageInfo[id][gOwner], 32, "The State");
  701. garageInfo[id][gUserID] = 0;
  702. garageInfo[id][gPrice] = 100000;
  703.  
  704. UpdateGarage_str(id, "Owner", "The State");
  705. UpdateGarage_int(id, "UserID", 0);
  706. UpdateGarage_int(id, "Price", 0);
  707.  
  708. garage_label(id);
  709. GivePlayerCash(playerid, SELL_GARAGE_PRICE);
  710.  
  711. SendClientMessage(playerid, COLOR_MONEY, "Ai vandut garajul la stat!");
  712. }
  713. case DIALOG_PARKVEHICLE: {
  714. if(!response) return 1;
  715. Command_ReProcess(playerid, "parkcar", true);
  716. SetPVarInt(playerid, "inGarage", 0);
  717. }
  718. }
  719. return 1;
  720. }
  721.  
  722. function garage_id_empty() {
  723. for(new i = 1; i < MAX_GARAGES; i++) {
  724. if(garageInfo[i][gID] == 0) return i;
  725. }
  726. return -1;
  727. }
  728.  
  729. function user_have_garage(playerid) {
  730. for(new i = 1; i < MAX_GARAGES; i++) {
  731. if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return 1;
  732. }
  733. return 0;
  734. }
  735.  
  736. function user_garage(playerid) {
  737. for(new i = 1; i < MAX_GARAGES; i++) {
  738. if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return i;
  739. }
  740. return 0;
  741. }
  742.  
  743.  
  744. function LoadGarages() {
  745. new Cache: db = mysql_query(SQL, "SELECT * FROM `garages`");
  746. new x, result[126];
  747. for(new i, j = cache_get_row_count (); i != j; ++i) {
  748. garages ++;
  749. cache_get_field_content(i, "ID", result); x = strval(result), garageInfo[garages][gID] = x;
  750. cache_get_field_content(i, "Owner", result); format(garageInfo[x][gOwner], 32, result);
  751. cache_get_field_content(i, "UserID", result); garageInfo[x][gUserID] = strval(result);
  752. cache_get_field_content(i, "Price", result); garageInfo[x][gPrice] = strval(result);
  753.  
  754. garageInfo[x][gPos][0] = cache_get_field_content_float(i, "X");
  755. garageInfo[x][gPos][1] = cache_get_field_content_float(i, "Y");
  756. garageInfo[x][gPos][2] = cache_get_field_content_float(i, "Z");
  757. garageInfo[x][gAngle] = cache_get_field_content_float(i, "Angle");
  758.  
  759. garageInfo[x][gVirtualID] = x;
  760.  
  761. garageInfo[x][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[x][gPos][0], garageInfo[x][gPos][1], garageInfo[x][gPos][2]);
  762. garage_label(x);
  763. }
  764. printf("Garages loaded: %d", garages);
  765. cache_delete(db);
  766. return 1;
  767. }
  768.  
  769. function UpdateGarage_int(id, varname[], amount) {
  770. new query[128];
  771. mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%d' WHERE `ID`='%d'", varname, amount, id);
  772. mysql_tquery(SQL, query, "", "");
  773. return 1;
  774. }
  775.  
  776. function UpdateGarage_str(id, varname[], amount[]) {
  777. new query[128];
  778. mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%s' WHERE `ID`='%d'", varname, amount, id);
  779. mysql_tquery(SQL, query, "", "");
  780. return 1;
  781. }
  782.  
  783. function vehicles_in_garage(playerid) {
  784. new x;
  785. for(new i = 0; i < 10; i++) {
  786. if(PlayerInfo[playerid][pCarKey][i] != 0 && CarInfo[PlayerInfo[playerid][pCarKey][i]][cVirtual] != 0) x++;
  787. }
  788. return x;
  789. }
  790.  
  791. stock SetPlayerPosEx2(playerid, Float:x, Float:y, Float:z) {
  792. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePosEx(playerid, GetPlayerVehicleID(playerid), x, y, z);
  793. else SetPlayerPos(playerid, x, y, z);
  794.  
  795. GetPlayerPos(playerid, LastPos[playerid][0], LastPos[playerid][1], LastPos[playerid][2]);
  796. Exception[playerid] += 1;
  797. foreach(Player, i) {
  798. if(Spectate[i] == playerid) {
  799. TogglePlayerSpectating(i, 1);
  800. SetPlayerInterior(i, GetPlayerInterior(playerid));
  801. SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  802. if(IsPlayerInAnyVehicle(playerid)) PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
  803. else PlayerSpectatePlayer(i, playerid);
  804. }
  805. }
  806. if(GetPVarInt(playerid, "Undercover") == 1) {
  807. foreach(Player, i) ShowPlayerNameTagForPlayer(i, playerid, false);
  808. PlayerTextDrawShow(playerid, UndercoverTD);
  809. }
  810. return 1;
  811. }
  812.  
  813. function BlackBar(playerid) {
  814. switch(Step[playerid]) {
  815. case 0: PlayerTextDrawBoxColor(playerid, BarTD, 0x000000FF);
  816. case 1: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000090);
  817. case 2: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000080);
  818. case 3: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000070);
  819. case 4: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000060);
  820. case 5: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000050);
  821. case 6: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000040);
  822. case 7: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000030);
  823. case 8: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000020);
  824. case 9: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000010);
  825. case 10: {
  826. PlayerTextDrawHide(playerid, BarTD);
  827. Step[playerid] = 0;
  828. KillTimer(BarTimer[playerid]);
  829. return 1;
  830. }
  831. }
  832. PlayerTextDrawShow(playerid, BarTD);
  833. Step[playerid] ++;
  834. return 1;
  835. }
  836.  
  837. stock saveCarPark(idd) {
  838. if(idd == 0) return 1;
  839. new query[512];
  840. mysql_format(SQL, query, sizeof(query),
  841. "UPDATE cars SET Model='%d', Locationx='%f', Locationy='%f', Locationz='%f', Angle='%f', ColorOne='%d', ColorTwo='%d', Owner='%s', Value='%d', License='%s', Userid='%d', `Virtual`='%d' WHERE ID=%d",
  842. CarInfo[idd][cModel], CarInfo[idd][cLocationx], CarInfo[idd][cLocationy], CarInfo[idd][cLocationz], CarInfo[idd][cAngle], CarInfo[idd][cColorOne], CarInfo[idd][cColorTwo], CarInfo[idd][cOwner], CarInfo[idd][cValue],
  843. CarInfo[idd][cLicense], CarInfo[idd][Userid], CarInfo[idd][cVirtual], idd);
  844. mysql_tquery(SQL, query, "", "");
  845. return 1;
  846. }
  847.  
  848. /*
  849. YCMD:debugsystem(playerid, params[], help) {
  850. new string[126], model[64];
  851. format(string, 64, "%d/10 vehicles", vehicles_in_garage(playerid));
  852. SendClientMessage(playerid, -1, string);
  853. for(new i = 0; i < 10; i++) {
  854. if(garage_slot(playerid, i) == -1) model = "None";
  855. else format(model, sizeof(model), "%s", aVehicleNames[CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, i)]][cModel]-400]);
  856.  
  857. format(string, sizeof(string), "Slot %d - %s", i, model);
  858. SendClientMessage(playerid, COLOR_WARNING, string);
  859. }
  860.  
  861. return 1;
  862. }
  863. */
  864.  
  865. function vehicle_in_garage(playerid, carid) {
  866. new slot = -1;
  867. for(new i = 0; i < 10; i++) {
  868. if(CarInfo[PlayerInfo[playerid][pCarKey][i]][Spawned] == carid) {
  869. new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
  870. Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
  871.  
  872. if(Pos[0] == 481.85 && Pos[1] == -405.426) slot = i;
  873. else if(Pos[0] == 481.85 && Pos[1] == -410.9) slot = i;
  874. else if(Pos[0] == 481.85 && Pos[1] == -416.301) slot = i;
  875. else if(Pos[0] == 481.85 && Pos[1] == -421.104) slot = i;
  876. else if(Pos[0] == 481.85 && Pos[1] == -425.924) slot = i;
  877. else if(Pos[0] == 493.998 && Pos[1] == -405.426) slot = i;
  878. else if(Pos[0] == 493.998 && Pos[1] == -410.9) slot = i;
  879. else if(Pos[0] == 493.998 && Pos[1] == -416.301) slot = i;
  880. else if(Pos[0] == 493.998 && Pos[1] == -421.104) slot = i;
  881. else if(Pos[0] == 493.998 && Pos[1] == -425.924) slot = i;
  882. }
  883. }
  884. return slot;
  885. }
  886.  
  887. function garage_slot(playerid, id) {
  888. new slot = -1;
  889. for(new i = 0; i < 10; i++) {
  890. if(PlayerInfo[playerid][pCarKey][i] != 0) {
  891. new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
  892. Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
  893.  
  894. if(Pos[0] == 481.85 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 0) slot = i;
  895. if(Pos[0] == 481.85 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 1) slot = i;
  896. if(Pos[0] == 481.85 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 2) slot = i;
  897. if(Pos[0] == 481.85 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 3) slot = i;
  898. if(Pos[0] == 481.85 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 4) slot = i;
  899. if(Pos[0] == 493.998 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 5) slot = i;
  900. if(Pos[0] == 493.998 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 6) slot = i;
  901. if(Pos[0] == 493.998 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 7) slot = i;
  902. if(Pos[0] == 493.998 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 8) slot = i;
  903. if(Pos[0] == 493.998 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 9) slot = i;
  904. }
  905. }
  906. return slot;
  907. }
  908.  
  909. garage_label(x) {
  910. new string[126];
  911. DestroyDynamic3DTextLabel(garageInfo[x][garageLabel]);
  912. if(garageInfo[x][gPrice] == 0) format(string, sizeof(string), "Garage %d{C90202}\nGarage Owner: {FFFFFF}%s", x, garageInfo[x][gOwner]);
  913. else format(string, sizeof(string), "Garage %d{C90202}\nGarage Owner: {FFFFFF}%s\n{C90202}Garage price: {FFFFFF}$%s\n(/buygarage)", x, garageInfo[x][gOwner], FormatNumber(garageInfo[x][gPrice]));
  914. garageInfo[x][garageLabel] = CreateDynamic3DTextLabel(string, 0xC90202FF, garageInfo[x][gPos][0], garageInfo[x][gPos][1], garageInfo[x][gPos][2], 10, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 1, 0, -1, -1, 100.0);
  915. }
  916.  
  917. // Commands with ZCMD
  918. YCMD:garagehelp(playerid, params[], help) {
  919. if(PlayerInfo[playerid][pAdmin] >= 7) SendClientMessage(playerid, COLOR_WARNING, "(admins commands) {FFFFFF}/creategarage, /movegarage, /gotogarage.");
  920. SendClientMessage(playerid, -1, "(garage commands) {FFFFFF}/buygarage, /sellgarage, /sellgaragetostate, /mygarage, /findgarage.");
  921. return 1;
  922. }
  923.  
  924. YCMD:mygarage(playerid, params[], help) {
  925. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  926. new string[64];
  927. format(string, sizeof(string), "Your garage has ID %d. Use /findgarage to locate.", user_have_garage(playerid));
  928. SendClientMessage(playerid, -1, string);
  929. return 1;
  930. }
  931.  
  932. YCMD:findgarage(playerid, params[], help) {
  933. if(CP[playerid] != 0) return ShowPlayerDialog(playerid, DIALOG_CHECKPOINT, DIALOG_STYLE_MSGBOX, "Checkpoint", "Ai deja un checkpoint activ.\nDoresti sa-l anulezi? Daca da, apasa pe 'Ok'.", "Ok", "Exit");
  934. new id;
  935. if(sscanf(params, "i",id)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: {FFFFFF}/findgarage <garage ID>");
  936. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  937. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  938. CP[playerid] = 43;
  939. SetPlayerCheckpointEx(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2], 2.0);
  940. new string[180];
  941. format(string, sizeof(string), "Follow checkpoint to reach to the garage. %d. Distance: %0.2fm", id, GetPlayerDistanceFromPoint(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]));
  942. SendClientMessage(playerid, COLOR_YELLOW, string);
  943. return 1;
  944. }
  945.  
  946. YCMD:creategarage(playerid, params[], help) {
  947. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  948. if(garages >= MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "There are too many garages!");
  949. new price;
  950. if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/creategarage <garage price>");
  951. if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
  952. SetPVarInt(playerid, "garagePrice", price);
  953. ShowPlayerDialog(playerid, DIALOG_CREATEGARAGE, DIALOG_STYLE_MSGBOX, "Create garage", "Are you sure you want to add a garage here?", "Yes", "No");
  954. return 1;
  955. }
  956.  
  957. YCMD:movegarage(playerid, params[], help) {
  958. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  959. new id;
  960. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
  961. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  962. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  963. SetPVarInt(playerid, "garageID", id);
  964. ShowPlayerDialog(playerid, DIALOG_MOVEGARAGE, DIALOG_STYLE_MSGBOX, "Move garage", "Are you sure you want to move that garage here?", "Yes", "No");
  965. return 1;
  966. }
  967.  
  968. YCMD:gotogarage(playerid, params[], help) {
  969. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  970. new id;
  971. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
  972. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  973. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  974. SetPlayerPos(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  975. SetPlayerVirtualWorld(playerid, 0);
  976. SetPlayerInterior(playerid, 0);
  977. return 1;
  978. }
  979.  
  980. YCMD:buygarage(playerid, params[], help) {
  981. if(user_have_garage(playerid) == 1) return SendClientMessage(playerid, COLOR_GRAD3, "You already have a garage!");
  982. if(PlayerInfo[playerid][pLevel] < 5) return SendClientMessage(playerid, COLOR_WARNING, "You need level 5+ to buy a garage!");
  983. for(new i = 1; i < MAX_GARAGES; i++) {
  984. if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2])) {
  985. if(garageInfo[i][gPrice] == 0) return SendClientMessage(playerid, COLOR_GRAD3, "This garage is not available!");
  986. if(GetPlayerCash(playerid) < garageInfo[i][gPrice]) return SendClientMessage(playerid, COLOR_GRAD3, "You do not have that amount of money!");
  987. ShowPlayerDialog(playerid, DIALOG_BUYGARAGE, DIALOG_STYLE_MSGBOX, "Buy garage", "Are you sure you want to buy this garage?", "Yes", "No");
  988. SetPVarInt(playerid, "garageID", i);
  989. }
  990. }
  991. return 1;
  992. }
  993.  
  994. YCMD:sellgarage(playerid, params[], help) {
  995. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  996. if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
  997. new price;
  998. if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/sellgarage <garage price (0=cancel)>");
  999. if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
  1000. new id = user_garage(playerid), string[126];
  1001. if(price == 0) SendClientMessage(playerid, COLOR_MONEY, "Garajul tau nu mai este acum de vanzare!");
  1002. else {
  1003. format(string, sizeof(string), "Garajul tau este de vanzare la suma de $%s.", FormatNumber(price));
  1004. SendClientMessage(playerid, COLOR_MONEY, string);
  1005. }
  1006. garageInfo[id][gPrice] = price;
  1007. UpdateGarage_int(id, "Price", garageInfo[id][gPrice]);
  1008. garage_label(id);
  1009. return 1;
  1010. }
  1011.  
  1012. YCMD:sellgaragetostate(playerid, params[], help) {
  1013. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  1014. if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
  1015. new string[98];
  1016. format(string, sizeof(string), "Are you sure you want to sell the garage to the state for %s?", FormatNumber(SELL_GARAGE_PRICE));
  1017. ShowPlayerDialog(playerid, DIALOG_SELLGARAGE, DIALOG_STYLE_MSGBOX, "Sell garage to state", string, "Yes", "No");
  1018. return 1;
  1019. }
  1020.  
  1021. YCMD:parkcar(playerid, params[], help) {
  1022. new car = GetPlayerVehicleID(playerid);
  1023. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Nu esti in vehiculul tau.");
  1024. if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "Nu ai un vehicul personal!");
  1025. if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti in unul dintre vehiculele tale personale!");
  1026. if(GetPlayerState(playerid) != 2) return SCM(playerid, COLOR_LGREEN, "* Trebuie sa fii la volan pentru a putea folosi aceasta comanda!");
  1027. new idd = PersonalCar(playerid);
  1028. new Float: vhp;
  1029. GetVehicleHealth(car, vhp);
  1030. if(vhp < 800) return SendClientMessage(playerid, COLOR_GREY, "Nu poti parca masina cand are sub 800 'viata'!");
  1031. if(PlayerToPoint(150.0, playerid, 1716.9065,-1902.4526,13.5661)) return SCM(playerid, -1, "Nu poti parca o masina in jurul spawn-ului.");
  1032. new Float:x, Float:y, Float:z, Float:a;
  1033. CheckVehicle(CarInfo[idd][Spawned]);
  1034. saveTuning(playerid, CarInfo[idd][Spawned]);
  1035. GetVehiclePos(car, x, y, z);
  1036. GetVehicleZAngle(car, a);
  1037.  
  1038. CarInfo[idd][cVirtual] = 0;
  1039. if(GetPVarInt(playerid, "inGarage") != 0) {
  1040. if(garage_slot(playerid, 0) == -1) x = 481.85, y = -405.426, z = 2758.0046;
  1041. else if(garage_slot(playerid, 1) == -1) x = 481.85, y = -410.9, z = 2758.0046;
  1042. else if(garage_slot(playerid, 2) == -1) x = 481.85, y = -416.301, z = 2758.0046;
  1043. else if(garage_slot(playerid, 3) == -1) x = 481.85, y = -421.104, z = 2758.0046;
  1044. else if(garage_slot(playerid, 4) == -1) x = 481.85, y = -425.924, z = 2758.0046;
  1045. else if(garage_slot(playerid, 5) == -1) x = 493.998, y = -405.426, z = 2758.0046;
  1046. else if(garage_slot(playerid, 6) == -1) x = 493.998, y = -410.9, z = 2758.0046;
  1047. else if(garage_slot(playerid, 7) == -1) x = 493.998, y = -416.301, z = 2758.0046;
  1048. else if(garage_slot(playerid, 8) == -1) x = 493.998, y = -421.104, z = 2758.0046;
  1049. else if(garage_slot(playerid, 9) == -1) x = 493.998, y = -425.924, z = 2758.0046;
  1050. if(x == 481.85) a = -131.1600;
  1051. if(x == 493.998) a = 131.1600;
  1052.  
  1053. CarInfo[idd][cVirtual] = GetPVarInt(playerid, "inGarage");
  1054. SCM(playerid, COLOR_GRAD3, "Your vehicle was parked in the garage.");
  1055. }
  1056.  
  1057. CarInfo[idd][cLocationx] = x;
  1058. CarInfo[idd][cLocationy] = y;
  1059. CarInfo[idd][cLocationz] = z;
  1060.  
  1061.  
  1062. CarInfo[idd][cAngle] = a;
  1063. VehicleOwned[CarInfo[idd][Spawned]] = 0;
  1064. VehicleSQL[CarInfo[idd][Spawned]] = 0;
  1065.  
  1066. DestroyVehicle(car);
  1067.  
  1068. if(CarInfo[idd][cNeon] != 0) {
  1069. DestroyDynamicObject(neon[0][CarInfo[idd][Spawned]]);
  1070. DestroyDynamicObject(neon[1][CarInfo[idd][Spawned]]);
  1071. neon[0][CarInfo[idd][Spawned]] = 0;
  1072. neon[1][CarInfo[idd][Spawned]] = 0;
  1073. }
  1074. if(strlen(CarInfo[idd][cText]) >= 3) {
  1075. DestroyDynamicObject(nameobject[CarInfo[idd][Spawned]]);
  1076. }
  1077. CarInfo[idd][Spawned] = CreateVehicleEx(CarInfo[idd][cModel],CarInfo[idd][cLocationx],CarInfo[idd][cLocationy],CarInfo[idd][cLocationz],CarInfo[idd][cAngle],CarInfo[idd][cColorOne],CarInfo[idd][cColorTwo],-1);
  1078. SetVehicleVirtualWorld(CarInfo[idd][Spawned], CarInfo[idd][cVirtual]);
  1079. VehicleOwned[CarInfo[idd][Spawned]] = CarInfo[idd][Spawned];
  1080. VehicleSQL[CarInfo[idd][Spawned]] = idd;
  1081. if(CarInfo[idd][cNeon] != 0) {
  1082. new h = CarInfo[idd][Spawned];
  1083. if(CarInfo[idd][cNeon] == 1)
  1084. {
  1085. neon[0][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  1086. neon[1][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  1087. }
  1088. else if(CarInfo[idd][cNeon] == 2)
  1089. {
  1090. neon[0][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  1091. neon[1][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  1092. }
  1093. else if(CarInfo[idd][cNeon] == 3)
  1094. {
  1095. neon[0][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  1096. neon[1][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  1097. }
  1098. else if(CarInfo[idd][cNeon] == 4)
  1099. {
  1100. neon[0][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  1101. neon[1][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  1102. }
  1103. else if(CarInfo[idd][cNeon] == 5)
  1104. {
  1105. neon[0][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  1106. neon[1][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  1107. }
  1108. else if(CarInfo[idd][cNeon] == 6)
  1109. {
  1110. neon[0][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  1111. neon[1][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  1112. }
  1113. AttachDynamicObjectToVehicle(neon[0][h], h, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  1114. AttachDynamicObjectToVehicle(neon[1][h], h, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  1115. }
  1116. attach_vip_text(idd);
  1117.  
  1118. SetTunning(idd);
  1119. SetVehicleNumberPlate(CarInfo[idd][Spawned], CarInfo[idd][cLicense]);
  1120. saveCarPark(idd);
  1121. new Float: Pos[3];
  1122. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  1123. CarInfo[idd][cLastPos][0] = Pos[0];
  1124. CarInfo[idd][cLastPos][1] = Pos[1];
  1125. CarInfo[idd][cLastPos][2] = Pos[2];
  1126. return 1;
  1127. }
  1128. // objects
  1129. load_garage_map() {
  1130.  
  1131. new suelocochera[1];
  1132. suelocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1133. SetObjectMaterial(suelocochera[0], 0, 16150, "ufo_bar", "dinerfloor01_128", 0xFFFFFFFF);
  1134.  
  1135. new paredescochera[4];
  1136. paredescochera[0] = CreateObject(6959,496.7000100,-419.7000100,2742.6001000,0.0000000,91.6560000,359.9730000);
  1137. paredescochera[1] = CreateObject(6959,477.6000100,-418.8999900,2742.6001000,0.0000000,91.6530000,359.9730000);
  1138. paredescochera[2] = CreateObject(6959,497.2999900,-399.6000100,2742.6001000,0.0000000,91.6530000,269.0490000);
  1139. paredescochera[3] = CreateObject(6959,496.5000000,-438.6000100,2742.6001000,0.0000000,91.6480000,269.0440000);
  1140. for(new index=0; index<4; index++) SetObjectMaterial(paredescochera[index], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
  1141.  
  1142. new techocochera[1];
  1143. techocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2762.3000000,0.0000000,0.0000000,0.0000000);
  1144. SetObjectMaterial(techocochera[0], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
  1145.  
  1146.  
  1147. CreateObject(13187,491.7999900,-438.8999900,2758.6001000,0.0000000,0.0000000,88.3620000);
  1148. CreateObject(13187,483.5000000,-438.7999900,2758.6001000,0.0000000,0.0000000,89.6380000);
  1149. CreateObject(2323,488.7000100,-401.2999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1150. CreateObject(2306,491.2999900,-401.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1151. CreateObject(1730,493.2999900,-400.2000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1152. CreateObject(1518,493.5000000,-400.2999900,2758.7000000,0.0000000,0.0000000,0.0000000);
  1153. CreateObject(2226,491.2999900,-400.2000100,2758.3000000,0.0000000,0.0000000,0.0000000);
  1154. CreateObject(2229,494.7000100,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1155. CreateObject(2229,492.8999900,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1156. CreateObject(2297,488.5000000,-400.2000100,2759.3000000,0.0000000,0.0000000,316.4590000);
  1157. CreateObject(2654,490.6000100,-400.2999900,2757.5000000,0.0000000,0.0000000,0.0000000);
  1158. CreateObject(2980,495.1000100,-400.2000100,2758.1001000,0.0000000,0.0000000,0.0000000);
  1159. CreateObject(2614,487.2000100,-400.0000000,2761.3999000,0.0000000,0.0000000,0.0000000);
  1160. CreateObject(2611,492.0000000,-400.1000100,2760.0000000,0.0000000,0.0000000,0.0000000);
  1161. CreateObject(1616,496.8999900,-439.1000100,2762.1001000,0.0000000,0.0000000,0.0000000);
  1162. CreateObject(1584,497.2000100,-404.0000000,2759.5000000,0.0000000,0.0000000,278.3490000);
  1163. CreateObject(1585,478.2000100,-432.3999900,2759.5000000,0.0000000,0.0000000,271.6380000);
  1164. CreateObject(14699,494.0000000,-430.1000100,2760.5000000,0.0000000,0.0000000,92.2040000);
  1165. CreateObject(14699,493.7000100,-420.7000100,2760.5000000,0.0000000,0.0000000,92.2030000);
  1166. CreateObject(14699,493.2999900,-410.99900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1167. CreateObject(14699,493.2999900,-403.2999900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1168. CreateObject(14699,485.7999900,-403.0000000,2760.5000000,0.0000000,0.0000000,92.2030000);
  1169. CreateObject(14699,486.1000100,-411.3999900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1170. CreateObject(14699,486.7999900,-420.6000100,2760.5000000,0.0000000,0.0000000,92.2030000);
  1171. CreateObject(14699,485.7000100,-430.5000000,2760.5000000,0.0000000,0.0000000,92.2030000);
  1172. CreateObject(2502,478.8999900,-400.0000000,2757.3000000,0.0000000,0.0000000,0.0000000);
  1173. CreateObject(19273, 487.68793, -438.88925, 2758.78760, 0.00000, 0.00000, 175.91960);
  1174. CreateObject(19900, 480.10303, -400.07925, 2757.25903, 0.00000, 0.00000, 0.00000);
  1175. CreateObject(19900, 480.74579, -400.07465, 2757.25903, 0.00000, 0.00000, 0.00000);
  1176. CreateObject(19815, 482.35214, -399.79022, 2758.80859, 0.00000, 0.00000, -0.78000);
  1177. CreateObject(11737, 481.59167, -401.42493, 2757.26416, 0.00000, 0.00000, 0.00000);
  1178. CreateObject(2465, 479.12677, -400.20123, 2758.53125, 0.00000, 0.00000, 0.00000);
  1179. CreateObject(19617, 487.34158, -399.89642, 2760.01953, 0.00000, 0.00000, 0.00000);
  1180. CreateObject(19804, 488.39011, -400.00421, 2758.41748, 0.00000, 0.00000, 0.00000);
  1181. CreateObject(19805, 485.45383, -399.87045, 2759.29175, 0.00000, 0.00000, 0.00000);
  1182. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement