Witam, mam pewien problem z zapisem pojazd?w.. Wszystko dzia?a?o pinknie, a p??niej cu? si? *****?o i przesta?o. Niestety, aleee nie wiem co jest nie tak.. Dlatego, jakby m?g?by mnie kto? naprowadzi? i wskaza? b??d by?bym wtedy bardzo wdzi?czny i odwdzi?czy? bym si? zimnym piwkiem
B??d z DB3:
[img]https://i.imgur.com/Y9XO2xr.png[/img]
Linijka kodu:
[lua] local query = exports["CRPG-db"]:dbSet(string.format("UPDATE pojazdy SET model='%d', pos='%.2f,%.2f,%.2f,%.2f,%.2f,%.2f', rent='%d',text='%s', health='%d', fuel='%d', mileage='%d', frozen='%d', driver='%s', color='%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d', panelstates='%s', paintjob='%d', tuning='%s', headlights='%d,%d,%d', ownedPlayer='%d' , mk1='%d' , mk2='%d' , mk3='%d', blokada='%s' WHERE id=%d", model, x,y,z, rx,ry,rz, "0",desc, health, fuel, mileage, frozen, driver, c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12, panelstates, paintjob, Tuning, h1,h2,h3, player, mk1, mk2, mk3, tostring(blokada), id))
[/lua]
Ca?a funkcja:
[lua]
function onSaveVehicle(vehicle)
if getElementData(vehicle,"vehicle:spawn") then
-- Setting
local panelstates={}
local model=getElementModel(vehicle)
local health=getElementHealth(vehicle)
local x,y,z=getElementPosition(vehicle)
local rx,ry,rz=getElementRotation(vehicle)
local engine = tostring(calculateNumber(tonumber(getElementData(vehicle,"Pojemnosc:silnika"))))
local desc=g...
[center]Witam, mam malutki problem z systemem pojazd?w. Mianowicie chodzi o to, ?e w exporcie do bazy danych podczas zapisu, wywala mi jaki? z?y argument Prosi?bym o nakierowanie mnie jak owy b??d naprawi?.
[img]https://i.imgur.com/hdwuGm1.png[/img]
Ca?a dana funkcja:
[lua]
function onSaveVehicle(vehicle)
if getElementData(vehicle,"vehicle:spawn") then
-- Setting
local panelstates={}
local model=getElementModel(vehicle)
local health=getElementHealth(vehicle)
local x,y,z=getElementPosition(vehicle)
local rx,ry,rz=getElementRotation(vehicle)
local desc=getElementData(vehicle,"vehicle:desc") or ""
local id=getElementDa...
Dzie? Dobry/Dobry wiecz?r mam pewien problem, a mianowicie podczas rozpocz?cia napadu mimo i? s? SAPD pokazuje, ?e musi by? na s?u?bie przynajmniej jeden SAPD(nic w debugu nie wywala). Drugi b??d jest taki, jak chce rozpocz?? napad i celuje na ped'a wywala taki b??d w debugu: https://imgur.com/a/xDvlL8A
local sx, sy = guiGetScreenSize()
local zoom = 1920/sx
-- // Przydatna funkcja do animacji
local anims, animID = { }, 0
local rendering = false
local function renderAnimations( )
local now = getTickCount( )
for k,v in ipairs(anims) do
v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
if now >= v.start+v.duration then
table.remove(anims, k)
if type(v.onEnd) == "function" then
v.onEnd( )
end
if #anims == 0 then
rendering = false
removeEventHandler("onClientRender", root, renderAnimations)
end
end
end
end
function animate(f, t, easing, duration, onChange, onEnd)
if #anims == 0 and not rendering then
addEventHandler("onClientRender", root, renderAnimations)
rendering = true
end
assert(type(f) == "number", "Bad argument @ 'animate' [expected number at arg...
Teraz zmagam si? z innym problemem.. U?ywam funkcji
[wmta]getElementSpeed[/wmta]
aby pobiera?o mi pr?dko?? elementu i problem polega na tym ?e jak wchodz? do pojazdu to wszystko gra ale jak wysiadam to wyskakuje error. Gdy zn?w wsi?d? wszystko gra gui licznik ale gdy zn?w wysi?d? error razi w oczy..
[code]ERROR: licznikLCDcp_c.lua:8: Bad argument 1 @ getElementSpeed (element expected, got boolean)[/code]
client
linijka zaznaczona ponizej
[lua]
-- https://wiki.multitheftauto.com/wiki/GetElementSpeed
function getElementSpeed(theElement, unit)
assert(isElement(theElement), "Bad argument 1 @ getElementSpeed (element expected, got " .. type(theElement) .. ")") -- lTo jest ta linijka z errorem
local elementType = getElementType(theElement)
assert(elementType == "player" or elementType == "ped" or elementType == "object" or elementType == "vehicle" or elementType == "projectile", "Invalid element type @ getElementSpeed (player/ped/object/vehicle/projectile expected, got " .. elementType .. ")")
assert((unit == nil or type(unit) == "string" or type(unit) == "number") and (unit == nil or (tonumber(unit) and (tonumber(unit) == 0 or tonumber(unit) == 1 or tonumber(unit) == 2)) or unit == "m/s" or unit == "km/h" or unit == "mph"), "Bad argument 2 @ getElementSpeed (invalid speed unit)")
-- Default to m/s...
Witam, mam problem, znalaz?em kod na tym forum, kt?ry dodaje handling do aut..
Nie wiem czy dobrze to zrobi?em, bo nie dzia?a...
Oto Kod:
Zobaczcie... w lua dopiero zaczynam wi?c.. Za pomoc stawiam piwko!
Pozdrawiam,
mlodasny