Advertisement
Guest User

Untitled

a guest
Sep 7th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.63 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. cmd_park(playerid, "");
  716. SetPVarInt(playerid, "inGarage", 0);
  717. }
  718. }
  719. return 1;
  720. }
  721.  
  722. public OnVehicleSpawn(vehicleid) {
  723. CarRadio[vehicleid] = 0;
  724. SetVehicleHealth(vehicleid, 999);
  725. if(FindSpawnID(vehicleid) != 0) {
  726. new carid = FindSpawnID(vehicleid);
  727. if(CarInfo[carid][cVirtual] != 0) SetVehicleVirtualWorld(vehicleid, CarInfo[carid][cVirtual]);
  728. SetTunning(carid);
  729. CarInfo[carid][cTax] += 1500 + random(500);
  730. new query[256];
  731. format(query, sizeof(query), "UPDATE `cars` SET `Tax`='%d' WHERE `ID`='%d'", CarInfo[carid][cTax], carid);
  732. mysql_query(SQL, query);
  733. }
  734. else Gas[vehicleid] = 100;
  735. SetVehicleColor(vehicleid);
  736. if(Carspawn[vehicleid] == vehicleid) {
  737. DestroyVehicle(vehicleid);
  738. Carspawn[vehicleid] = 0;
  739. }
  740. return 1;
  741. }
  742.  
  743. function garage_id_empty() {
  744. for(new i = 1; i < MAX_GARAGES; i++) {
  745. if(garageInfo[i][gID] == 0) return i;
  746. }
  747. return -1;
  748. }
  749.  
  750. function user_have_garage(playerid) {
  751. for(new i = 1; i < MAX_GARAGES; i++) {
  752. if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return 1;
  753. }
  754. return 0;
  755. }
  756.  
  757. function user_garage(playerid) {
  758. for(new i = 1; i < MAX_GARAGES; i++) {
  759. if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return i;
  760. }
  761. return 0;
  762. }
  763.  
  764.  
  765. function LoadGarages() {
  766. new Cache: db = mysql_query(SQL, "SELECT * FROM `garages`");
  767. new x, result[126];
  768. for(new i, j = cache_get_row_count (); i != j; ++i) {
  769. garages ++;
  770. cache_get_field_content(i, "ID", result); x = strval(result), garageInfo[garages][gID] = x;
  771. cache_get_field_content(i, "Owner", result); format(garageInfo[x][gOwner], 32, result);
  772. cache_get_field_content(i, "UserID", result); garageInfo[x][gUserID] = strval(result);
  773. cache_get_field_content(i, "Price", result); garageInfo[x][gPrice] = strval(result);
  774.  
  775. garageInfo[x][gPos][0] = cache_get_field_content_float(i, "X");
  776. garageInfo[x][gPos][1] = cache_get_field_content_float(i, "Y");
  777. garageInfo[x][gPos][2] = cache_get_field_content_float(i, "Z");
  778. garageInfo[x][gAngle] = cache_get_field_content_float(i, "Angle");
  779.  
  780. garageInfo[x][gVirtualID] = x;
  781.  
  782. garageInfo[x][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[x][gPos][0], garageInfo[x][gPos][1], garageInfo[x][gPos][2]);
  783. garage_label(x);
  784. }
  785. printf("Garages loaded: %d", garages);
  786. cache_delete(db);
  787. return 1;
  788. }
  789.  
  790. function UpdateGarage_int(id, varname[], amount) {
  791. new query[128];
  792. mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%d' WHERE `ID`='%d'", varname, amount, id);
  793. mysql_tquery(SQL, query, "", "");
  794. return 1;
  795. }
  796.  
  797. function UpdateGarage_str(id, varname[], amount[]) {
  798. new query[128];
  799. mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%s' WHERE `ID`='%d'", varname, amount, id);
  800. mysql_tquery(SQL, query, "", "");
  801. return 1;
  802. }
  803.  
  804. function vehicles_in_garage(playerid) {
  805. new x;
  806. for(new i = 0; i < 10; i++) {
  807. if(PlayerInfo[playerid][pCarKey][i] != 0 && CarInfo[PlayerInfo[playerid][pCarKey][i]][cVirtual] != 0) x++;
  808. }
  809. return x;
  810. }
  811.  
  812. stock SetPlayerPosEx2(playerid, Float:x, Float:y, Float:z) {
  813. if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePosEx(playerid, GetPlayerVehicleID(playerid), x, y, z);
  814. else SetPlayerPos(playerid, x, y, z);
  815.  
  816. GetPlayerPos(playerid, LastPos[playerid][0], LastPos[playerid][1], LastPos[playerid][2]);
  817. Exception[playerid] += 1;
  818. foreach(Player, i) {
  819. if(Spectate[i] == playerid) {
  820. TogglePlayerSpectating(i, 1);
  821. SetPlayerInterior(i, GetPlayerInterior(playerid));
  822. SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
  823. if(IsPlayerInAnyVehicle(playerid)) PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
  824. else PlayerSpectatePlayer(i, playerid);
  825. }
  826. }
  827. if(GetPVarInt(playerid, "Undercover") == 1) {
  828. foreach(Player, i) ShowPlayerNameTagForPlayer(i, playerid, false);
  829. PlayerTextDrawShow(playerid, UndercoverTD);
  830. }
  831. return 1;
  832. }
  833.  
  834. stock SpawnPlayerCar(dbid) {
  835. new string[180];
  836. new engine,lights,alarm,doors,bonnet,boot,objective;
  837. if(dbid != 0) {
  838. if(CarInfo[dbid][Confiscated] == 1) return 1;
  839. CarInfo[dbid][Spawned] = CreateVehicleEx(CarInfo[dbid][cModel],CarInfo[dbid][cLocationx],CarInfo[dbid][cLocationy],CarInfo[dbid][cLocationz],CarInfo[dbid][cAngle],CarInfo[dbid][cColorOne],CarInfo[dbid][cColorTwo],-1);
  840. SetVehicleVirtualWorld(CarInfo[dbid][Spawned], CarInfo[dbid][cVirtual]);
  841. VehicleOwned[CarInfo[dbid][Spawned]] = CarInfo[dbid][Spawned];
  842. VehicleSQL[CarInfo[dbid][Spawned]] = dbid;
  843.  
  844. attach_vip_text(dbid);
  845. if(CarInfo[dbid][cNeon] != 0) {
  846. new h = CarInfo[dbid][Spawned];
  847. if(CarInfo[dbid][cNeon] == 1) {
  848. neon[0][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  849. neon[1][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  850. }
  851. else if(CarInfo[dbid][cNeon] == 2) {
  852. neon[0][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  853. neon[1][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  854. }
  855. else if(CarInfo[dbid][cNeon] == 3) {
  856. neon[0][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  857. neon[1][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  858. }
  859. else if(CarInfo[dbid][cNeon] == 4) {
  860. neon[0][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  861. neon[1][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  862. }
  863. else if(CarInfo[dbid][cNeon] == 5) {
  864. neon[0][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  865. neon[1][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  866. }
  867. else if(CarInfo[dbid][cNeon] == 6) {
  868. neon[0][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  869. neon[1][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  870. }
  871. AttachDynamicObjectToVehicle(neon[0][h], h, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  872. AttachDynamicObjectToVehicle(neon[1][h], h, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  873. }
  874.  
  875. Gas[CarInfo[dbid][Spawned]] = CarInfo[dbid][cFuel];
  876. GetVehicleParamsEx(CarInfo[dbid][Spawned],engine,lights,alarm,doors,bonnet,boot,objective);
  877. SetVehicleParamsEx(CarInfo[dbid][Spawned],0,lights,alarm,CarInfo[dbid][cLock],bonnet,boot,objective);
  878. new carid = CarInfo[dbid][Spawned];
  879. if(CarInfo[dbid][mod0] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod0]);
  880. if(CarInfo[dbid][mod1] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod1]);
  881. if(CarInfo[dbid][mod2] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod2]);
  882. if(CarInfo[dbid][mod3] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod3]);
  883. if(CarInfo[dbid][mod4] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod4]);
  884. if(CarInfo[dbid][mod5] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod5]);
  885. if(CarInfo[dbid][mod7] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod7]);
  886. if(CarInfo[dbid][mod8] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod8]);
  887. if(CarInfo[dbid][mod9] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod9]);
  888. if(CarInfo[dbid][mod10] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod10]);
  889. if(CarInfo[dbid][mod11] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod11]);
  890. if(CarInfo[dbid][mod12] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod12]);
  891. if(CarInfo[dbid][mod13] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod13]);
  892. SetVehicleNumberPlate(carid,CarInfo[dbid][cLicense]);
  893. mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[dbid][Spawned], dbid);
  894. mysql_tquery(SQL, string, "", "");
  895. }
  896. return 1;
  897. }
  898.  
  899. function BlackBar(playerid) {
  900. switch(Step[playerid]) {
  901. case 0: PlayerTextDrawBoxColor(playerid, BarTD, 0x000000FF);
  902. case 1: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000090);
  903. case 2: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000080);
  904. case 3: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000070);
  905. case 4: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000060);
  906. case 5: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000050);
  907. case 6: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000040);
  908. case 7: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000030);
  909. case 8: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000020);
  910. case 9: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000010);
  911. case 10: {
  912. PlayerTextDrawHide(playerid, BarTD);
  913. Step[playerid] = 0;
  914. KillTimer(BarTimer[playerid]);
  915. return 1;
  916. }
  917. }
  918. PlayerTextDrawShow(playerid, BarTD);
  919. Step[playerid] ++;
  920. return 1;
  921. }
  922.  
  923. stock saveCar(idd) {
  924. if(idd == 0) return 1;
  925. new query[512];
  926. mysql_format(SQL, query, sizeof(query),
  927. "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",
  928. 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],
  929. CarInfo[idd][cLicense], CarInfo[idd][Userid], CarInfo[idd][cVirtual], idd);
  930. mysql_tquery(SQL, query, "", "");
  931. return 1;
  932. }
  933.  
  934. /*
  935. CMD:debugsystem(playerid, params[]) {
  936. new string[126], model[64];
  937. format(string, 64, "%d/10 vehicles", vehicles_in_garage(playerid));
  938. SendClientMessage(playerid, -1, string);
  939. for(new i = 0; i < 10; i++) {
  940. if(garage_slot(playerid, i) == -1) model = "None";
  941. else format(model, sizeof(model), "%s", aVehicleNames[CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, i)]][cModel]-400]);
  942.  
  943. format(string, sizeof(string), "Slot %d - %s", i, model);
  944. SendClientMessage(playerid, COLOR_WARNING, string);
  945. }
  946.  
  947. return 1;
  948. }
  949. */
  950.  
  951. function vehicle_in_garage(playerid, carid) {
  952. new slot = -1;
  953. for(new i = 0; i < 10; i++) {
  954. if(CarInfo[PlayerInfo[playerid][pCarKey][i]][Spawned] == carid) {
  955. new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
  956. Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
  957.  
  958. if(Pos[0] == 481.85 && Pos[1] == -405.426) slot = i;
  959. else if(Pos[0] == 481.85 && Pos[1] == -410.9) slot = i;
  960. else if(Pos[0] == 481.85 && Pos[1] == -416.301) slot = i;
  961. else if(Pos[0] == 481.85 && Pos[1] == -421.104) slot = i;
  962. else if(Pos[0] == 481.85 && Pos[1] == -425.924) slot = i;
  963. else if(Pos[0] == 493.998 && Pos[1] == -405.426) slot = i;
  964. else if(Pos[0] == 493.998 && Pos[1] == -410.9) slot = i;
  965. else if(Pos[0] == 493.998 && Pos[1] == -416.301) slot = i;
  966. else if(Pos[0] == 493.998 && Pos[1] == -421.104) slot = i;
  967. else if(Pos[0] == 493.998 && Pos[1] == -425.924) slot = i;
  968. }
  969. }
  970. return slot;
  971. }
  972.  
  973. function garage_slot(playerid, id) {
  974. new slot = -1;
  975. for(new i = 0; i < 10; i++) {
  976. if(PlayerInfo[playerid][pCarKey][i] != 0) {
  977. new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
  978. Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
  979.  
  980. if(Pos[0] == 481.85 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 0) slot = i;
  981. if(Pos[0] == 481.85 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 1) slot = i;
  982. if(Pos[0] == 481.85 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 2) slot = i;
  983. if(Pos[0] == 481.85 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 3) slot = i;
  984. if(Pos[0] == 481.85 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 4) slot = i;
  985. if(Pos[0] == 493.998 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 5) slot = i;
  986. if(Pos[0] == 493.998 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 6) slot = i;
  987. if(Pos[0] == 493.998 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 7) slot = i;
  988. if(Pos[0] == 493.998 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 8) slot = i;
  989. if(Pos[0] == 493.998 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 9) slot = i;
  990. }
  991. }
  992. return slot;
  993. }
  994.  
  995. garage_label(x) {
  996. new string[126];
  997. DestroyDynamic3DTextLabel(garageInfo[x][garageLabel]);
  998. if(garageInfo[x][gPrice] == 0) format(string, sizeof(string), "Garage %d{C90202}\nGarage Owner: {FFFFFF}%s", x, garageInfo[x][gOwner]);
  999. 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]));
  1000. 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);
  1001. }
  1002.  
  1003. // Commands with ZCMD
  1004. CMD:garagehelp(playerid, params[]) {
  1005. if(PlayerInfo[playerid][pAdmin] >= 7) SendClientMessage(playerid, COLOR_WARNING, "(admins commands) {FFFFFF}/creategarage, /movegarage, /gotogarage.");
  1006. SendClientMessage(playerid, -1, "(garage commands) {FFFFFF}/buygarage, /sellgarage, /sellgaragetostate, /mygarage, /findgarage.");
  1007. return 1;
  1008. }
  1009.  
  1010. CMD:mygarage(playerid, params[]) {
  1011. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  1012. new string[64];
  1013. format(string, sizeof(string), "Your garage has ID %d. Use /findgarage to locate.", user_have_garage(playerid));
  1014. SendClientMessage(playerid, -1, string);
  1015. return 1;
  1016. }
  1017.  
  1018. CMD:findgarage(playerid, params[]) {
  1019. 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");
  1020. new id;
  1021. if(sscanf(params, "i",id)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: {FFFFFF}/findgarage <garage ID>");
  1022. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1023. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1024. CP[playerid] = 43;
  1025. SetPlayerCheckpointEx(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2], 2.0);
  1026. new string[180];
  1027. 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]));
  1028. SendClientMessage(playerid, COLOR_YELLOW, string);
  1029. return 1;
  1030. }
  1031.  
  1032. CMD:creategarage(playerid, params[]) {
  1033. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  1034. if(garages >= MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "There are too many garages!");
  1035. new price;
  1036. if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/creategarage <garage price>");
  1037. if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
  1038. SetPVarInt(playerid, "garagePrice", price);
  1039. ShowPlayerDialog(playerid, DIALOG_CREATEGARAGE, DIALOG_STYLE_MSGBOX, "Create garage", "Are you sure you want to add a garage here?", "Yes", "No");
  1040. return 1;
  1041. }
  1042.  
  1043. CMD:movegarage(playerid, params[]) {
  1044. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  1045. new id;
  1046. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
  1047. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1048. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1049. SetPVarInt(playerid, "garageID", id);
  1050. ShowPlayerDialog(playerid, DIALOG_MOVEGARAGE, DIALOG_STYLE_MSGBOX, "Move garage", "Are you sure you want to move that garage here?", "Yes", "No");
  1051. return 1;
  1052. }
  1053.  
  1054. CMD:gotogarage(playerid, params[]) {
  1055. if(PlayerInfo[playerid][pAdmin] < 7) return 1;
  1056. new id;
  1057. if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
  1058. if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1059. if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
  1060. SetPlayerPos(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
  1061. SetPlayerVirtualWorld(playerid, 0);
  1062. SetPlayerInterior(playerid, 0);
  1063. return 1;
  1064. }
  1065.  
  1066. CMD:buygarage(playerid, params[]) {
  1067. if(user_have_garage(playerid) == 1) return SendClientMessage(playerid, COLOR_GRAD3, "You already have a garage!");
  1068. if(PlayerInfo[playerid][pLevel] < 5) return SendClientMessage(playerid, COLOR_WARNING, "You need level 5+ to buy a garage!");
  1069. for(new i = 1; i < MAX_GARAGES; i++) {
  1070. if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2])) {
  1071. if(garageInfo[i][gPrice] == 0) return SendClientMessage(playerid, COLOR_GRAD3, "This garage is not available!");
  1072. if(GetPlayerCash(playerid) < garageInfo[i][gPrice]) return SendClientMessage(playerid, COLOR_GRAD3, "You do not have that amount of money!");
  1073. ShowPlayerDialog(playerid, DIALOG_BUYGARAGE, DIALOG_STYLE_MSGBOX, "Buy garage", "Are you sure you want to buy this garage?", "Yes", "No");
  1074. SetPVarInt(playerid, "garageID", i);
  1075. }
  1076. }
  1077. return 1;
  1078. }
  1079.  
  1080. CMD:sellgarage(playerid, params[]) {
  1081. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  1082. if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
  1083. new price;
  1084. if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/sellgarage <garage price (0=cancel)>");
  1085. if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
  1086. new id = user_garage(playerid), string[126];
  1087. if(price == 0) SendClientMessage(playerid, COLOR_MONEY, "Garajul tau nu mai este acum de vanzare!");
  1088. else {
  1089. format(string, sizeof(string), "Garajul tau este de vanzare la suma de $%s.", FormatNumber(price));
  1090. SendClientMessage(playerid, COLOR_MONEY, string);
  1091. }
  1092. garageInfo[id][gPrice] = price;
  1093. UpdateGarage_int(id, "Price", garageInfo[id][gPrice]);
  1094. garage_label(id);
  1095. return 1;
  1096. }
  1097.  
  1098. CMD:sellgaragetostate(playerid, params[]) {
  1099. if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
  1100. if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
  1101. new string[98];
  1102. format(string, sizeof(string), "Are you sure you want to sell the garage to the state for %s?", FormatNumber(SELL_GARAGE_PRICE));
  1103. ShowPlayerDialog(playerid, DIALOG_SELLGARAGE, DIALOG_STYLE_MSGBOX, "Sell garage to state", string, "Yes", "No");
  1104. return 1;
  1105. }
  1106.  
  1107. CMD:park(playerid, params[]) {
  1108. new car = GetPlayerVehicleID(playerid);
  1109. if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Nu esti in vehiculul tau.");
  1110. if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "Nu ai un vehicul personal!");
  1111. if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti in unul dintre vehiculele tale personale!");
  1112. if(GetPlayerState(playerid) != 2) return SCM(playerid, COLOR_LGREEN, "* Trebuie sa fii la volan pentru a putea folosi aceasta comanda!");
  1113. new idd = PersonalCar(playerid);
  1114. new Float: vhp;
  1115. GetVehicleHealth(car, vhp);
  1116. if(vhp < 800) return SendClientMessage(playerid, COLOR_GREY, "Nu poti parca masina cand are sub 800 'viata'!");
  1117. if(PlayerToPoint(150.0, playerid, 1716.9065,-1902.4526,13.5661)) return SCM(playerid, -1, "Nu poti parca o masina in jurul spawn-ului.");
  1118. new Float:x, Float:y, Float:z, Float:a;
  1119. CheckVehicle(CarInfo[idd][Spawned]);
  1120. saveTuning(playerid, CarInfo[idd][Spawned]);
  1121. GetVehiclePos(car, x, y, z);
  1122. GetVehicleZAngle(car, a);
  1123.  
  1124. CarInfo[idd][cVirtual] = 0;
  1125. if(GetPVarInt(playerid, "inGarage") != 0) {
  1126. if(garage_slot(playerid, 0) == -1) x = 481.85, y = -405.426, z = 2758.0046;
  1127. else if(garage_slot(playerid, 1) == -1) x = 481.85, y = -410.9, z = 2758.0046;
  1128. else if(garage_slot(playerid, 2) == -1) x = 481.85, y = -416.301, z = 2758.0046;
  1129. else if(garage_slot(playerid, 3) == -1) x = 481.85, y = -421.104, z = 2758.0046;
  1130. else if(garage_slot(playerid, 4) == -1) x = 481.85, y = -425.924, z = 2758.0046;
  1131. else if(garage_slot(playerid, 5) == -1) x = 493.998, y = -405.426, z = 2758.0046;
  1132. else if(garage_slot(playerid, 6) == -1) x = 493.998, y = -410.9, z = 2758.0046;
  1133. else if(garage_slot(playerid, 7) == -1) x = 493.998, y = -416.301, z = 2758.0046;
  1134. else if(garage_slot(playerid, 8) == -1) x = 493.998, y = -421.104, z = 2758.0046;
  1135. else if(garage_slot(playerid, 9) == -1) x = 493.998, y = -425.924, z = 2758.0046;
  1136. if(x == 481.85) a = -131.1600;
  1137. if(x == 493.998) a = 131.1600;
  1138.  
  1139. CarInfo[idd][cVirtual] = GetPVarInt(playerid, "inGarage");
  1140. SCM(playerid, COLOR_GRAD3, "Your vehicle was parked in the garage.");
  1141. }
  1142.  
  1143. CarInfo[idd][cLocationx] = x;
  1144. CarInfo[idd][cLocationy] = y;
  1145. CarInfo[idd][cLocationz] = z;
  1146.  
  1147.  
  1148. CarInfo[idd][cAngle] = a;
  1149. VehicleOwned[CarInfo[idd][Spawned]] = 0;
  1150. VehicleSQL[CarInfo[idd][Spawned]] = 0;
  1151.  
  1152. DestroyVehicle(car);
  1153.  
  1154. if(CarInfo[idd][cNeon] != 0) {
  1155. DestroyDynamicObject(neon[0][CarInfo[idd][Spawned]]);
  1156. DestroyDynamicObject(neon[1][CarInfo[idd][Spawned]]);
  1157. neon[0][CarInfo[idd][Spawned]] = 0;
  1158. neon[1][CarInfo[idd][Spawned]] = 0;
  1159. }
  1160. if(strlen(CarInfo[idd][cText]) >= 3) {
  1161. DestroyDynamicObject(nameobject[CarInfo[idd][Spawned]]);
  1162. }
  1163. 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);
  1164. SetVehicleVirtualWorld(CarInfo[idd][Spawned], CarInfo[idd][cVirtual]);
  1165. VehicleOwned[CarInfo[idd][Spawned]] = CarInfo[idd][Spawned];
  1166. VehicleSQL[CarInfo[idd][Spawned]] = idd;
  1167. if(CarInfo[idd][cNeon] != 0) {
  1168. new h = CarInfo[idd][Spawned];
  1169. if(CarInfo[idd][cNeon] == 1)
  1170. {
  1171. neon[0][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  1172. neon[1][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
  1173. }
  1174. else if(CarInfo[idd][cNeon] == 2)
  1175. {
  1176. neon[0][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  1177. neon[1][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
  1178. }
  1179. else if(CarInfo[idd][cNeon] == 3)
  1180. {
  1181. neon[0][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  1182. neon[1][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
  1183. }
  1184. else if(CarInfo[idd][cNeon] == 4)
  1185. {
  1186. neon[0][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  1187. neon[1][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
  1188. }
  1189. else if(CarInfo[idd][cNeon] == 5)
  1190. {
  1191. neon[0][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  1192. neon[1][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
  1193. }
  1194. else if(CarInfo[idd][cNeon] == 6)
  1195. {
  1196. neon[0][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  1197. neon[1][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
  1198. }
  1199. AttachDynamicObjectToVehicle(neon[0][h], h, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  1200. AttachDynamicObjectToVehicle(neon[1][h], h, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
  1201. }
  1202. attach_vip_text(idd);
  1203.  
  1204. SetTunning(idd);
  1205. SetVehicleNumberPlate(CarInfo[idd][Spawned], CarInfo[idd][cLicense]);
  1206. saveCar(idd);
  1207. new Float: Pos[3];
  1208. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  1209. CarInfo[idd][cLastPos][0] = Pos[0];
  1210. CarInfo[idd][cLastPos][1] = Pos[1];
  1211. CarInfo[idd][cLastPos][2] = Pos[2];
  1212. return 1;
  1213. }
  1214. // objects
  1215. load_garage_map() {
  1216.  
  1217. new suelocochera[1];
  1218. suelocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1219. SetObjectMaterial(suelocochera[0], 0, 16150, "ufo_bar", "dinerfloor01_128", 0xFFFFFFFF);
  1220.  
  1221. new paredescochera[4];
  1222. paredescochera[0] = CreateObject(6959,496.7000100,-419.7000100,2742.6001000,0.0000000,91.6560000,359.9730000);
  1223. paredescochera[1] = CreateObject(6959,477.6000100,-418.8999900,2742.6001000,0.0000000,91.6530000,359.9730000);
  1224. paredescochera[2] = CreateObject(6959,497.2999900,-399.6000100,2742.6001000,0.0000000,91.6530000,269.0490000);
  1225. paredescochera[3] = CreateObject(6959,496.5000000,-438.6000100,2742.6001000,0.0000000,91.6480000,269.0440000);
  1226. for(new index=0; index<4; index++) SetObjectMaterial(paredescochera[index], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
  1227.  
  1228. new techocochera[1];
  1229. techocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2762.3000000,0.0000000,0.0000000,0.0000000);
  1230. SetObjectMaterial(techocochera[0], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
  1231.  
  1232.  
  1233. CreateObject(13187,491.7999900,-438.8999900,2758.6001000,0.0000000,0.0000000,88.3620000);
  1234. CreateObject(13187,483.5000000,-438.7999900,2758.6001000,0.0000000,0.0000000,89.6380000);
  1235. CreateObject(2323,488.7000100,-401.2999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1236. CreateObject(2306,491.2999900,-401.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
  1237. CreateObject(1730,493.2999900,-400.2000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1238. CreateObject(1518,493.5000000,-400.2999900,2758.7000000,0.0000000,0.0000000,0.0000000);
  1239. CreateObject(2226,491.2999900,-400.2000100,2758.3000000,0.0000000,0.0000000,0.0000000);
  1240. CreateObject(2229,494.7000100,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1241. CreateObject(2229,492.8999900,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
  1242. CreateObject(2297,488.5000000,-400.2000100,2759.3000000,0.0000000,0.0000000,316.4590000);
  1243. CreateObject(2654,490.6000100,-400.2999900,2757.5000000,0.0000000,0.0000000,0.0000000);
  1244. CreateObject(2980,495.1000100,-400.2000100,2758.1001000,0.0000000,0.0000000,0.0000000);
  1245. CreateObject(2614,487.2000100,-400.0000000,2761.3999000,0.0000000,0.0000000,0.0000000);
  1246. CreateObject(2611,492.0000000,-400.1000100,2760.0000000,0.0000000,0.0000000,0.0000000);
  1247. CreateObject(1616,496.8999900,-439.1000100,2762.1001000,0.0000000,0.0000000,0.0000000);
  1248. CreateObject(1584,497.2000100,-404.0000000,2759.5000000,0.0000000,0.0000000,278.3490000);
  1249. CreateObject(1585,478.2000100,-432.3999900,2759.5000000,0.0000000,0.0000000,271.6380000);
  1250. CreateObject(14699,494.0000000,-430.1000100,2760.5000000,0.0000000,0.0000000,92.2040000);
  1251. CreateObject(14699,493.7000100,-420.7000100,2760.5000000,0.0000000,0.0000000,92.2030000);
  1252. CreateObject(14699,493.2999900,-410.99900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1253. CreateObject(14699,493.2999900,-403.2999900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1254. CreateObject(14699,485.7999900,-403.0000000,2760.5000000,0.0000000,0.0000000,92.2030000);
  1255. CreateObject(14699,486.1000100,-411.3999900,2760.5000000,0.0000000,0.0000000,92.2030000);
  1256. CreateObject(14699,486.7999900,-420.6000100,2760.5000000,0.0000000,0.0000000,92.2030000);
  1257. CreateObject(14699,485.7000100,-430.5000000,2760.5000000,0.0000000,0.0000000,92.2030000);
  1258. CreateObject(2502,478.8999900,-400.0000000,2757.3000000,0.0000000,0.0000000,0.0000000);
  1259. CreateObject(19273, 487.68793, -438.88925, 2758.78760, 0.00000, 0.00000, 175.91960);
  1260. CreateObject(19900, 480.10303, -400.07925, 2757.25903, 0.00000, 0.00000, 0.00000);
  1261. CreateObject(19900, 480.74579, -400.07465, 2757.25903, 0.00000, 0.00000, 0.00000);
  1262. CreateObject(19815, 482.35214, -399.79022, 2758.80859, 0.00000, 0.00000, -0.78000);
  1263. CreateObject(11737, 481.59167, -401.42493, 2757.26416, 0.00000, 0.00000, 0.00000);
  1264. CreateObject(2465, 479.12677, -400.20123, 2758.53125, 0.00000, 0.00000, 0.00000);
  1265. CreateObject(19617, 487.34158, -399.89642, 2760.01953, 0.00000, 0.00000, 0.00000);
  1266. CreateObject(19804, 488.39011, -400.00421, 2758.41748, 0.00000, 0.00000, 0.00000);
  1267. CreateObject(19805, 485.45383, -399.87045, 2759.29175, 0.00000, 0.00000, 0.00000);
  1268. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement