--[[ local positionVehicles = { -- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzedaż -- CYGAN {'Tampa', 549, {66000,77000}, {15231,21435}, 1940.80, -1859.74, 13.56+0.1, -0.00, 0.00, 133.26, "1.6"}, {'Bobcat', 422, {66000,77000}, {7000,12000}, 1929.34, -1856.16, 13.56+0.1, -0.00, 0.00, 100.42, "1.4"}, {'Perennial', 404, {66000,77000}, {7000,12000}, 1915.24, -1856.87, 13.56+0.1, -0.00, 0.00, 232.33, "1.2"}, {'Sadler', 543, {66000,77000}, {9000,15000}, 1924.26, -1874.30, 13.55, -0.00, 0.00, 319.73, "1.4"}, {'Bravura', 401, {66000,77000}, {7000,12000}, 1939.26, -1873.41, 13.56+0.1, -0.00, 0.00, 26.64, "1.2"}, -- SALON LS (Motocykle_GLEN_PARK) {'NRG-500', 522, {0,100}, {3100000,3685000}, 2129.66, -1132.95, 25.61, -0.00, 0.00, 40.79, "2.8"}, {'Quad', 471, {0,100}, {70000,80000}, 2135.96, -1128.76, 25.61, -0.00, 0.00, 124.76, "1.2"}, {'Faggio', 462, {0,100}, {10000,12000}, 2126.92, -1151.16, 24.06, -4.26, 9.88, 324.80, "1.2"}, {'Sanchez', 468, {0,100}, {310000,340000}, 2121.04, -1146.18, 24.51, -3.71, 10.13, 298.22, "1.6"}, {'PCJ-600', 461, {0,100}, {675000,720000}, 2120.95, -1141.82, 24.86, -0.44, 9.89, 267.02, "2.0"}, {'Wayfarer', 586, {0,100}, {529000,580000}, 2121.02, -1129.74, 25.39, -0.00, 0.00, 265.84, "1.6"}, {'FCR-900', 521, {0,100}, {920000,980000}, 2120.91, -1135.73, 25.27, -0.00, 0.00, 266.78, "2.2"}, {'Freeway', 463, {0,100}, {410000,474500}, 2119.64, -1125.89, 25.39, -0.00, 0.00, 211.56, "1.4"}, {'BF-400', 581, {0,100}, {580000,595000}, 2136.56, -1133.92, 25.70, -0.00, 0.00, 14.29, "2.0"}, -- SALON LS (NormalCars_OBOK_CEMENTARZA) {'Bullet', 541, {0,100}, {15500000,17000000}, 892.63, -1182.54, 16.98, -0.00, 0.00, 224.76, "3.2"}, {'Admiral', 445, {0,100}, {1200000,1300000}, 905.80, -1183.49, 16.98, -0.00, 0.00, 140.59, "1.8"}, {'Stallion', 439, {0,100}, {785000,850000}, 902.59, -1196.49, 16.98, -0.00, 0.00, 55.79, "1.6"}, {'Feltzer', 533, {0,100}, {2120000,2340000}, 892.12, -1196.34, 16.98, -0.00, 0.00, 36.88, "2.0"}, {'Rancher', 489, {0,100}, {850000,1000000}, 871.21, -1191.54, 16.98, -0.00, 0.00, 244.26, "2.0"}, {'Jester', 559, {0,100}, {3200000,3600000}, 883.00, -1189.36, 16.58+0.3, -0.00, 0.00, 266.12, "2.4"}, {'Sandking', 495, {0,100}, {5130000,5600000}, 862.18, -1198.67, 16.58+0.3, -0.00, 0.00, 266.12, "2.0"}, -- SALON OBOK TUNE LS {'Burrito', 482, {0,100}, {560000,590000}, 2100.93, -2093.09, 13.85, -0.00, 0.00, 302.51, "1.6"}, {'Patriot', 470, {0,100}, {3250000,3570000}, 2108.10, -2087.22, 13.55, -0.00, 0.00, 236.19, "2.4"}, {'Hermes', 474, {0,100}, {1580000,1630000}, 2121.31, -2088.08, 13.55, -0.00, 0.00, 232.20, "1.6"}, --{'Rancher', 489, {0,100}, {15000000,15000000}, 2130.14, -2081.51, 13.55, -0.00, 0.00, 222.95, "2.0"}, {'Oceanic', 467, {0,100}, {380000,422000}, 2140.55, -2080.67, 13.55, -0.00, 0.00, 144.52, "1.4"}, {'Previon', 436, {0,100}, {300000,350000}, 2141.03, -2092.82, 13.85, -0.00, 0.00, 61.31, "1.2"}, -- ROWERY {'BMX', 481, {12000,12100}, {8000,10000}, 1917.62, -1414.07, 13.17, -0.00, 0.00, 78.06, "brak"}, --BMX NA SKATEPARK'u {'Rower', 509, {12000,12100}, {3000,6500}, 1349.52, -1757.93, 13.11, -0.00, 0.00, 293.64, "brak"}, --- ROWER ZWYKLY w miescie jest {'Rower Górski', 510, {12000,12100}, {10000,18000}, -2232.60, -1738.09, 480.84, -0.00, 0.00, 332.16, "brak"}, --ROWER GORSKI jest na MC } --]] function init() local q=exports["ogrpg-db"]:dbSet("select * from iyw_salon") for i,v in ipairs(q) do local q2=exports["ogrpg-db"]:dbSet("select * from Rozpis_pojemnosci where model=?", v.model) loadveh(v,q2) end end function initid(id) local q=exports["ogrpg-db"]:dbSet("select * from iyw_salon where id=?", id) for i,v in ipairs(q) do local q2=exports["ogrpg-db"]:dbSet("select * from Rozpis_pojemnosci where model=?", v.model) loadveh(v,q2) end end --x,y,z,rx,ry,rz,dim,int function loadveh(v,q) if not q or #q < 1 then capacity="1.2" else capacity=q[1].capacity end local pos=split(v.pos, ",") local vehicle=Vehicle(v.model,pos[1],pos[2],pos[3],pos[4],pos[5],pos[6],"SALON") vehicle.dimension = pos[7] vehicle.interior = pos[8] vehicle:setData("vehicle:for:sale", true) vehicle.engineState = false vehicle.overrideLights = 2 vehicle.damageProof = true vehicle.frozen = true vehicle.locked = true vehicle:setData("salon:dbid", v.id) exports["iyw_vehtexts"]:add3DTextForElement(vehicle,{0,0,0},vehicle.name.."\nPOJAZD NA SPRZEDAŻ!\n\nAby ujrzeć wszelkie informacje na temat\ntego pojazdu, podejdź bliżej.",{255,255,255,255},"czcionka4",1.0,30,1) local cena; if type(v.koszt) == "table" then cena = (math.random(v.koszt[1], v.koszt[2])) else cena = v.koszt end local przebieg; if type(v.przebieg) == "table" then przebieg = (math.random(v.przebieg[1], v.przebieg[2])) else przebieg = v.przebieg end if v.model == 481 then cuboid = ColShape.Cuboid(pos[1]-2.90, pos[2]-1.7, pos[3]-1.10, 6, 4, 5) else cuboid = ColShape.Cuboid(pos[1]-2.90, pos[2]-1.7, pos[3]-0.60, 6, 4, 5) end vehicle:setData("vehicle_mileage", przebieg) cuboid:setData("cuboid:car_dealership", { ["veh"] = vehicle, ["vehicle"] = vehicle.model, ["vehicle_cost"] = tonumber(cena), ["vehicle_mileage"] = przebieg, ["vehicle_drivetype"] = getVehicleHandling(vehicle).driveType, ["vehicle_capacity"] = capacity }) vehicle:setData("salon:cuboid", cuboid) end addEvent("buyVehicle", true) addEventHandler("buyVehicle", resourceRoot, function(model, mileage, cost, capacity) cost=tonumber(cost) if model and mileage and cost then if cost <= client.money then local uid = client:getData("player:uid") if not uid then return false end client:takeMoney(cost) triggerClientEvent(client, "onClientAddNotification", client, "Zakupiłeś(aś) pojazd prywatny, znajdziesz go w przechowalni pojazdów.", "success") exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model, ownedPlayer, firstowner, mileage, parking, capacity) VALUES (?,?,?,?,1,?)", model, uid, client.name, mileage, capacity) else triggerClientEvent(client, "onClientAddNotification", client, "Nie posiadasz wystarczajacej kwoty pieniędzy!\n(Brakuje Ci: "..string.format("%.02fPLN", cost-client.money)..")", "error") end end end) function salon(plr,cmd,arg1,arg2,arg3) if exports['dutyadmin']:getAdmin(plr,4) and plr:getData("player:uid") or plr:getData("player:uid") == 4 then if arg1 == "edytuj" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon edytuj ", 255, 0, 0) return end local pojazdy=getElementsByType("vehicle", resourceRoot) for i,v in ipairs(pojazdy) do if tonumber(v:getData("salon:dbid")) == tonumber(arg2) then warpPedIntoVehicle(plr, v) v.frozen = false plr:outputChat("/salon (edytuj,stworz,usun,cena,model,przebieg,zapisz,rz)", 255, 0, 0) end end elseif arg1 == "stworz" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon stworz ", 255, 0, 0) return end local veh2=Vehicle(arg2,-1959.70, 263.83, 35.47,0,0,180) if not veh2 then plr:outputChat("Nieprawidłowy pojazd!", 255, 0, 0) return end warpPedIntoVehicle(plr,veh2) plr:outputChat("Aby wyrównać rotacje pojazdu użyj /salon rz ", 0, 255, 0) plr:outputChat("Aby wprowadzić pojazd do systemu - wyjdź z pojazdu.", 255, 0, 0) veh2.locked = true veh2.engineState = true addEventHandler("onVehicleStartExit", veh2, function() local x,y,z=getElementPosition(veh2) local rx,ry,rz=getElementRotation(veh2) local int=veh2.interior local dim=veh2.dimension local posformat=x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..dim..", "..int local _,_,lastid=exports["ogrpg-db"]:dbSet("insert into iyw_salon (pos,model,koszt,przebieg) VALUES(?,?,?,?)", posformat, veh2.model, 9999999999, 9999999) veh2:destroy() initid(lastid) end) elseif arg1 == "usun" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon usun ", 255, 0, 0) return end local pojazdy=getElementsByType("vehicle", resourceRoot) for i,v in ipairs(pojazdy) do if tonumber(v:getData("salon:dbid")) == tonumber(arg2) then exports["ogrpg-db"]:dbSet("delete from iyw_salon where id=?", v:getData("salon:dbid")) v:getData("salon:cuboid"):destroy() v:destroy() end end elseif arg1 == "cena" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon cena ", 255, 0, 0) return end local veh=plr.vehicle if not veh or not veh:getData("salon:dbid") then plr:outputChat("Nie jesteś w pojeździe salonowym!", 255, 0, 0) return end local cuboid2=veh:getData("salon:cuboid") local cuboid=cuboid2:getData("cuboid:car_dealership") cuboid2:setData("cuboid:car_dealership", { ["veh"] = cuboid["veh"], ["vehicle"] = cuboid["vehicle"], ["vehicle_cost"] = arg2, ["vehicle_mileage"] = cuboid["vehicle_mileage"], ["vehicle_drivetype"] = cuboid["vehicle_drivetype"], ["vehicle_capacity"] = cuboid["vehicle_capacity"] }) exports["ogrpg-db"]:dbSet("update iyw_salon set koszt=? where id=?", arg2, veh:getData("salon:dbid")) plr:outputChat("Cena pojazdu została zmieniona na "..arg2.." PLN", 0, 255, 0) elseif arg1 == "model" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon model ", 255, 0, 0) return end local veh=plr.vehicle if not veh or not veh:getData("salon:dbid") then plr:outputChat("Nie jesteś w pojeździe salonowym!", 255, 0, 0) return end local model=veh:setModel(arg2) if model then local cuboid2=veh:getData("salon:cuboid") local cuboid=cuboid2:getData("cuboid:car_dealership") local q=exports["ogrpg-db"]:dbGet("select * from Rozpis_pojemnosci where model=?", arg2)[1] if not q then capacity="1.2" else capacity=q.capacity end cuboid2:setData("cuboid:car_dealership", { ["veh"] = cuboid["veh"], ["vehicle"] = arg2, ["vehicle_cost"] = cuboid["vehicle_cost"], ["vehicle_mileage"] = cuboid["vehicle_mileage"], ["vehicle_drivetype"] = cuboid["vehicle_drivetype"], ["vehicle_capacity"] = capacity }) exports["ogrpg-db"]:dbSet("update iyw_salon set model=? where id=?", arg2, veh:getData("salon:dbid")) plr:outputChat("Model pojazdu został zmieniony na "..arg2.."", 0, 255, 0) exports["iyw_vehtexts"]:add3DTextForElement(veh,{0,0,0},getVehicleNameFromModel(arg2).."\nPOJAZD NA SPRZEDAŻ!\n\nAby ujrzeć wszelkie informacje na temat\ntego pojazdu, podejdź bliżej.",{255,255,255,255},"czcionka4",1.0,30,1) else plr:outputChat("Nie znaleziono takiego modelu!", 255, 0, 0) end elseif arg1 == "przebieg" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon przebieg ", 255, 0, 0) return end local veh=plr.vehicle if not veh or not veh:getData("salon:dbid") then plr:outputChat("Nie jesteś w pojeździe salonowym!", 255, 0, 0) return end local cuboid2=veh:getData("salon:cuboid") local cuboid=cuboid2:getData("cuboid:car_dealership") cuboid2:setData("cuboid:car_dealership", { ["veh"] = cuboid["veh"], ["vehicle"] = cuboid["vehicle"], ["vehicle_cost"] = cuboid["vehicle_cost"], ["vehicle_mileage"] = arg2, ["vehicle_drivetype"] = cuboid["vehicle_drivetype"], ["vehicle_capacity"] = cuboid["vehicle_capacity"] }) exports["ogrpg-db"]:dbSet("update iyw_salon set przebieg=? where id=?", arg2, veh:getData("salon:dbid")) plr:outputChat("Przebieg pojazdu został zmieniony na "..arg2.." KM", 0, 255, 0) elseif arg1 == "rz" then if not arg2 or not tonumber(arg2) then plr:outputChat("Użycie: /salon rz ", 255, 0, 0) return end local veh=plr.vehicle if not veh then plr:outputChat("Nie jesteś w pojeździe!", 255, 0, 0) return end for i,v in ipairs(getElementsByType("vehicle"), resourceRoot) do if v == veh then local rx,ry,rz = getElementRotation(veh) setElementRotation(veh,rx,ry,arg2) end end plr:outputChat("Aby zapisać pojazd użyj /salon zapisz", 0, 255, 0) elseif arg1 == "zapisz" then local veh=plr.vehicle if not veh or not veh:getData("salon:dbid") then plr:outputChat("Nie jesteś w pojeździe salonowym!", 255, 0, 0) return end local x,y,z=getElementPosition(veh) local rx,ry,rz=getElementRotation(veh) local int=veh.interior local dim=veh.dimension local posformat=x..", "..y..", "..z..", "..rx..", "..ry..", "..rz..", "..dim..", "..int exports["ogrpg-db"]:dbSet("update iyw_salon set pos=? where id=?", posformat, veh:getData("salon:dbid")) restartResource(getThisResource()) else plr:outputChat("Użycie: /salon (edytuj,stworz,usun,cena,model,przebieg,zapisz,rz)", 255, 0, 0) end end end addCommandHandler("salon", salon) addEventHandler("onVehicleStartEnter", resourceRoot, function(player, seat) if source:getData("vehicle:for:sale") then cancelEvent() end end) init()