Jump to content

BaFFyJunior

Membru
  • Posts

    240
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by BaFFyJunior

  1. Salutare! Am un sistem de sleep, am incercat sa pun o variabila(pSleep) pentru a putea folosi acest sistem. De exemplu: daca scri /sleepon sa obosesti si sa trebuiasca sa dormi, daca scri /sleepoff sa poti dezactiva sistemul. Am facut asta, am pus variabila in publicuri, dar nu se mai actualizeaza nivelul de oboseala. Aveti idee de ce? Va rog sa nu sariti pe mine ,sunt incepator. new SleepLevel[MAX_PLAYERS]; new Bar:SleepBar[MAX_PLAYERS]; new PlayerText:SleepScreanTD; new Sleeping[MAX_PLAYERS]; OnPlayerConnect SetTimer("SleepTimer", 60000, true); // 1200000:20 minute SleepLevel[playerid] = 0; OnPlayerSpawn SleepBar[playerid] = CreateProgressBar(548.000000, 58.000000, 58.000000, 3.700000, 16755455, 5); SetProgressBarValue(SleepBar[playerid], SleepLevel[playerid]); ShowProgressBarForPlayer(playerid, SleepBar[playerid]); //=======================================================================================================// CMD:sleepon( playerid, params[ ] ) { gQuery[0]=EOS; if(APlayerData[playerid][Sleep] == 0) { APlayerData[playerid][Sleep] = 1; mysql_format( SQL, gQuery, sizeof( gQuery ), "UPDATE `users` SET `Sleep` = '1' WHERE `Name` = '%s'", GetName( playerid ) ); mysql_query( SQL, gQuery ); } else return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai deja pornit sistemul de sleep!"); return 1; } //=======================================================================================================// CMD:sleepoff( playerid, params[ ] ) { gQuery[0]=EOS; if(APlayerData[playerid][Sleep] == 1) { APlayerData[playerid][Sleep] = 0; mysql_format( SQL, gQuery, sizeof( gQuery ), "UPDATE `users` SET `Sleep` = '0' WHERE `Name` = '%s'", GetName( playerid ) ); mysql_query( SQL, gQuery ); } else return SendClientMessage(playerid, COLOR_LIGHTBLUE, "Ai deja oprit sistemul de sleep!"); return 1; } //=======================================================================================================// OnPlayerLogin APlayerData[ playerid ][ Sleep ] = cache_get_field_content_int( 0, "Sleep", SQL ); //=======================================================================================================// forward SleepTimer(playerid); public SleepTimer(playerid) { for(new i=0;i<MAX_PLAYERS;i++) { if(APlayerData[playerid][Sleep] == 1) { if(IsPlayerConnected(i)) { if(SleepLevel[i] == 5) { SendClientMessage(i, 0xFFFFFF, "{00FF00}[{FFFFFF}SleepSystem{00FF00}]{808080}Ai adormit deoarece esti prea obosit!"); TogglePlayerControllable(i, 0); ApplyAnimation(i,"CRACK","crckdeth2",4.0, 1, 0, 0, 0, 0); GameTextForPlayer(i, "~w~Sleeping....", 5000, 1); SetTimerEx("SleepOutSide", 45000, false, "i", i); Sleeping[i] = 1; return 1; } if(SleepLevel[i] == 4) { SendClientMessage(i, 0xFFFFFF, "{00FF00}[{FFFFFF}SleepSystem{00FF00}]{808080}Atipesti, trage pe partea dreapta a carosabilului la cea mai apropiata benzinarie!"); SleepLevel[i] = 5; SetTimerEx("SleepT3", 1500, false, "i", i); SetProgressBarValue(SleepBar[i], SleepLevel[i]); UpdateProgressBar(SleepBar[i], i); } else { SleepLevel[i] += 1; SetProgressBarValue(SleepBar[i], SleepLevel[i]); UpdateProgressBar(SleepBar[i], i); } } } } return 1; } //=======================================================================================================// forward Sleep2(playerid); public Sleep2(playerid) { if(APlayerData[playerid][Sleep] == 1) { PlayerTextDrawHide(playerid, SleepScreanTD); SleepLevel[playerid] = 0; SetProgressBarValue(SleepBar[playerid], SleepLevel[playerid]); UpdateProgressBar(SleepBar[playerid], playerid); TogglePlayerControllable(playerid, 1); Sleeping[playerid] = 0; SendClientMessage(playerid, 0xFFFFFF, "{00FF00}[{FFFFFF}SleepSystem{00FF00}]{808080} Ai dormit si acum esti revigorat. Iti uram drum bun!"); } return 1; } //=======================================================================================================// forward SleepOutSide(playerid); public SleepOutSide(playerid) { if(APlayerData[playerid][Sleep] == 1) { PlayerTextDrawHide(playerid, SleepScreanTD); SleepLevel[playerid] = 3; SetProgressBarValue(SleepBar[playerid], SleepLevel[playerid]); UpdateProgressBar(SleepBar[playerid], playerid); TogglePlayerControllable(playerid, 1); SetCameraBehindPlayer(playerid); ClearAnimations(playerid); Sleeping[playerid] = 0; SendClientMessage(playerid, 0xFFFFFF, "{00FF00}[{FFFFFF}SleepSystem{00FF00}]{808080} Ai adormit la volan. Inca esti obosit, trage pe partea dreapta la cea mai apropiata benzinarie!"); } return 1; } //=======================================================================================================// forward SleepT3(playerid); public SleepT3(playerid) { if(APlayerData[playerid][Sleep] == 1) { if(SleepLevel[playerid] >= 4) { if(Sleeping[playerid] == 0) { PlayerTextDrawShow(playerid, SleepScreanTD); SetTimerEx("SleepTime4", 10000, false, "i", playerid); } } } return 1; } //=======================================================================================================// forward SleepTime4(playerid); public SleepTime4(playerid) { if(APlayerData[playerid][Sleep] == 1) { if(Sleeping[playerid] == 0) { PlayerTextDrawHide(playerid, SleepScreanTD); SetTimerEx("SleepT3", 10000, false, "i", playerid); } } } //=======================================================================================================//
  2. Salut! Incerc sa fac un sistem dmv ceva mai complex si vreau ca daca nu iti pui centura de siguranta sa pici testul. La inceputul testului sa trebuiasca sa pornesti motorul, altfel sa nu poti incepe testul. Are cineva vreo idee cum as putea face asta? Sunt incepator, nu sariti pe mine. Multumesc anticipat!
  3. La inc/classes/DB.class.php ar trebui sa ai asa ceva: 'driver' => 'mysql', 'host' => '127.0.0.1', 'database' => 'baza1', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', La database iti pui tu baza de date pe care o ai(fie ca esti pe localhost, fie ca esti pe host). Si la index daca esti pe localhost in index.php ar trebui sa ai asa ceva: Config::$_PAGE_URL = 'http://localhost/panelruby(qbit)/'; Trebuie sa iti pui folderul cu panelul in XAMPP -> htdocs, iar dupa numele folderului iti creezi linkul de mai sus. Apoi pornesti XAMPP(Apache si MYSQL) si accesezi linkul de mai sus sau linkul pe care il ai tu. Sper ca ai inteles.
  4. BaFFyJunior

    Help mee

    Adauga codul la OnGamemodeInit sau intr-un filterscript si vezi sa ai pluginul+includeul streamer.
  5. Multumesc, asta era. Se poate da T/C.
  6. Salut! Am trecut un gamemode pe YSI recent. Are cineva vreo idee cum pot pune ca un dialog sa se intoarca la o comanda? Pe zcmd faceam astfel: case DIALOG_PARKVEHICLE: { if(!response) return 1; cmd_park(playerid, ""); } Pe YSI as putea face cumva?
  7. Pentru event ai o variabila(EventMoney): if(EventMoney < 10000 || EventMoney > 500000) return SCM(playerid, -1, "Suma invalida! (10,000-500,000)");
  8. Ar trebui sa ai ceva de genul: if(money < 1000 || money > 100000) return SCM(playerid, COLOR_GREY, "Nu poti juca barbut pe sume mai mari de $100.000 si mai mici de $1.000."); In loc de money poti avea orice, depinde cum ai definit in gamemode. Cat despre sisteme, gasesti tutoriale pe net. Cum a spus si El.Capo, depinde de gamemode.
  9. Incearca new CuratatorCP[MAX_PLAYERS]; Arata-ne linia 1656.
  10. Salutare! Am folosit un gamemode burned acum ceva timp si am incercat azi sa-l deschid(pentru a il mai modifica, sa vad unde am ramas cu el), dar aparent primesc niste erori... Are cineva idee de ce?
  11. Multumesc, am rezolvat. Am avut nevoie de un include totusi(pentru a nu primi eroarea "undefined symbol: SetPlayerGravity". Se poate inchide topicul.
  12. Adica ceva de genul: if(IsPlayerInRangeOfPoint(playerid, 50.0, 1347.93, 1445.73, 37.62)) { SetGravity(0.002); } else return SetGravity(0.008); ar functiona? EDIT: Daca folosesc SetPlayerGravity primesc eroare "symbol not defined".
  13. Am incercat cu IsPlayerInRangeOfPoint, dar nu functioneaza... Alte idei?
  14. Salut! Am incercat sa fac un sistem de racheta(sa ajungi pe luna, etc.). Ei bine, eu as vrea ca in momentul in care racheta ajunge pe luna sa se seteze gravitatia 0.008. Sa fie o functie, gen OnMoon. Are cineva vreo idee cum as putea face asta?
  15. Salut! Am incercat sa implementez un sistem de garaj(cel al lui Edison) pe un gamemode. Am aceste coduri in gamemode: #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_GARAGE1: { if(!response) return ShowPlayerVehicle(playerid); new vsid = sVehicle[5][playerid]; new string[128]; switch(listitem) { case 0: { // info new locktext[15]; if(CarInfo[vsid][cLock] > 0) {locktext = "Locked";} else {locktext = "Unlocked";} 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])); ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Vehicle info", string, "Close", ""); } case 1: { // find if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!"); 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 Float:vehx, Float:vehy, Float:vehz; GetVehiclePos(CarInfo[vsid][Spawned], vehx, vehy, vehz); SetPlayerCheckpointEx(playerid, vehx, vehy, vehz, 3.0); new szZone[128]; GetPlayer3DZone2(vehx, vehy, vehz, szZone, sizeof(szZone)); format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been located and in %s.", aVehicleNames[CarInfo[vsid][cModel]-400], szZone); SendClientMessage(playerid, COLOR_GOLD, string); CP[playerid] = 53; } case 2: { // tow if(GetPlayerCash(playerid) < 1000) return SendClientMessage(playerid, COLOR_GREY, "Nu ai $1000!"); if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!"); if(CarInfo[vsid][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu)."); if(CarInfo[vsid][Spawned] == 0) SpawnPlayerCar(vsid); else { if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!"); SetVehicleToRespawn(CarInfo[vsid][Spawned]); } SetTunning(vsid); GivePlayerCash(playerid, -1000); BizzInfo[19][bBalance] += 1000; mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30); mysql_tquery(SQL, string, "", ""); format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been respawned.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_GOLD, string); } case 3: { // tow if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!"); if(GetPlayerCash(playerid) < 1000) return SendClientMessage(playerid, COLOR_GREY, "Nu ai $1000!"); if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!"); if(CarInfo[vsid][Spawned] != 0) { SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], CarInfo[vsid][cLastPos][0], CarInfo[vsid][cLastPos][1], CarInfo[vsid][cLastPos][2]); } else SpawnPlayerCar(vsid); GivePlayerCash(playerid, -1000); BizzInfo[19][bBalance] += 1000; mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30); mysql_tquery(SQL, string, "", ""); format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been respawned.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_GOLD, string); } case 4: { // despawn & spawn if(CarInfo[vsid][Spawned] == 0) { if(CarInfo[vsid][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu)."); SpawnPlayerCar(vsid); } else { if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!"); if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!"); DestroyPlayerCar(vsid); format(string, sizeof(string), "[Manage vehicle] Your vehicle, %s, has been despawned.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_GOLD, string); } } case 5: { // Debug if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!"); if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!"); if(IsVehicleOccupied(CarInfo[vsid][Spawned])) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau este ocupat!"); 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"); SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], 1688.9471,1306.3896,10.9159); SetVehicleZAngleEx(CarInfo[vsid][Spawned], 359.3103); SetVehicleVirtualWorld(CarInfo[vsid][Spawned], 0); CP[playerid] = 53; if(IsAFLYCar(CarInfo[vsid][Spawned])) { format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_YELLOW, string); SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], -1649.1798, -159.0667, 17.3618); SetVehicleZAngleEx(CarInfo[vsid][Spawned], -44.1000); new randspawn = random(sizeof(HeliVehPos)); SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], HeliVehPos[randspawn][0], HeliVehPos[randspawn][1], HeliVehPos[randspawn][2]); SetVehicleZAngleEx(CarInfo[vsid][Spawned], 44.4000); SetPlayerCheckpointEx(playerid, HeliVehPos[randspawn][0], HeliVehPos[randspawn][1], HeliVehPos[randspawn][2], 5.0); return 1; } else if(IsABOATCar(CarInfo[vsid][Spawned])) { format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_YELLOW, string); new randspawn = random(sizeof(BoatVehPos)); SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], BoatVehPos[randspawn][0], BoatVehPos[randspawn][1], BoatVehPos[randspawn][2]); SetVehicleZAngleEx(CarInfo[vsid][Spawned], -173.4001); SetPlayerCheckpointEx(playerid, BoatVehPos[randspawn][0], BoatVehPos[randspawn][1], BoatVehPos[randspawn][2], 5.0); return 1; } else { format(string, sizeof(string), "Urmareste checkpoint-ul de pe mapa pentru a ajunge la vehiculul tau.", aVehicleNames[CarInfo[vsid][cModel]-400]); SendClientMessage(playerid, COLOR_YELLOW, string); new randspawn = random(sizeof(DealerCarPos)); SetVehiclePosEx(playerid, CarInfo[vsid][Spawned], DealerCarPos[randspawn][0], DealerCarPos[randspawn][1], DealerCarPos[randspawn][2]); SetVehicleZAngleEx(CarInfo[vsid][Spawned], -173.4001); SetPlayerCheckpointEx(playerid, DealerCarPos[randspawn][0], DealerCarPos[randspawn][1], DealerCarPos[randspawn][2], 5.0); return 1; } } case 6: { // sell if(strlen(PlayerInfo[playerid][pPin]) != 0 && PlayerInfo[playerid][pPinLogged] == 0) { SendClientMessage(playerid, COLOR_GREY, "Nu poti folosi aceasta comanda deoarece nu te-ai autentificat cu codul de securitate."); SendClientMessage(playerid, COLOR_GREY, "Pentru a te autentifica, foloseste comanda '/loginpin'!"); return 1; } if(TradeID[playerid] != -1) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta comanda atata timp cat esti implicat intr-o afacere!"); if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!"); //if(CarInfo[vsid][cSpecial] == 1) return SendClientMessage(playerid, -1, "Acces interzis!"); 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."); if(IsAttached(CarInfo[vsid][Spawned])) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu poti folosi aceasta functie momentan!"); new value; value = CarPriceValid(CarInfo[vsid][cModel]) / 2; format(string, sizeof(string), "Esti sigur ca vrei sa-ti vinzi %s pentru %s$ ?",aVehicleNames[CarInfo[vsid][cModel]-400],FormatNumber(value)); ShowPlayerDialog(playerid, DIALOG_SELLCAR, DIALOG_STYLE_MSGBOX, "Dealership", string, "Da", "Nu"); PlayerSellCar[playerid] = vsid; if(CP[playerid] == 43 || CP[playerid] == 53) { CP[playerid] = 0; DisablePlayerCheckpointEx(playerid); } } 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"); case 8: { if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!"); if(valid_vip_vehicle(CarInfo[vsid][cModel]) == 0) return SCM(playerid, COLOR_GREY, "Acest vehicul nu poate fi upgradat!"); if(strlen(CarInfo[vsid][cText]) > 3) return SCM(playerid, -1, "Acest vehicul este deja unul VIP!"); if(PlayerInfo[playerid][pPremiumPoints] < 1008) return SCM(playerid, -1, "Nu ai destule puncte premium."); SetPVarInt(playerid, "VehicleID", vsid); 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"); } case 9: { // rem tunn if(CarInfo[vsid][Spawned] == 0) return SendClientMessage(playerid, COLOR_LGREEN, "Eroare: Vehiculul tau nu este spawnat!"); new car = CarInfo[vsid][Spawned]; if(CarInfo[vsid][mod0] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod0]); if(CarInfo[vsid][mod1] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod1]); if(CarInfo[vsid][mod2] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod2]); if(CarInfo[vsid][mod3] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod3]); if(CarInfo[vsid][mod4] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod4]); if(CarInfo[vsid][mod5] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod5]); if(CarInfo[vsid][mod6] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod6]); if(CarInfo[vsid][mod7] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod7]); if(CarInfo[vsid][mod8] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod8]); if(CarInfo[vsid][mod9] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod9]); if(CarInfo[vsid][mod10] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod10]); if(CarInfo[vsid][mod11] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod11]); if(CarInfo[vsid][mod12] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod12]); if(CarInfo[vsid][mod13] != 0) RemoveVehicleComponent(car,CarInfo[vsid][mod13]); CarInfo[vsid][mod0] = 0; CarInfo[vsid][mod1] = 0; CarInfo[vsid][mod2] = 0; CarInfo[vsid][mod3] = 0; CarInfo[vsid][mod4] = 0; CarInfo[vsid][mod5] = 0; CarInfo[vsid][mod6] = 0; CarInfo[vsid][mod7] = 0; CarInfo[vsid][mod8] = 0; CarInfo[vsid][mod9] = 0; CarInfo[vsid][mod10] = 0; CarInfo[vsid][mod11] = 0; CarInfo[vsid][mod12] = 0; CarInfo[vsid][mod13] = 0; CarInfo[vsid][paintjob] = 3; ChangeVehiclePaintjob(CarInfo[vsid][Spawned], 3); new query[128]; mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod0='%d' WHERE id=%d",CarInfo[vsid][mod0],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod1='%d' WHERE id=%d",CarInfo[vsid][mod1],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod2='%d' WHERE id=%d",CarInfo[vsid][mod2],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod3='%d' WHERE id=%d",CarInfo[vsid][mod3],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod4='%d' WHERE id=%d",CarInfo[vsid][mod4],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod5='%d' WHERE id=%d",CarInfo[vsid][mod5],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod6='%d' WHERE id=%d",CarInfo[vsid][mod6],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod7='%d' WHERE id=%d",CarInfo[vsid][mod7],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod8='%d' WHERE id=%d",CarInfo[vsid][mod8],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod9='%d' WHERE id=%d",CarInfo[vsid][mod9],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod10='%d' WHERE id=%d",CarInfo[vsid][mod10],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod11='%d' WHERE id=%d",CarInfo[vsid][mod11],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod12='%d' WHERE id=%d",CarInfo[vsid][mod12],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET mod13='%d' WHERE id=%d",CarInfo[vsid][mod13],vsid); mysql_tquery(SQL, query, "", ""); mysql_format(SQL, query, sizeof(query), "UPDATE cars SET paintjob='%d' WHERE id=%d",CarInfo[vsid][paintjob],vsid); mysql_tquery(SQL, query, "", ""); } case 10: { if(CarInfo[vsid][Confiscated] == 0) return 1; if(GetPlayerCash(playerid) < CarInfo[vsid][cTax]) return SCM(playerid, -1, "Nu ai suma necesara de bani!"); ShowPlayerDialog(playerid, DIALOG_TAX, DIALOG_STYLE_MSGBOX, "Plateste amenda", "Esti sigur ca vrei sa platesti amenda pentru parcarea neregulamentara?\nDaca consideri ca a fost luata aiurea, cere o dovada pe forum.", "Da", "Nu"); } } } case DIALOG_TOWCAR: { if(!response) return 1; if(GetPlayerCash(playerid) < 50) return SCM(playerid, COLOR_GREY, "Ai nevoie de $50 pentru a respawna un vehicul personal!"); new idd, string[128]; if(PlayerInfo[playerid][pCarKey][listitem] == 0) return 1; else idd = PlayerInfo[playerid][pCarKey][listitem]; if(CarInfo[idd][Confiscated] == 1) return SCM(playerid, -1, "Acest vehicul este confiscat deoarece a fost parcat neregulamentar! Plateste amenda (ultimul rand din meniu)."); GivePlayerCash(playerid, -50); BizzInfo[19][bBalance] += 5000; mysql_format(SQL, string, sizeof(string), "UPDATE bizz SET Till = %d WHERE ID = %d",BizzInfo[19][bBalance],30); mysql_tquery(SQL, string, "", ""); format(string, sizeof(string), "Vehiculul tau, %s, a fost (re)spawnat.", aVehicleNames[CarInfo[idd][cModel]-400]); SendClientMessage(playerid, COLOR_GOLD, string); if(CarInfo[idd][Spawned] != 0) { if(IsVehicleOccupied(CarInfo[idd][Spawned])) return SendClientMessage(playerid, -1, "Vehiculul este ocupat!"); SetVehiclePosEx(playerid, CarInfo[idd][Spawned], CarInfo[idd][cLocationx], CarInfo[idd][cLocationy], CarInfo[idd][cLocationz]); SetVehicleZAngleEx(CarInfo[idd][Spawned], CarInfo[idd][cAngle]); } else SpawnPlayerCar(idd); } 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; cmd_park(playerid, ""); SetPVarInt(playerid, "inGarage", 0); } } return 1; } public OnVehicleSpawn(vehicleid) { CarRadio[vehicleid] = 0; SetVehicleHealth(vehicleid, 999); if(FindSpawnID(vehicleid) != 0) { new carid = FindSpawnID(vehicleid); if(CarInfo[carid][cVirtual] != 0) SetVehicleVirtualWorld(vehicleid, CarInfo[carid][cVirtual]); SetTunning(carid); CarInfo[carid][cTax] += 1500 + random(500); new query[256]; format(query, sizeof(query), "UPDATE `cars` SET `Tax`='%d' WHERE `ID`='%d'", CarInfo[carid][cTax], carid); mysql_query(SQL, query); } else Gas[vehicleid] = 100; SetVehicleColor(vehicleid); if(Carspawn[vehicleid] == vehicleid) { DestroyVehicle(vehicleid); Carspawn[vehicleid] = 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; } stock SpawnPlayerCar(dbid) { new string[180]; new engine,lights,alarm,doors,bonnet,boot,objective; if(dbid != 0) { if(CarInfo[dbid][Confiscated] == 1) return 1; 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); SetVehicleVirtualWorld(CarInfo[dbid][Spawned], CarInfo[dbid][cVirtual]); VehicleOwned[CarInfo[dbid][Spawned]] = CarInfo[dbid][Spawned]; VehicleSQL[CarInfo[dbid][Spawned]] = dbid; attach_vip_text(dbid); if(CarInfo[dbid][cNeon] != 0) { new h = CarInfo[dbid][Spawned]; if(CarInfo[dbid][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[dbid][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[dbid][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[dbid][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[dbid][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[dbid][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); } Gas[CarInfo[dbid][Spawned]] = CarInfo[dbid][cFuel]; GetVehicleParamsEx(CarInfo[dbid][Spawned],engine,lights,alarm,doors,bonnet,boot,objective); SetVehicleParamsEx(CarInfo[dbid][Spawned],0,lights,alarm,CarInfo[dbid][cLock],bonnet,boot,objective); new carid = CarInfo[dbid][Spawned]; if(CarInfo[dbid][mod0] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod0]); if(CarInfo[dbid][mod1] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod1]); if(CarInfo[dbid][mod2] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod2]); if(CarInfo[dbid][mod3] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod3]); if(CarInfo[dbid][mod4] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod4]); if(CarInfo[dbid][mod5] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod5]); if(CarInfo[dbid][mod7] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod7]); if(CarInfo[dbid][mod8] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod8]); if(CarInfo[dbid][mod9] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod9]); if(CarInfo[dbid][mod10] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod10]); if(CarInfo[dbid][mod11] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod11]); if(CarInfo[dbid][mod12] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod12]); if(CarInfo[dbid][mod13] != 0) AddVehicleComponent(carid,CarInfo[dbid][mod13]); SetVehicleNumberPlate(carid,CarInfo[dbid][cLicense]); mysql_format(SQL, string, sizeof(string), "UPDATE cars SET Spawned='%d' WHERE ID=%d", CarInfo[dbid][Spawned], dbid); mysql_tquery(SQL, string, "", ""); } 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 saveCar(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; } /* CMD:debugsystem(playerid, params[]) { 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 CMD:garagehelp(playerid, params[]) { 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; } CMD:mygarage(playerid, params[]) { 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; } CMD:findgarage(playerid, params[]) { 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; } CMD:creategarage(playerid, params[]) { 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; } CMD:movegarage(playerid, params[]) { 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; } CMD:gotogarage(playerid, params[]) { 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; } CMD:buygarage(playerid, params[]) { 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; } CMD:sellgarage(playerid, params[]) { 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; } CMD:sellgaragetostate(playerid, params[]) { 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; } CMD:park(playerid, params[]) { 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]); saveCar(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); } Iar in baza de date acestea: CREATE TABLE `garages` ( `ID` int(11) NOT NULL, `Owner` varchar(25) NOT NULL DEFAULT 'AdmBot', `UserID` int(11) NOT NULL, `Price` int(11) NOT NULL, `Virtual` int(11) NOT NULL, `X` float NOT NULL, `Y` float NOT NULL, `Z` float NOT NULL, `Angle` float NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Ei bine, problema mea este urmatoarea: Cumpar un garaj, totul bine. Dupa ce ma deconectez nu mi se salveaza numele(la Owner) si revine la stat. Aveti idee cum as putea rezolva asta?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.