addEvent("kuppojazd", true)
addEventHandler("kuppojazd", root, function(informacje) -- informacje[1] to model, informacje[2] to cena, informacje[3] to przebieg
local nadaj = stworzPojazd(informacje[1], -1897.90, 253.09, 41.05+2)
local account = getPlayerAccount(source)
local wlasciciel = getAccountName(account)
if nadaj then
if account then
if getPlayerMoney(source) >= informacje[2] then
warpPedIntoVehicle ( source, nadaj )
takePlayerMoney(source, informacje[2])
triggerClientEvent(source, "potwierdzKupnoPojazduPrywatnegoR", root)
outputChatBox("Z twojego konta pobrano: "..informacje[2].." za kupno pojazdu o przebiegu: "..informacje[3].."")
setTimer(function(source)
--<<-->>
local query = dbQuery(handler, "INSERT INTO pojazdy (wlasciciel, model, x, y, z, rot, ca, cb, cc, przebieg, paliwo) VALUES (?, ?, ?, ?, ?, ?,?,?,?,?,?)", wlasciciel, id, x, y, z, rot, r, g, b, 50, 0)
local result, num_affected_rows, last_insert_id = dbPoll(query, -1)
local r, g, b = getVehicleHeadLightColor(nadaj)
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", r, g, b)
--<<-->>
ustawDanePojazdu(nadaj, last_insert_id, wlasciciel)
setElementData(nadaj, "pojazdy_przebieg",informacje[3])
end, 1000, 1, source)
else
outputChatBox("Wyst?pi? b??d, nie mo?esz zakupi? tego pojazdu!")
else
outputChatBox("Wyst?pi? b??d, nie mo?esz zakupi? tego pojazdu!")
else
outputChatBox("Wyst?pi? b??d, nie mo?esz zakupi? tego pojazdu!")
end
end
end
end)