Facebook
From Subtle Octupus, 1 Year ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 216
  1. createBlip(-1951.68,271.83,35.05, 55,2,0,0,0,0,0,275) -- Salon Sportowy (( Ocean Docks ))
  2. createBlip(-939.35,-521.06,25.83,55,2,0,0,0,0,0,275)
  3. createBlip(-1656.99,1213.66,13.26,55,2,0,0,0,0,0,275)
  4.  
  5. local positionVehicles = {
  6.     -- nazwa, model, przebieg, cena, x,y,z,rx,ry,rz, sprzeda┼╝
  7.     {'Buffalo', 402, math.random(5,15), math.random(180000,210000), -1962.09,271.07,35.15,0.0,0.0,320.1},
  8.    
  9. }
  10. for i,v in pairs(positionVehicles) do
  11.     local veh=createVehicle(v[2], v[5], v[6], v[7], v[8], v[9], v[10], v[11])
  12.     local cena; if type(v[4]) == "table" then cena=(math.random(v[4][1],v[4][2])) else cena = v[4] end
  13.     local przebieg; if type(v[3]) == "table" then przebieg=(math.random(v[3][1],v[3][2])) else przebieg = v[3] end
  14.     setElementData(veh,'vehicle:desc','Pojazd: '..v[1]..'\nCena: '..cena..' PLN\nPojemno┼Ť─ç: 1.6cm3\nPrzebieg: '..przebieg..' km\n\nAby Kupi─ç pojazd wsi─ůdz na F i wpisz /kuppojazd')
  15.     setVehicleOverrideLights(veh, 1)
  16.     setElementFrozen(veh,true)
  17.     setVehicleColor(veh, math.random(0,255),math.random(0,255),math.random(0,255))
  18.     --setVehiclePlateText(veh,Kupmnie)
  19.     setVehicleDamageProof(veh, true)
  20.     setElementData(veh,'vehicle.selling', true)
  21.     veh:setData('vehsell:info', {
  22.         ['cost']=cena,
  23.         ['model']=v[2],
  24.         ['mileage']=przebieg,
  25.         ['selling']=v[12],
  26.         ['id']=i,
  27.     }, false)
  28. end
  29.  
  30. addEventHandler('onVehicleEnter', resourceRoot, function(plr, seat, jacked)
  31.     if seat~=0 then return end
  32.     if source:getData('vehsell:info') and source:getData('vehsell:info').selling==1 then
  33.         plr:outputChat('* Pojazd nie jest dost─Öpny w sprzeda┼╝y.', 255, 0, 0)
  34.         return
  35.     end
  36.  
  37.     local data=source:getData('vehsell:info')
  38.     if not data then return end
  39.  
  40.     plr:setData('vehsell:info', {
  41.         ['cost']=data.cost,
  42.         ['model']=data.model,
  43.         ['mileage']=data.mileage,
  44.     }, false)
  45.  
  46.     plr:outputChat(' Aby zakupi─ç ten pojazd wpisz /kuppojazd')
  47. end)
  48.  
  49. addEventHandler('onVehicleExit', resourceRoot, function(plr, seat, jacked)
  50.     if seat~=0 then return end
  51.  
  52.     local data=plr:getData('vehsell:info')
  53.     if not data then return end
  54.  
  55.     plr:removeData('vehsell:info')
  56. end)
  57.  
  58. addCommandHandler('kuppojazd', function(plr, cmd)
  59.     local data=plr:getData('vehsell:info')
  60.     if not data then return end
  61.  
  62.     if getPlayerMoney(plr) < data.cost then
  63.         triggerClientEvent(plr,"addNotification",root,"Nie posiadasz wystarczajacej kwoty pieni─Ödzy!","error")
  64.         return
  65.     end
  66.  
  67.     local vehicle=plr:getOccupiedVehicle()
  68.  
  69.     local cost=data.cost
  70.     local model=data.model
  71.     local mileage=data.mileage
  72.     local uid=getElementData(plr,'player:uid') or 0
  73.     takePlayerMoney(plr, cost)
  74.     if mileage <= 10000 then
  75.     exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"false")
  76.     else
  77.     exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_vehicles (model,ownedPlayer,mileage,registered,parking) VALUES (?,?,?,?,1)", model, getElementData(plr,"player:uid"),mileage,"true")
  78.     end
  79.     triggerClientEvent(plr,"addNotification",root,string.format("Zakupi┼ée┼Ť sw├│j pojazd "..getVehicleNameFromModel(model)..", znajdziesz go w przechowywalni."),"info")
  80.    
  81.