Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Garage system (include) by Edison for Burned RPG gamemode.
- Started date: 05.11.2017, 9:38 AM
- Version: 0.1
- Mentinuti:
- > Adaugat in baza de date la vehicule un nou rand cu Virtual World
- */
- #include <YSI\y_hooks>
- #define MAX_GARAGES 10
- #define SELL_GARAGE_PRICE 100000
- #define DIALOG_CREATEGARAGE 600
- #define DIALOG_MOVEGARAGE 601
- #define DIALOG_BUYGARAGE 602
- #define DIALOG_SELLGARAGE 603
- #define DIALOG_PARKVEHICLE 604
- enum gInfo {
- gID,
- gOwner[32],
- gUserID,
- gPrice,
- gVirtualID,
- gPickup,
- Text3D:garageLabel,
- Float:gPos[3],
- Float:gAngle
- };
- new Float: garageCamera[10][3] = {
- {489.4090, -407.8293, 2759.0259},
- {487.9755, -413.0212, 2758.8210},
- {488.2816, -417.9112, 2759.0208},
- {487.9942, -422.5949, 2758.6604},
- {488.0660, -427.1760, 2758.8335},
- {487.4478, -407.2060, 2759.0398},
- {487.2461, -413.1223, 2759.0398},
- {487.0870, -418.3049, 2759.0398},
- {486.8073, -423.0642, 2759.0398},
- {486.5077, -427.8227, 2759.0398}
- };
- new Float: garageCamera_at[10][3] = {
- {488.5297, -407.3569, 2758.8579},
- {487.1125, -412.5193, 2758.7012},
- {487.3769, -417.4890, 2758.8955},
- {487.0796, -422.1945, 2758.5706},
- {487.1324, -426.8218, 2758.6987},
- {488.4458, -407.2309, 2758.8540},
- {488.2441, -413.1472, 2758.8540},
- {488.0849, -418.3358, 2758.8540},
- {487.8037, -423.1270, 2758.8589},
- {487.5041, -427.8854, 2758.8589}
- };
- new
- garageInfo[MAX_GARAGES][gInfo], garages,
- PlayerText: BarTD, BarTimer[MAX_PLAYERS], Step[MAX_PLAYERS],
- PlayerText: GaragePTD[3], Text: GarageTD[5];
- hook OnGameModeInit() {
- SetTimer("LoadGarages", 1000, false);
- load_garage_map();
- GarageTD[0] = TextDrawCreate(537.499511, 331.866485, "My Garage");
- TextDrawLetterSize(GarageTD[0], 0.215999, 1.222517);
- TextDrawTextSize(GarageTD[0], 0.000000, 128.000000);
- TextDrawAlignment(GarageTD[0], 2);
- TextDrawColor(GarageTD[0], -1);
- TextDrawUseBox(GarageTD[0], 1);
- TextDrawBoxColor(GarageTD[0], 255);
- TextDrawSetShadow(GarageTD[0], 0);
- TextDrawSetOutline(GarageTD[0], 1);
- TextDrawBackgroundColor(GarageTD[0], 62);
- TextDrawFont(GarageTD[0], 2);
- TextDrawSetProportional(GarageTD[0], 1);
- TextDrawSetShadow(GarageTD[0], 0);
- GarageTD[1] = TextDrawCreate(466.199737, 392.188903, "LD_BEAT:chit");
- TextDrawLetterSize(GarageTD[1], 0.000000, 0.000000);
- TextDrawTextSize(GarageTD[1], 26.000000, 28.000000);
- TextDrawAlignment(GarageTD[1], 1);
- TextDrawColor(GarageTD[1], 255);
- TextDrawSetShadow(GarageTD[1], 0);
- TextDrawSetOutline(GarageTD[1], 0);
- TextDrawBackgroundColor(GarageTD[1], 255);
- TextDrawFont(GarageTD[1], 4);
- TextDrawSetProportional(GarageTD[1], 0);
- TextDrawSetShadow(GarageTD[1], 0);
- GarageTD[2] = TextDrawCreate(586.300292, 392.259368, "LD_BEAT:chit");
- TextDrawLetterSize(GarageTD[2], 0.000000, 0.000000);
- TextDrawTextSize(GarageTD[2], 26.000000, 28.000000);
- TextDrawAlignment(GarageTD[2], 1);
- TextDrawColor(GarageTD[2], 255);
- TextDrawSetShadow(GarageTD[2], 0);
- TextDrawSetOutline(GarageTD[2], 0);
- TextDrawBackgroundColor(GarageTD[2], 255);
- TextDrawFont(GarageTD[2], 4);
- TextDrawSetProportional(GarageTD[2], 0);
- TextDrawSetShadow(GarageTD[2], 0);
- GarageTD[3] = TextDrawCreate(472.366821, 399.140869, "LD_BEAT:left");
- TextDrawLetterSize(GarageTD[3], 0.000000, 0.000000);
- TextDrawTextSize(GarageTD[3], 13.000000, 15.000000);
- TextDrawAlignment(GarageTD[3], 1);
- TextDrawColor(GarageTD[3], 8388827);
- TextDrawSetShadow(GarageTD[3], 0);
- TextDrawSetOutline(GarageTD[3], 0);
- TextDrawBackgroundColor(GarageTD[3], 255);
- TextDrawFont(GarageTD[3], 4);
- TextDrawSetProportional(GarageTD[3], 0);
- TextDrawSetShadow(GarageTD[3], 0);
- TextDrawSetSelectable(GarageTD[3], true);
- GarageTD[4] = TextDrawCreate(594.000183, 398.851959, "LD_BEAT:right");
- TextDrawLetterSize(GarageTD[4], 0.000000, 0.000000);
- TextDrawTextSize(GarageTD[4], 13.000000, 15.000000);
- TextDrawAlignment(GarageTD[4], 1);
- TextDrawColor(GarageTD[4], 8388827);
- TextDrawSetShadow(GarageTD[4], 0);
- TextDrawSetOutline(GarageTD[4], 0);
- TextDrawBackgroundColor(GarageTD[4], 255);
- TextDrawFont(GarageTD[4], 4);
- TextDrawSetProportional(GarageTD[4], 0);
- TextDrawSetShadow(GarageTD[4], 0);
- TextDrawSetSelectable(GarageTD[4], true);
- }
- hook OnPlayerConnect(playerid) {
- BarTD = CreatePlayerTextDraw(playerid, -41.333301, -35.244438, "box");
- PlayerTextDrawLetterSize(playerid, BarTD, 0.000000, 99.100013);
- PlayerTextDrawTextSize(playerid, BarTD, 1125.000000, 0.000000);
- PlayerTextDrawAlignment(playerid, BarTD, 1);
- PlayerTextDrawColor(playerid, BarTD, -1);
- PlayerTextDrawUseBox(playerid, BarTD, 1);
- PlayerTextDrawBoxColor(playerid, BarTD, 0x000000FF);
- PlayerTextDrawSetShadow(playerid, BarTD, 0);
- PlayerTextDrawSetOutline(playerid, BarTD, 0);
- PlayerTextDrawBackgroundColor(playerid, BarTD, 255);
- PlayerTextDrawFont(playerid, BarTD, 1);
- PlayerTextDrawSetProportional(playerid, BarTD, 1);
- PlayerTextDrawSetShadow(playerid, BarTD, 0);
- 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");
- PlayerTextDrawLetterSize(playerid, GaragePTD[0], 0.215999, 1.222517);
- PlayerTextDrawTextSize(playerid, GaragePTD[0], 0.000000, 128.000000);
- PlayerTextDrawAlignment(playerid, GaragePTD[0], 2);
- PlayerTextDrawColor(playerid, GaragePTD[0], -1);
- PlayerTextDrawUseBox(playerid, GaragePTD[0], 1);
- PlayerTextDrawBoxColor(playerid, GaragePTD[0], 67);
- PlayerTextDrawSetShadow(playerid, GaragePTD[0], 0);
- PlayerTextDrawSetOutline(playerid, GaragePTD[0], 1);
- PlayerTextDrawBackgroundColor(playerid, GaragePTD[0], 62);
- PlayerTextDrawFont(playerid, GaragePTD[0], 2);
- PlayerTextDrawSetProportional(playerid, GaragePTD[0], 1);
- PlayerTextDrawSetShadow(playerid, GaragePTD[0], 0);
- GaragePTD[1] = CreatePlayerTextDraw(playerid, 539.432678, 401.889160, "Slot 1 (empty)");
- PlayerTextDrawLetterSize(playerid, GaragePTD[1], 0.221664, 1.006814);
- PlayerTextDrawTextSize(playerid, GaragePTD[1], 0.000000, 105.000000);
- PlayerTextDrawAlignment(playerid, GaragePTD[1], 2);
- PlayerTextDrawColor(playerid, GaragePTD[1], -1);
- PlayerTextDrawUseBox(playerid, GaragePTD[1], 1);
- PlayerTextDrawBoxColor(playerid, GaragePTD[1], 255);
- PlayerTextDrawSetShadow(playerid, GaragePTD[1], 0);
- PlayerTextDrawSetOutline(playerid, GaragePTD[1], 1);
- PlayerTextDrawBackgroundColor(playerid, GaragePTD[1], 62);
- PlayerTextDrawFont(playerid, GaragePTD[1], 2);
- PlayerTextDrawSetProportional(playerid, GaragePTD[1], 1);
- PlayerTextDrawSetShadow(playerid, GaragePTD[1], 0);
- GaragePTD[2] = CreatePlayerTextDraw(playerid, 546.999328, 289.400024, "");
- PlayerTextDrawLetterSize(playerid, GaragePTD[2], 0.000000, 0.000000);
- PlayerTextDrawTextSize(playerid, GaragePTD[2], 65.000000, 73.000000);
- PlayerTextDrawAlignment(playerid, GaragePTD[2], 1);
- PlayerTextDrawColor(playerid, GaragePTD[2], -1);
- PlayerTextDrawSetShadow(playerid, GaragePTD[2], 0);
- PlayerTextDrawSetOutline(playerid, GaragePTD[2], 0);
- PlayerTextDrawBackgroundColor(playerid, GaragePTD[2], 0);
- PlayerTextDrawFont(playerid, GaragePTD[2], 5);
- PlayerTextDrawSetProportional(playerid, GaragePTD[2], 0);
- PlayerTextDrawSetShadow(playerid, GaragePTD[2], 0);
- PlayerTextDrawSetPreviewModel(playerid, GaragePTD[2], 565);
- PlayerTextDrawSetPreviewRot(playerid, GaragePTD[2], 0.000000, 0.000000, 31.000000, 1.000000);
- PlayerTextDrawSetPreviewVehCol(playerid, GaragePTD[2], 1, 1);
- }
- show_garage_tds(playerid) {
- new
- string[128],
- slot = garage_slot(playerid, GetPVarInt(playerid, "garageSlot"));
- if(slot == -1) {
- PlayerTextDrawHide(playerid, GaragePTD[0]);
- PlayerTextDrawHide(playerid, GaragePTD[2]);
- TextDrawHideForPlayer(playerid, GarageTD[0]);
- format(string, sizeof(string), "~g~~h~Slot %d (empty)", GetPVarInt(playerid, "garageSlot")+1);
- PlayerTextDrawSetString(playerid, GaragePTD[1], string);
- PlayerTextDrawShow(playerid, GaragePTD[1]);
- for(new i = 1; i < 5; i++) TextDrawShowForPlayer(playerid, GarageTD[i]);
- }
- else {
- new status[32], idd = PlayerInfo[playerid][pCarKey][slot];
- if(CarInfo[idd][cLock] == 1) status = "Doors: ~r~~h~Locked~w~~h~";
- else status = "Doors: ~g~~h~Unlocked~w~~h~";
- 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]);
- PlayerTextDrawSetString(playerid, GaragePTD[0], string);
- if(CarInfo[idd][Spawned] != 0) format(string, sizeof(string), "Slot %d (%s)", GetPVarInt(playerid, "garageSlot")+1, aVehicleNames[CarInfo[idd][cModel]-400]);
- else format(string, sizeof(string), "~r~Slot %d (%s)", GetPVarInt(playerid, "garageSlot")+1, aVehicleNames[CarInfo[idd][cModel]-400]);
- PlayerTextDrawSetString(playerid, GaragePTD[1], string);
- PlayerTextDrawSetPreviewModel(playerid, GaragePTD[2], CarInfo[idd][cModel]);
- PlayerTextDrawSetPreviewVehCol(playerid, GaragePTD[2], CarInfo[idd][cColorOne], CarInfo[idd][cColorTwo]);
- for(new i = 0; i < 3; i++) PlayerTextDrawShow(playerid, GaragePTD[i]);
- for(new i = 0; i < 5; i++) TextDrawShowForPlayer(playerid, GarageTD[i]);
- }
- return 1;
- }
- hide_garage_tds(playerid) {
- for(new i = 0; i < 3; i++) PlayerTextDrawHide(playerid, GaragePTD[i]);
- for(new i = 0; i < 5; i++) TextDrawHideForPlayer(playerid, GarageTD[i]);
- SetCameraBehindPlayer(playerid);
- TogglePlayerControllable(playerid, 1);
- return 1;
- }
- garage_camera(playerid, now = 0) {
- new last = GetPVarInt(playerid, "lastGarage");
- SetPVarInt(playerid, "lastGarage", now);
- InterpolateCameraPos(playerid, garageCamera[last][0], garageCamera[last][1], garageCamera[last][2], garageCamera[now][0], garageCamera[now][1], garageCamera[now][2], 2000);
- 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);
- return 1;
- }
- hook OnPlayerSpawn(playerid) {
- if(GetPVarInt(playerid, "inGarage") == 1) {
- SetPVarInt(playerid, "inGarage", 0);
- hide_garage_tds(playerid);
- }
- return 1;
- }
- hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys) { //aici
- if((newkeys & KEY_SECONDARY_ATTACK) && !IsPlayerInAnyVehicle(playerid) || newkeys & KEY_CROUCH) {
- for(new i = 1; i < MAX_GARAGES; i++) {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2]) && garageInfo[i][gUserID] != 0) {
- if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
- if(PlayerInfo[playerid][pWantedLevel] > 0) return SendClientMessage(playerid, COLOR_GRAD3, "Nu poti intra in garaj cand ai wanted!");
- if(GetPVarInt(playerid, "inGarage") != 0) return 1;
- SetPVarInt(playerid, "inGarage", i);
- if(IsPlayerInAnyVehicle(playerid)) {
- if(garageInfo[i][gPrice] > 0) return SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}You can not come with a vehicle if the garage is for sale.");
- if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_GRAD3, "Poti intra doar cu vehiculele personale!");
- if(vehicles_in_garage(playerid) == 10 && vehicle_in_garage(playerid, GetPlayerVehicleID(playerid)) == -1) return 1;
- new slot = vehicle_in_garage(playerid, GetPlayerVehicleID(playerid));
- if(slot == -1) ShowPlayerDialog(playerid, DIALOG_PARKVEHICLE, DIALOG_STYLE_MSGBOX, "Park", "Esti sigur ca vrei sa-l adaugi in garaj?", "Yes", "No");
- else {
- SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculul tau personal a fost adaugat in garaj!");
- SetVehicleVirtualWorld(GetPlayerVehicleID(playerid), i);
- SetVehicleToRespawn(GetPlayerVehicleID(playerid));
- SetPVarInt(playerid, "inGarage", 0);
- }
- }
- else {
- SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}PENTRU A CONTROLA POZITIA FOLOSITI: NUM4(stanga), NUM6(dreapta), Enter(selectare vehicul) si Space (iesire).");
- 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).");
- SendClientMessage(playerid, 0xC90202FF, "(Garage) {FFFFFF}Vehiculele trebuie sa fie spawnate pentru a putea fii vizibile in garaj!");
- SetPlayerPosEx2(playerid, 487.5861,-437.8022,2758.2688);
- SetPlayerVirtualWorld(playerid, i);
- if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
- BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
- SetPVarInt(playerid, "garageSlot", 0);
- show_garage_tds(playerid);
- garage_camera(playerid);
- TogglePlayerControllable(playerid, 0);
- }
- Freezed[playerid] = 1;
- }
- }
- }
- if(newkeys & KEY_SECONDARY_ATTACK) {
- if(GetPVarInt(playerid, "inGarage") != 0 && GetPlayerVirtualWorld(playerid) != 0 && IsPlayerInRangeOfPoint(playerid, 100.0, 487.9106,-431.6140,2757.9956)) {
- new id = GetPVarInt(playerid, "inGarage"), vehid;
- if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) != -1) vehid = CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, GetPVarInt(playerid, "garageSlot"))]][Spawned];
- if(garage_slot(playerid, GetPVarInt(playerid, "garageSlot")) == -1) return SendClientMessage(playerid, COLOR_WARNING, "Nu ai adaugat un vehicul pe acest slot din garaj!");
- else if(GetVehicleVirtualWorld(vehid) == 0) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul a fost scos din garaj deja!");
- else if(vehid == 0 && vehicle_in_garage(playerid, vehid)) return SendClientMessage(playerid, COLOR_WARNING, "Vehiculul nu este spawnat!");
- hide_garage_tds(playerid);
- SetVehiclePos(vehid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
- PutPlayerInVehicle(playerid, vehid, 0);
- SetVehicleZAngleEx(GetPlayerVehicleID(playerid), garageInfo[id][gAngle]);
- SetPlayerVirtualWorld(playerid, 0);
- SetVehicleVirtualWorld(vehid, 0);
- SetPVarInt(playerid, "inGarage", 0);
- if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
- BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
- }
- }
- if(GetPVarInt(playerid, "inGarage") != 0) {
- if(newkeys & KEY_ANALOG_LEFT) {
- // left
- new slot = GetPVarInt(playerid, "garageSlot");
- if(slot == 9) slot = -1;
- SetPVarInt(playerid, "garageSlot", slot+1);
- show_garage_tds(playerid);
- garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
- }
- if(newkeys & KEY_ANALOG_RIGHT) {
- // right
- new slot = GetPVarInt(playerid, "garageSlot");
- if(slot == 0) slot = 10;
- SetPVarInt(playerid, "garageSlot", slot-1);
- show_garage_tds(playerid);
- garage_camera(playerid, GetPVarInt(playerid, "garageSlot"));
- }
- if(newkeys & KEY_SPRINT) {
- hide_garage_tds(playerid);
- new id = GetPVarInt(playerid, "inGarage");
- SetPlayerPosEx2(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
- SetPlayerVirtualWorld(playerid, 0);
- if(BarTimer[playerid]) KillTimer(BarTimer[playerid]);
- BarTimer[playerid] = SetTimerEx("BlackBar", 100, true, "%d", playerid);
- SetPVarInt(playerid, "inGarage", 0);
- TogglePlayerControllable(playerid, 1);
- Freezed[playerid] = 0;
- }
- }
- return 1;
- }
- hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) {
- switch(dialogid) {
- case DIALOG_CREATEGARAGE: {
- if(!response) return 1;
- if(PlayerInfo[playerid][pAdmin] < 7) return 1;
- if(garages >= MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "There are too many garages!");
- new id = garage_id_empty();
- if(id == -1) return SendClientMessage(playerid, COLOR_WARNING, "Error with garage ID!");
- new
- Float: Pos[3],
- Float:Angle,
- query[150];
- GetPlayerFacingAngle(playerid, Angle);
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- 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);
- mysql_tquery(SQL, query, "", "");
- format(garageInfo[id][gOwner], 32, "The State");
- garageInfo[id][gID] = id;
- garageInfo[id][gVirtualID] = id;
- garageInfo[id][gPrice] = GetPVarInt(playerid, "garagePrice");
- garageInfo[id][gPos][0] = Pos[0];
- garageInfo[id][gPos][1] = Pos[1];
- garageInfo[id][gPos][2] = Pos[2];
- garageInfo[id][gAngle] = Angle;
- garageInfo[id][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
- garage_label(id);
- SendClientMessage(playerid, 0xFFA200FF, "You have successfully added a garage!");
- DeletePVar(playerid, "garagePrice");
- }
- case DIALOG_MOVEGARAGE: {
- if(!response) return 1;
- if(PlayerInfo[playerid][pAdmin] < 7) return 1;
- new
- id = GetPVarInt(playerid, "garageID"),
- query[126],
- Float: Pos[3],
- Float: Angle;
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- GetPlayerFacingAngle(playerid, Angle);
- 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);
- mysql_tquery(SQL, query, "", "");
- garageInfo[id][gPos][0] = Pos[0];
- garageInfo[id][gPos][1] = Pos[1];
- garageInfo[id][gPos][2] = Pos[2];
- garageInfo[id][gAngle] = Angle;
- DestroyDynamicPickup(garageInfo[id][gPickup]);
- garageInfo[id][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
- garage_label(id);
- SendClientMessage(playerid, 0xFFA200FF, "You've successfully moved the garage!");
- DeletePVar(playerid, "garageID");
- }
- case DIALOG_BUYGARAGE: {
- if(!response) return 1;
- new id = GetPVarInt(playerid, "garageID");
- if(garageInfo[id][gPrice] == 0) return SendClientMessage(playerid, COLOR_GRAD3, "This garage is not available!");
- if(GetPlayerCash(playerid) < garageInfo[id][gPrice]) return SendClientMessage(playerid, COLOR_GRAD3, "You do not have that amount of money!");
- new string[128];
- GivePlayerCash(playerid, -garageInfo[id][gPrice]);
- if(garageInfo[id][gUserID] != 0) {
- new
- idd = GetPlayerID(garageInfo[id][gOwner]),
- szQuery[128],
- moneys,
- newmoneys;
- if(idd != INVALID_PLAYER_ID) {
- PlayerInfo[idd][pAccount] += garageInfo[id][gPrice];
- 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]));
- format(szQuery,sizeof(szQuery),"UPDATE users SET `Bank`='%d' WHERE `ID`='%d'",PlayerInfo[id][pAccount],PlayerInfo[id][pSQLID]);
- }
- else {
- format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `ID` = '%s'", garageInfo[id][gUserID]);
- new Cache: result = mysql_query(SQL, szQuery);
- if(cache_get_row_count() != 0) {
- cache_get_field_content(0, "Bank", string); moneys = strval(string), newmoneys = moneys + garageInfo[id][gPrice];
- }
- cache_delete(result);
- format(szQuery,sizeof(szQuery),"UPDATE users SET `Bank`='%d' WHERE `ID`='%d'",newmoneys,garageInfo[id][gUserID]);
- }
- SendClientMessage(id, 0x239931FF, string);
- mysql_query(SQL,szQuery);
- }
- format(garageInfo[id][gOwner], 32, GetName(playerid));
- garageInfo[id][gUserID] = PlayerInfo[playerid][pSQLID];
- UpdateGarage_str(id, "Owner", GetName(playerid));
- UpdateGarage_int(id, "UserID", PlayerInfo[playerid][pSQLID]);
- UpdateGarage_int(id, "Price", 0);
- format(string, sizeof(string), "You successfully bought this garage with $%s.", FormatNumber(garageInfo[id][gPrice]));
- SendClientMessage(playerid, COLOR_MONEY, string);
- SendClientMessage(playerid, COLOR_MONEY, "To see your garage commands, use /garagehelp.");
- garageInfo[id][gPrice] = 0;
- garage_label(id);
- DeletePVar(playerid, "garageID");
- }
- case DIALOG_SELLGARAGE: {
- if(!response) return 1;
- if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
- new id = user_garage(playerid);
- format(garageInfo[id][gOwner], 32, "The State");
- garageInfo[id][gUserID] = 0;
- garageInfo[id][gPrice] = 100000;
- UpdateGarage_str(id, "Owner", "The State");
- UpdateGarage_int(id, "UserID", 0);
- UpdateGarage_int(id, "Price", 0);
- garage_label(id);
- GivePlayerCash(playerid, SELL_GARAGE_PRICE);
- SendClientMessage(playerid, COLOR_MONEY, "Ai vandut garajul la stat!");
- }
- case DIALOG_PARKVEHICLE: {
- if(!response) return 1;
- Command_ReProcess(playerid, "parkcar", true);
- SetPVarInt(playerid, "inGarage", 0);
- }
- }
- return 1;
- }
- function garage_id_empty() {
- for(new i = 1; i < MAX_GARAGES; i++) {
- if(garageInfo[i][gID] == 0) return i;
- }
- return -1;
- }
- function user_have_garage(playerid) {
- for(new i = 1; i < MAX_GARAGES; i++) {
- if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return 1;
- }
- return 0;
- }
- function user_garage(playerid) {
- for(new i = 1; i < MAX_GARAGES; i++) {
- if(garageInfo[i][gUserID] == PlayerInfo[playerid][pSQLID]) return i;
- }
- return 0;
- }
- function LoadGarages() {
- new Cache: db = mysql_query(SQL, "SELECT * FROM `garages`");
- new x, result[126];
- for(new i, j = cache_get_row_count (); i != j; ++i) {
- garages ++;
- cache_get_field_content(i, "ID", result); x = strval(result), garageInfo[garages][gID] = x;
- cache_get_field_content(i, "Owner", result); format(garageInfo[x][gOwner], 32, result);
- cache_get_field_content(i, "UserID", result); garageInfo[x][gUserID] = strval(result);
- cache_get_field_content(i, "Price", result); garageInfo[x][gPrice] = strval(result);
- garageInfo[x][gPos][0] = cache_get_field_content_float(i, "X");
- garageInfo[x][gPos][1] = cache_get_field_content_float(i, "Y");
- garageInfo[x][gPos][2] = cache_get_field_content_float(i, "Z");
- garageInfo[x][gAngle] = cache_get_field_content_float(i, "Angle");
- garageInfo[x][gVirtualID] = x;
- garageInfo[x][gPickup] = CreateDynamicPickup(1277, 23, garageInfo[x][gPos][0], garageInfo[x][gPos][1], garageInfo[x][gPos][2]);
- garage_label(x);
- }
- printf("Garages loaded: %d", garages);
- cache_delete(db);
- return 1;
- }
- function UpdateGarage_int(id, varname[], amount) {
- new query[128];
- mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%d' WHERE `ID`='%d'", varname, amount, id);
- mysql_tquery(SQL, query, "", "");
- return 1;
- }
- function UpdateGarage_str(id, varname[], amount[]) {
- new query[128];
- mysql_format(SQL, query, sizeof(query), "UPDATE `garages` SET `%s`='%s' WHERE `ID`='%d'", varname, amount, id);
- mysql_tquery(SQL, query, "", "");
- return 1;
- }
- function vehicles_in_garage(playerid) {
- new x;
- for(new i = 0; i < 10; i++) {
- if(PlayerInfo[playerid][pCarKey][i] != 0 && CarInfo[PlayerInfo[playerid][pCarKey][i]][cVirtual] != 0) x++;
- }
- return x;
- }
- stock SetPlayerPosEx2(playerid, Float:x, Float:y, Float:z) {
- if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) SetVehiclePosEx(playerid, GetPlayerVehicleID(playerid), x, y, z);
- else SetPlayerPos(playerid, x, y, z);
- GetPlayerPos(playerid, LastPos[playerid][0], LastPos[playerid][1], LastPos[playerid][2]);
- Exception[playerid] += 1;
- foreach(Player, i) {
- if(Spectate[i] == playerid) {
- TogglePlayerSpectating(i, 1);
- SetPlayerInterior(i, GetPlayerInterior(playerid));
- SetPlayerVirtualWorld(i, GetPlayerVirtualWorld(playerid));
- if(IsPlayerInAnyVehicle(playerid)) PlayerSpectateVehicle(i, GetPlayerVehicleID(playerid));
- else PlayerSpectatePlayer(i, playerid);
- }
- }
- if(GetPVarInt(playerid, "Undercover") == 1) {
- foreach(Player, i) ShowPlayerNameTagForPlayer(i, playerid, false);
- PlayerTextDrawShow(playerid, UndercoverTD);
- }
- return 1;
- }
- function BlackBar(playerid) {
- switch(Step[playerid]) {
- case 0: PlayerTextDrawBoxColor(playerid, BarTD, 0x000000FF);
- case 1: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000090);
- case 2: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000080);
- case 3: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000070);
- case 4: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000060);
- case 5: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000050);
- case 6: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000040);
- case 7: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000030);
- case 8: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000020);
- case 9: PlayerTextDrawBoxColor(playerid, BarTD, 0x00000010);
- case 10: {
- PlayerTextDrawHide(playerid, BarTD);
- Step[playerid] = 0;
- KillTimer(BarTimer[playerid]);
- return 1;
- }
- }
- PlayerTextDrawShow(playerid, BarTD);
- Step[playerid] ++;
- return 1;
- }
- stock saveCarPark(idd) {
- if(idd == 0) return 1;
- new query[512];
- mysql_format(SQL, query, sizeof(query),
- "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",
- 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],
- CarInfo[idd][cLicense], CarInfo[idd][Userid], CarInfo[idd][cVirtual], idd);
- mysql_tquery(SQL, query, "", "");
- return 1;
- }
- /*
- YCMD:debugsystem(playerid, params[], help) {
- new string[126], model[64];
- format(string, 64, "%d/10 vehicles", vehicles_in_garage(playerid));
- SendClientMessage(playerid, -1, string);
- for(new i = 0; i < 10; i++) {
- if(garage_slot(playerid, i) == -1) model = "None";
- else format(model, sizeof(model), "%s", aVehicleNames[CarInfo[PlayerInfo[playerid][pCarKey][garage_slot(playerid, i)]][cModel]-400]);
- format(string, sizeof(string), "Slot %d - %s", i, model);
- SendClientMessage(playerid, COLOR_WARNING, string);
- }
- return 1;
- }
- */
- function vehicle_in_garage(playerid, carid) {
- new slot = -1;
- for(new i = 0; i < 10; i++) {
- if(CarInfo[PlayerInfo[playerid][pCarKey][i]][Spawned] == carid) {
- new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
- Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
- if(Pos[0] == 481.85 && Pos[1] == -405.426) slot = i;
- else if(Pos[0] == 481.85 && Pos[1] == -410.9) slot = i;
- else if(Pos[0] == 481.85 && Pos[1] == -416.301) slot = i;
- else if(Pos[0] == 481.85 && Pos[1] == -421.104) slot = i;
- else if(Pos[0] == 481.85 && Pos[1] == -425.924) slot = i;
- else if(Pos[0] == 493.998 && Pos[1] == -405.426) slot = i;
- else if(Pos[0] == 493.998 && Pos[1] == -410.9) slot = i;
- else if(Pos[0] == 493.998 && Pos[1] == -416.301) slot = i;
- else if(Pos[0] == 493.998 && Pos[1] == -421.104) slot = i;
- else if(Pos[0] == 493.998 && Pos[1] == -425.924) slot = i;
- }
- }
- return slot;
- }
- function garage_slot(playerid, id) {
- new slot = -1;
- for(new i = 0; i < 10; i++) {
- if(PlayerInfo[playerid][pCarKey][i] != 0) {
- new idd = PlayerInfo[playerid][pCarKey][i], Float: Pos[2];
- Pos[0] = CarInfo[idd][cLocationx], Pos[1] = CarInfo[idd][cLocationy];
- if(Pos[0] == 481.85 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 0) slot = i;
- if(Pos[0] == 481.85 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 1) slot = i;
- if(Pos[0] == 481.85 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 2) slot = i;
- if(Pos[0] == 481.85 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 3) slot = i;
- if(Pos[0] == 481.85 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 4) slot = i;
- if(Pos[0] == 493.998 && Pos[1] == -405.426 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 5) slot = i;
- if(Pos[0] == 493.998 && Pos[1] == -410.9 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 6) slot = i;
- if(Pos[0] == 493.998 && Pos[1] == -416.301 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 7) slot = i;
- if(Pos[0] == 493.998 && Pos[1] == -421.104 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 8) slot = i;
- if(Pos[0] == 493.998 && Pos[1] == -425.924 && !IsPlayerInVehicle(playerid, CarInfo[idd][Spawned]) && id == 9) slot = i;
- }
- }
- return slot;
- }
- garage_label(x) {
- new string[126];
- DestroyDynamic3DTextLabel(garageInfo[x][garageLabel]);
- if(garageInfo[x][gPrice] == 0) format(string, sizeof(string), "Garage %d{C90202}\nGarage Owner: {FFFFFF}%s", x, garageInfo[x][gOwner]);
- 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]));
- 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);
- }
- // Commands with ZCMD
- YCMD:garagehelp(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] >= 7) SendClientMessage(playerid, COLOR_WARNING, "(admins commands) {FFFFFF}/creategarage, /movegarage, /gotogarage.");
- SendClientMessage(playerid, -1, "(garage commands) {FFFFFF}/buygarage, /sellgarage, /sellgaragetostate, /mygarage, /findgarage.");
- return 1;
- }
- YCMD:mygarage(playerid, params[], help) {
- if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
- new string[64];
- format(string, sizeof(string), "Your garage has ID %d. Use /findgarage to locate.", user_have_garage(playerid));
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- YCMD:findgarage(playerid, params[], help) {
- 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");
- new id;
- if(sscanf(params, "i",id)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: {FFFFFF}/findgarage <garage ID>");
- if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- CP[playerid] = 43;
- SetPlayerCheckpointEx(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2], 2.0);
- new string[180];
- 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]));
- SendClientMessage(playerid, COLOR_YELLOW, string);
- return 1;
- }
- YCMD:creategarage(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 7) return 1;
- if(garages >= MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "There are too many garages!");
- new price;
- if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/creategarage <garage price>");
- if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
- SetPVarInt(playerid, "garagePrice", price);
- ShowPlayerDialog(playerid, DIALOG_CREATEGARAGE, DIALOG_STYLE_MSGBOX, "Create garage", "Are you sure you want to add a garage here?", "Yes", "No");
- return 1;
- }
- YCMD:movegarage(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 7) return 1;
- new id;
- if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
- if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- SetPVarInt(playerid, "garageID", id);
- ShowPlayerDialog(playerid, DIALOG_MOVEGARAGE, DIALOG_STYLE_MSGBOX, "Move garage", "Are you sure you want to move that garage here?", "Yes", "No");
- return 1;
- }
- YCMD:gotogarage(playerid, params[], help) {
- if(PlayerInfo[playerid][pAdmin] < 7) return 1;
- new id;
- if(sscanf(params, "i", id)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/movegarage <garage ID>");
- if(id < 1 || id > MAX_GARAGES) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- if(garageInfo[id][gID] != id) return SendClientMessage(playerid, COLOR_GRAD3, "Invalid garage ID!");
- SetPlayerPos(playerid, garageInfo[id][gPos][0], garageInfo[id][gPos][1], garageInfo[id][gPos][2]);
- SetPlayerVirtualWorld(playerid, 0);
- SetPlayerInterior(playerid, 0);
- return 1;
- }
- YCMD:buygarage(playerid, params[], help) {
- if(user_have_garage(playerid) == 1) return SendClientMessage(playerid, COLOR_GRAD3, "You already have a garage!");
- if(PlayerInfo[playerid][pLevel] < 5) return SendClientMessage(playerid, COLOR_WARNING, "You need level 5+ to buy a garage!");
- for(new i = 1; i < MAX_GARAGES; i++) {
- if(IsPlayerInRangeOfPoint(playerid, 2.0, garageInfo[i][gPos][0], garageInfo[i][gPos][1], garageInfo[i][gPos][2])) {
- if(garageInfo[i][gPrice] == 0) return SendClientMessage(playerid, COLOR_GRAD3, "This garage is not available!");
- if(GetPlayerCash(playerid) < garageInfo[i][gPrice]) return SendClientMessage(playerid, COLOR_GRAD3, "You do not have that amount of money!");
- ShowPlayerDialog(playerid, DIALOG_BUYGARAGE, DIALOG_STYLE_MSGBOX, "Buy garage", "Are you sure you want to buy this garage?", "Yes", "No");
- SetPVarInt(playerid, "garageID", i);
- }
- }
- return 1;
- }
- YCMD:sellgarage(playerid, params[], help) {
- if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
- if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
- new price;
- if(sscanf(params, "i", price)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: {FFFFFF}/sellgarage <garage price (0=cancel)>");
- if(price < 1 || price > 100000000) return SendClientMessage(playerid, COLOR_GRAD3, "Error: Invalid price!");
- new id = user_garage(playerid), string[126];
- if(price == 0) SendClientMessage(playerid, COLOR_MONEY, "Garajul tau nu mai este acum de vanzare!");
- else {
- format(string, sizeof(string), "Garajul tau este de vanzare la suma de $%s.", FormatNumber(price));
- SendClientMessage(playerid, COLOR_MONEY, string);
- }
- garageInfo[id][gPrice] = price;
- UpdateGarage_int(id, "Price", garageInfo[id][gPrice]);
- garage_label(id);
- return 1;
- }
- YCMD:sellgaragetostate(playerid, params[], help) {
- if(user_have_garage(playerid) == 0) return SendClientMessage(playerid, COLOR_GRAD3, "You dont have a garage!");
- if(vehicles_in_garage(playerid) > 0) return SendClientMessage(playerid, COLOR_GRAD3, "You can not sell the garage if you have vehicles in the garage.");
- new string[98];
- format(string, sizeof(string), "Are you sure you want to sell the garage to the state for %s?", FormatNumber(SELL_GARAGE_PRICE));
- ShowPlayerDialog(playerid, DIALOG_SELLGARAGE, DIALOG_STYLE_MSGBOX, "Sell garage to state", string, "Yes", "No");
- return 1;
- }
- YCMD:parkcar(playerid, params[], help) {
- new car = GetPlayerVehicleID(playerid);
- if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_GREY, "Nu esti in vehiculul tau.");
- if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "Nu ai un vehicul personal!");
- if(PersonalCar(playerid) == -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu esti in unul dintre vehiculele tale personale!");
- if(GetPlayerState(playerid) != 2) return SCM(playerid, COLOR_LGREEN, "* Trebuie sa fii la volan pentru a putea folosi aceasta comanda!");
- new idd = PersonalCar(playerid);
- new Float: vhp;
- GetVehicleHealth(car, vhp);
- if(vhp < 800) return SendClientMessage(playerid, COLOR_GREY, "Nu poti parca masina cand are sub 800 'viata'!");
- if(PlayerToPoint(150.0, playerid, 1716.9065,-1902.4526,13.5661)) return SCM(playerid, -1, "Nu poti parca o masina in jurul spawn-ului.");
- new Float:x, Float:y, Float:z, Float:a;
- CheckVehicle(CarInfo[idd][Spawned]);
- saveTuning(playerid, CarInfo[idd][Spawned]);
- GetVehiclePos(car, x, y, z);
- GetVehicleZAngle(car, a);
- CarInfo[idd][cVirtual] = 0;
- if(GetPVarInt(playerid, "inGarage") != 0) {
- if(garage_slot(playerid, 0) == -1) x = 481.85, y = -405.426, z = 2758.0046;
- else if(garage_slot(playerid, 1) == -1) x = 481.85, y = -410.9, z = 2758.0046;
- else if(garage_slot(playerid, 2) == -1) x = 481.85, y = -416.301, z = 2758.0046;
- else if(garage_slot(playerid, 3) == -1) x = 481.85, y = -421.104, z = 2758.0046;
- else if(garage_slot(playerid, 4) == -1) x = 481.85, y = -425.924, z = 2758.0046;
- else if(garage_slot(playerid, 5) == -1) x = 493.998, y = -405.426, z = 2758.0046;
- else if(garage_slot(playerid, 6) == -1) x = 493.998, y = -410.9, z = 2758.0046;
- else if(garage_slot(playerid, 7) == -1) x = 493.998, y = -416.301, z = 2758.0046;
- else if(garage_slot(playerid, 8) == -1) x = 493.998, y = -421.104, z = 2758.0046;
- else if(garage_slot(playerid, 9) == -1) x = 493.998, y = -425.924, z = 2758.0046;
- if(x == 481.85) a = -131.1600;
- if(x == 493.998) a = 131.1600;
- CarInfo[idd][cVirtual] = GetPVarInt(playerid, "inGarage");
- SCM(playerid, COLOR_GRAD3, "Your vehicle was parked in the garage.");
- }
- CarInfo[idd][cLocationx] = x;
- CarInfo[idd][cLocationy] = y;
- CarInfo[idd][cLocationz] = z;
- CarInfo[idd][cAngle] = a;
- VehicleOwned[CarInfo[idd][Spawned]] = 0;
- VehicleSQL[CarInfo[idd][Spawned]] = 0;
- DestroyVehicle(car);
- if(CarInfo[idd][cNeon] != 0) {
- DestroyDynamicObject(neon[0][CarInfo[idd][Spawned]]);
- DestroyDynamicObject(neon[1][CarInfo[idd][Spawned]]);
- neon[0][CarInfo[idd][Spawned]] = 0;
- neon[1][CarInfo[idd][Spawned]] = 0;
- }
- if(strlen(CarInfo[idd][cText]) >= 3) {
- DestroyDynamicObject(nameobject[CarInfo[idd][Spawned]]);
- }
- 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);
- SetVehicleVirtualWorld(CarInfo[idd][Spawned], CarInfo[idd][cVirtual]);
- VehicleOwned[CarInfo[idd][Spawned]] = CarInfo[idd][Spawned];
- VehicleSQL[CarInfo[idd][Spawned]] = idd;
- if(CarInfo[idd][cNeon] != 0) {
- new h = CarInfo[idd][Spawned];
- if(CarInfo[idd][cNeon] == 1)
- {
- neon[0][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18648,0,0,0,0,0,0);
- }
- else if(CarInfo[idd][cNeon] == 2)
- {
- neon[0][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18649,0,0,0,0,0,0);
- }
- else if(CarInfo[idd][cNeon] == 3)
- {
- neon[0][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18650,0,0,0,0,0,0);
- }
- else if(CarInfo[idd][cNeon] == 4)
- {
- neon[0][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18652,0,0,0,0,0,0);
- }
- else if(CarInfo[idd][cNeon] == 5)
- {
- neon[0][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18651,0,0,0,0,0,0);
- }
- else if(CarInfo[idd][cNeon] == 6)
- {
- neon[0][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
- neon[1][h] = CreateDynamicObject(18647,0,0,0,0,0,0);
- }
- AttachDynamicObjectToVehicle(neon[0][h], h, -0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
- AttachDynamicObjectToVehicle(neon[1][h], h, 0.8, 0.0, -0.70, 0.0, 0.0, 0.0);
- }
- attach_vip_text(idd);
- SetTunning(idd);
- SetVehicleNumberPlate(CarInfo[idd][Spawned], CarInfo[idd][cLicense]);
- saveCarPark(idd);
- new Float: Pos[3];
- GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
- CarInfo[idd][cLastPos][0] = Pos[0];
- CarInfo[idd][cLastPos][1] = Pos[1];
- CarInfo[idd][cLastPos][2] = Pos[2];
- return 1;
- }
- // objects
- load_garage_map() {
- new suelocochera[1];
- suelocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
- SetObjectMaterial(suelocochera[0], 0, 16150, "ufo_bar", "dinerfloor01_128", 0xFFFFFFFF);
- new paredescochera[4];
- paredescochera[0] = CreateObject(6959,496.7000100,-419.7000100,2742.6001000,0.0000000,91.6560000,359.9730000);
- paredescochera[1] = CreateObject(6959,477.6000100,-418.8999900,2742.6001000,0.0000000,91.6530000,359.9730000);
- paredescochera[2] = CreateObject(6959,497.2999900,-399.6000100,2742.6001000,0.0000000,91.6530000,269.0490000);
- paredescochera[3] = CreateObject(6959,496.5000000,-438.6000100,2742.6001000,0.0000000,91.6480000,269.0440000);
- for(new index=0; index<4; index++) SetObjectMaterial(paredescochera[index], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
- new techocochera[1];
- techocochera[0] = CreateObject(6959,477.0000000,-419.3999900,2762.3000000,0.0000000,0.0000000,0.0000000);
- SetObjectMaterial(techocochera[0], 0, 16150, "ufo_bar", "GEwhite1_64", 0xFFFFFFFF);
- CreateObject(13187,491.7999900,-438.8999900,2758.6001000,0.0000000,0.0000000,88.3620000);
- CreateObject(13187,483.5000000,-438.7999900,2758.6001000,0.0000000,0.0000000,89.6380000);
- CreateObject(2323,488.7000100,-401.2999900,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2306,491.2999900,-401.3999900,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(1730,493.2999900,-400.2000100,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(1518,493.5000000,-400.2999900,2758.7000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2226,491.2999900,-400.2000100,2758.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2229,494.7000100,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2229,492.8999900,-400.1000100,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2297,488.5000000,-400.2000100,2759.3000000,0.0000000,0.0000000,316.4590000);
- CreateObject(2654,490.6000100,-400.2999900,2757.5000000,0.0000000,0.0000000,0.0000000);
- CreateObject(2980,495.1000100,-400.2000100,2758.1001000,0.0000000,0.0000000,0.0000000);
- CreateObject(2614,487.2000100,-400.0000000,2761.3999000,0.0000000,0.0000000,0.0000000);
- CreateObject(2611,492.0000000,-400.1000100,2760.0000000,0.0000000,0.0000000,0.0000000);
- CreateObject(1616,496.8999900,-439.1000100,2762.1001000,0.0000000,0.0000000,0.0000000);
- CreateObject(1584,497.2000100,-404.0000000,2759.5000000,0.0000000,0.0000000,278.3490000);
- CreateObject(1585,478.2000100,-432.3999900,2759.5000000,0.0000000,0.0000000,271.6380000);
- CreateObject(14699,494.0000000,-430.1000100,2760.5000000,0.0000000,0.0000000,92.2040000);
- CreateObject(14699,493.7000100,-420.7000100,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,493.2999900,-410.99900,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,493.2999900,-403.2999900,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,485.7999900,-403.0000000,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,486.1000100,-411.3999900,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,486.7999900,-420.6000100,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(14699,485.7000100,-430.5000000,2760.5000000,0.0000000,0.0000000,92.2030000);
- CreateObject(2502,478.8999900,-400.0000000,2757.3000000,0.0000000,0.0000000,0.0000000);
- CreateObject(19273, 487.68793, -438.88925, 2758.78760, 0.00000, 0.00000, 175.91960);
- CreateObject(19900, 480.10303, -400.07925, 2757.25903, 0.00000, 0.00000, 0.00000);
- CreateObject(19900, 480.74579, -400.07465, 2757.25903, 0.00000, 0.00000, 0.00000);
- CreateObject(19815, 482.35214, -399.79022, 2758.80859, 0.00000, 0.00000, -0.78000);
- CreateObject(11737, 481.59167, -401.42493, 2757.26416, 0.00000, 0.00000, 0.00000);
- CreateObject(2465, 479.12677, -400.20123, 2758.53125, 0.00000, 0.00000, 0.00000);
- CreateObject(19617, 487.34158, -399.89642, 2760.01953, 0.00000, 0.00000, 0.00000);
- CreateObject(19804, 488.39011, -400.00421, 2758.41748, 0.00000, 0.00000, 0.00000);
- CreateObject(19805, 485.45383, -399.87045, 2759.29175, 0.00000, 0.00000, 0.00000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement