Advertisement
Guest User

Untitled

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