local positionVehicles = {
-- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda?
-- salon kolo mecha
--{'Manana', 410, 0, 3500, -1956.30,303.71,35.13,359.45,359.99,116.67,0},
--{'Perennial', 404, 0, 4500, -1954.33,297.53,35.20,359.74,0.00,113.08,0},
--{'Vincent', 540, 0, 7000, -1945.11,270.40,35.34,359.73,360.00,60.10,0},
--{'Walton', 478, 0, 3000, -1948.70,262.22,35.46,359.23,360.00,54.27,0},
{'Premier', 426, 0, 25000, -1945.82,271.78,40.89,0.17,0.02,63.72,0},
{'Sabre', 475, 0, 30000, -1947.11,259.18,40.86,359.77,0.00,59.74,0},
{'Buffalo', 402, 0, 35000, -1955.4384765625, 257.8369140625, 40.726757049561},
{'Banshee', 429, 0, 200000, -1956.32,281.10,40.75,360.00,0.00,179.32,0},
{'FCR-900', 521, 0, 200000, -1952.81,300.95,40.62,358.84,0.02,118.47,0},
{'Freeway', 463, 0, 156000, -1951.86,298.25,40.59,359.97,360.00,116.65,0},
{'Wayfarer', 586, 0, 150000, -1951.61,294.66,40.57,359.89,0.00,110.97,0},
{'Quadbike', 471, 0, 200000, -1951.53,291.61,40.53,359.24,0.00,110.73,0},
{'Sadler', 543, 0, 8000, -11957.06, 258.38, 35.15, 359.99, 0.00, 359.91},
--{'Sultan', 560, 0, 90000, -1946.82, 265.10, 40.73, 0.12, 0.00, 60.16},
--{'Elegy', 562, 0, 200000, -1956.93, 265.57, 40.71, 359.99, 359.99, 316.46},
{'Clover', 542, 0, 20000, -1961.04, 271.81, 35.15, 359.95, 359.91, 269.90},
--{'Tahoma', 566, 0, 8500, -1958.71, 265.45, 35.18, 359.82, 0.09, 321.99},
--{'Tampa', 549, 0, 7000, -1962.61, 283.51, 35.18, 359.77, 359.99, 267.93},
{'Moonbeam', 418, 0, 8000, -1962.35, 300.34, 35.57, 0.05, 359.99, 204.89},
{'Savvana', 567, 0, 80000, -1956.04, 273.53, 40.92, 0.46, 0.00, 269.50},
{'Huntley', 579, 0, 280000, -1956.32, 291.83, 40.98, 359.35, 359.92, 180.42},
-- salon luksusowy kolo wody
--{'Infernus', getVehicleModelFromName('Infernus'), 0, 1000000, -1658.306640625, 1213.2265625, 7.25,0,0,250},
--{'Turismo', getVehicleModelFromName('Turismo'), 0, 600000, -1657.6708984375, 1211.0146484375, 13.678089141846,0,0,85},
{'Bullet', getVehicleModelFromName('Bullet'), 0, 600000, -1661.5087890625, 1220.5791015625, 13.671875,0,0,167},
{'Zr-350', getVehicleModelFromName('ZR-350'), 0, 400000, -1672.0947265625, 1205.71484375, 13.671875,0,0,271},
{'Comet', getVehicleModelFromName('Comet'), 0, 400000, -1654.7294921875, 1212.4921875, 21.15625,0,0,70},
{'Super GT', 506, 0, 500000, -1656.283203125, 1205.6123046875, 21.15625,0,0,62},
{'Cheetah', getVehicleModelFromName('Cheetah'), 0, 600000, -1663.01171875, 1221.6904296875, 21.15625,0,0,204}
}
for i,v in pairs(positionVehicles) do
local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
setElementData(veh,'vehicle:desc','Pojazd: '..v[1]..' ('..v[2]..')\nCena: '..v[4]..' PLN\nPrzebieg: '..v[3]..' km')
setVehicleOverrideLights(veh, 1)
setElementFrozen(veh,true)
setVehicleDamageProof(veh, true)
setElementData(veh,'vehicle.selling', true)
veh:setData('vehsell:info', {
['cost']=v[4],
['model']=v[2],
['mileage']=v[3],
['selling']=v[12]
}, false)
end
addEventHandler('onVehicleEnter', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
plr:outputChat('* Pojazd nie jest dost?pny w sprzeda?y.', 255, 0, 0)
return
end
local data=source:getData('vehsell:info')
if not data then return end
plr:setData('vehsell:info', {
['cost']=data.cost,
['model']=data.model,
['mileage']=data.mileage,
}, false)
plr:outputChat('* Aby zakupi? ten pojazd wpisz /kuppojazd')
end)
addEventHandler('onVehicleExit', resourceRoot, function(plr, seat, jacked)
if seat~=0 then return end
local data=plr:getData('vehsell:info')
if not data then return end
plr:removeData('vehsell:info')
end)
addCommandHandler('kuppojazd', function(plr, cmd)
local data=plr:getData('vehsell:info')
if not data then return end
if getPlayerMoney(plr) < data.cost then
outputChatBox('* Nie posiadasz wystarczaj?cej ilo?ci funt?w.', plr, 255, 0, 0)
return
end
local vehicle=plr:getOccupiedVehicle()
if vehicle then
removePedFromVehicle(vehicle)
end
local cost=data.cost
local model=data.model
local mileage=data.mileage
local uid=getElementData(plr,'player:uid') or 0
takePlayerMoney(plr, cost)
exports['MpG-db']:setRekord('INSERT INTO og_vehicles (model, frozen, ownedPlayer, parking, fuel) VALUES (?, ?, ?, ?, ?)', model, 0, getElementData(plr,'player:uid'), 1, 15)
outputChatBox('* Zakupi?e? sw?j pojazd, id? na do niebieskiego samochodu na mapie i odbierz go.', plr,255,255,255,true)
local blip = createBlip(-2057.697265625, 470.173828125, 35.172294616699,55,2,255,255,255,255,0,99999,plr)
Timer(function()
destroyElement(blip)
end, 60000*2, 1)
end)