local positionVehicles = {
-- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda?
-- salon
{'Admiral', 445, 30, 70000, -1980.67,305.02,35.17, 356.43, 3.95, 266.57},
{'Yosemite', 554, 10, 170000, 2118.07, -1158.29, 24.40, 354.86, 359.24, 299.10},
{'Sandking', 495, 0, 54250, 2117.44, -1153.81, 24.65, 353.60, 4.74, 299.33},
{'Huntley', 579, 30, 250000, 2117.99, -1148.98, 24.17, 355.22, 5.11, 296.24},
{'Jester', 559, 30, 23120, 2136.76, -1146.84, 24.28, 3.33, 354.34, 52.85},
{'Turismo', 451, 30, 700000, 2136.25, -1151.50, 23.82, 2.63, 356.26, 46.18},
{'Sabre', 475, 30, 23120, 2136.25, -1132.28, 25.49, 359.45, 0.24, 69.74},
{'Tahoma', 566, 30, 29320, 2119.83, -1136.90, 24.98, 2.24, 2.90, 286.47},
{'Buffalo', 402, 30, 20000, 2119.57, -1131.54, 25.15, 2.53, 359.56, 291.42},
{'Blade', 536, 30, 320020, 2120.56, -1126.66, 25.14, 1.94, 359.50, 291.48},
{'FCR-900', 521, 30, 29320, 2126.98, -1153.56, 23.55, 359.01, 0.00, 300.22},
}
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\nAby kupi? pojazd wsi?dz na f i wpisz /kuppojazd')
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 PLN.', 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['sw-db']:dbGet('INSERT INTO ogrpg_vehicles (model, frozen, ownedPlayer, parking, fuel) VALUES (?, ?, ?, ?, ?)', model, 0, getElementData(plr,'player:uid'), 1, 15)
outputChatBox('* Zakupi?e? sw?j pojazd, id? do przechowalni (Czarna ci??ar?wka na mapie), i odbierz go..', plr,235,55,215,true)
Timer(function()
destroyElement(blip)
end, 60000*2, 1)
end)