polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
jak zrobi? zeby auta kupione w salonie da?o sie tepac za pomoc? thv prosze o pomoc
Salon
Kod: -- TU DODAJESZ POJAZDY
local pojazdy = {}
--pojazdy[id] = {x,y,z,rx,ry,rz,cena,przebieg} - pojazdy do kupienia
pojazdy[562] = { -1944.47,255.93,40.70,359.4,0.0,47.8,2000,math.random(0,0)}
pojazdy[411] = { -1944.83,262.11,40.82,359.2,0,89.2,1500,math.random(0,0)}
pojazdy[560] = { -1944.75,267.97,40.78,359.8,0,86.9,2500,math.random(0,0)}
pojazdy[589] = { -1945.13,274.25,40.69,0,0.0,124.9,2700,math.random(0,0)}
for i,v in pairs(pojazdy) do
setElementData(wystawa,"vopis")
local wystawa = createVehicle(i,v[1],v[2],v[3],v[4],v[5],v[6])
setVehicleDamageProof(wystawa,true)
setElementFrozen(wystawa,true)
setElementData(wystawa,"pojazd_przebieg",v[8])
setElementData(wystawa,"dokupienia",true)
setElementData(wystawa,"cena",v[7])
setVehiclePlateText(wystawa, " SALON")
setVehicleColor(wystawa, 255,255,255, 255,255,255)
addVehicleUpgrade(wystawa, 1073 )
end
function zrespponownie(id)
if pojazdy then
respawnVehicle(pojazdy)
setElementData(wystawa,"vopis")
local wystawa = createVehicle(id,v[1],v[2],v[3],v[4],v[5],v[6])
setVehicleDamageProof(wystawa,true)
setElementFrozen(wystawa,true)
setElementData(wystawa,"pojazd_przebieg",v[8])
setElementData(wystawa,"dokupienia",true)
setElementData(wystawa,"cena",v[7])
setVehiclePlateText(wystawa, " SALON")
setVehicleColor(wystawa, 150, 0, 0, 150, 0, 0 )
addVehicleUpgrade(wystawa, 1073 )
end
end
function kup(plr)
local v = getPedOccupiedVehicle(plr)
if getElementData(v,"dokupienia") then
local id = getElementModel(v)
if pojazdy[id] then
local cena = pojazdy[id][7]
if cena then
if getPlayerMoney(plr) >= cena then
takePlayerMoney(plr, cena)
local przebieg = getElementData(v,"pojazd_przebieg")
local x,y,z = getElementPosition(v)
local rotx,roty,rotz = getElementRotation(v)
local r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 = getVehicleColor(v,true)
local hr,hg,hb = getVehicleHeadLightColor(v)
local account = getPlayerAccount(plr)
local wlasciciel = getAccountName(account)
--<<-->>
local query = dbQuery(handler, "INSERT INTO pojazdy (wlasciciel, model, x, y, z, rot, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, paliwo) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", wlasciciel, id, x, y, z, rotx, r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4, przebieg, 60)
local result, num_affected_rows, last_insert_id = dbPoll(query, -1)
dbExec(handler, "INSERT INTO tuning (id, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, paintjob, hr, hg, hb) VALUES (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", last_insert_id, "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", "3", hr,hg,hb)
--<<-->>
local pojazd = createVehicle(id,-1928.75,275.30,40.71,0,0,180)
warpPedIntoVehicle(plr,pojazd)
local query = dbQuery(handler, "SELECT * FROM pojazdy")
local result, num_rows, errormsg = dbPoll (query, -1)
for i,v in pairs(result) do
setElementRotation(pojazd,0,0,180)
setElementData(pojazd, "pojazdy_paliwo", v["paliwo"] or 100)
setElementData(pojazd, "pojazdy_przebieg", v["przebieg"] or 0)
setVehicleColor(pojazd, v["r1"],v["g1"],v["b1"],v["r2"],v["g2"],v["b2"],v["r3"],v["g3"],v["b3"],v["r4"],v["g4"],v["b4"])
setElementData(pojazd, "car_id", v["id"])
setElementData(pojazd, "car_owner", v["wlasciciel"])
setVehiclePlateText(pojazd, "SF "..v["id"])
setVehicleColor(pojazd, 150, 0, 0, 150, 0, 0 )
addVehicleUpgrade(pojazd, 1096 )
end
setTimer(function()
zrespponownie(id)
end,50,1)
else
outputChatBox("*Nie masz tyle pieni?dzy. Potrzebujesz PLN "..cena,plr,0,0,0,true)
end
end
end
end
end
addCommandHandler("kuppojazd",kup)
komenda thv
Kod: addCommandHandler("thv", function(plr, cmd, vid)
local login = getAccountName ( getPlayerAccount ( plr ) )
if sprawdzRoota(login) or sprawdzAdmina(login) or sprawdzModeratora(login) then
if not tonumber(vid) then return end
for i,v in ipairs(getElementsByType("pojazdy")) do
if getElementData(v, "pojazdy") == tonumber(vid) then
local x,y,z = getElementPosition(plr)
setElementFrozen(v, false)
warpPedIntoVehicle(plr, v)
setElementPosition(v, x,y,z)
setElementInterior(v, getElementInterior(plr))
setElementDimension(v, getElementDimension(plr))
return
end
end
end
outputChatBox("* Nie masz praw do ten kom?dy lub nie znaleziono auta o takim ID!", plr, 255, 0, 0)
end)