Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2018-01-06, 00:14


Dawidos.

Vice Admin






Wiek: 26
Na forum: 3584 dni
Posty: 448
SPONSOR
Nick w MP: Dawidos

Piwa: 288

Respekt: 475,3
Respekt: 475,3


   Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną.
Cze??. Chcia?em si? zapyta? jak mo?na naprawi? to, ?e nie zapisuje mi w bazie danych w?a?ciciela pojazdu i przy okazji tego kupowanego pojazdu. Dzieje si? tak ,?e w chwili pr?by zakupu pojazdu w salonie to wywala mnie z pojazdu. Pojawiaj? si? taki error i taki warning:

Kod:

[23] WARNING: [23:36] WARNING: [skrypty_glowne]/ogrpg-db/s_db.lua:19: dbExec failed; (1054) Unknown column 'firstowner' in 'field list'
[23] ERROR: [skrypty_glowne]/ogrpg-vehicles/s_vehbuy.lua:58: bad argument #1 to 'pairs' (table expected, got boolean)

By?bym wielce wdzi?czny za pomoc.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-01-06, 11:55


Atroth







Wiek: 23
Na forum: 3677 dni
Posty: 1089
Nick w MP: Atroth

Piwa: 4808

Respekt: 540
Respekt: 540

Podaj kod, w pierwszym debugu nie znaleziono kolumny "firstowner".

Podpis

Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Dawidos.
Wysłany: 2018-01-06, 13:53


Dawidos.

Vice Admin






Wiek: 26
Na forum: 3584 dni
Posty: 448
SPONSOR
Nick w MP: Dawidos

Piwa: 288

Respekt: 475,3
Respekt: 475,3


   Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną.
-- Settings
DBHandler=nil
DBName="xxxxxxxx"
DBUser="xxxxxxxx"
DBPass="xxxxxxxx"
DBHost="xxxxxxxx"

-- Functions
function dbSet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbExec(DBHandlerstringe)
    return query
end

function dbGet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbQuery(DBHandlerstringe)
    local result=dbPoll(query, -1)
    return result
end


addEventHandler("onResourceStart"resourceRoot, function()
    DBHandler=dbConnect("mysql""dbname="..DBName..";host="..DBHost..""DBUserDBPass"share=1;autoreconnect=1")
    if DBHandler then
        outputDebugString("* Connect to server MYSQL...")
        dbSet("SET NAMES utf8")
    else
        outputDebugString("* No Connecting to server MYSQL..")
    end
end)


local SQL_LOGIN="xxxxxxxx"
local SQL_PASSWD="xxxxxxxx"
local SQL_DB="xxxxxxxx"
local SQL_HOST="xxxxxxxx"
local SQL_PORT=3306

local root getRootElement()

local SQL

local function connect()
    SQL mysql_connect(SQL_HOSTSQL_LOGINSQL_PASSWDSQL_DBSQL_PORT)
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        --mysql_query(SQL,"SET NAMES utf8")
        --outputServerLog("Modul mysql polaczony!")
    end

end


local function keepAlive()
    if (not mysql_ping(SQL)) then
        outputServerLog("Zerwane polaczenie z baza danych, nawiazywanie...")
        connect()
    end
end
addEventHandler("onResourceStart",getResourceRootElement(),function()
    connect()
    setTimer(keepAlive300000)
end)

function esc(value)
    return mysql_escape_string(SQL,value)
end

function pobierzTabeleWynikow(query)
    local result=mysql_query(SQL,query)
    if (not resultthen
        outputDebugString("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        outputServerLog("mysql_query failed: (" .. mysql_errno(SQL) .. ") " .. mysql_error(SQL))
        return nil
    end
    local tabela={}
    for result,row in mysql_rows_assoc(result) do
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end

function pobierzWyniki(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    row mysql_fetch_assoc(result)
    mysql_free_result(result)
    return row
end


function zapytanie(query)
    local result=mysql_query(SQL,query)
    if (resultthen mysql_free_result(result) return true end
    return
end

function insertID()
    return mysql_insert_id(SQL)
end

function affectedRows()
    return mysql_affected_rows(SQL)
end


function fetchRows(query)
    local result=mysql_query(SQL,query)
    if (not resultthen return nil end
    local tabela={}

    while true do
        local row mysql_fetch_row(result)
        if (not rowthen break end
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end


function getSQLLink()
    return SQL
end


Prosz?. A i zapomnia?em doda?, ?e ten problem wyst?pi? w paczce It's Your World z oko?o lipca 2017 roku, problem si? pojawi?, gdy serwer si? wy??czy?, a po ponownym w??czeniu go napotka?em wcze?niej wspomniany problem.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-01-06, 14:07


koxpl2x22

MAPPER-ALLEREK






Wiek: 23
Na forum: 4556 dni
Posty: 375
Nick w MP: ALLEREK

Piwa: 1726

Respekt: 142,5
Respekt: 142,5

Poka? nam struktur? tabeli pojazd?w.
Oraz kod s_vehbuy.lua w okolicach linijki 58 (najlepiej 10 najbli?szych linijek+tabele)

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Dawidos.
Wysłany: 2018-01-06, 14:33


Dawidos.

Vice Admin






Wiek: 26
Na forum: 3584 dni
Posty: 448
SPONSOR
Nick w MP: Dawidos

Piwa: 288

Respekt: 475,3
Respekt: 475,3


   Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną.
Kod tych bli?szych linijek w s_vehbuy.lua:
function onRespawnVehicles(_,id,poss)
    -- Settings (QUERY)
    if id then
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=1 and not(police=1) AND id=?"id)
        query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_vehicles SET parking=0 WHERE id=?"id)
    else
        result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_vehicles WHERE parking=0 and not(police=1)")
    end

    -- Pairs
    for ile,vehicle in pairs(result) do
        vehicles=ile

        if id then pos={poss[1], poss[2], poss[3], poss[4], poss[5], poss[6]}
        else pos=split(vehicle["pos"], ","end

        local color=split(vehicle["color"], ",")
        local lights=split(vehicle["headlights"], ",")

        local veh=createVehicle(vehicle["model"], pos[1], pos[2], pos[3], pos[4], pos[5], pos[6])
        setVehicleColor(vehcolor[1], color[2], color[3], color[4],color[5], color[6], color[7], color[8],color[9], color[10], color[11], color[12])
        setVehicleHeadLightColor(vehlights[1], lights[2], lights[3])
        if vehicle["plateText"] ~= "" then
        setVehiclePlateText(vehvehicle["plateText"])
        else
            if tonumber(vehicle["id"]) < 10001 then
                setVehiclePlateText(vehtostring("L "..vehicle["id"]))
            else
                setVehiclePlateText(vehtostring("R "..vehicle["id"]))
            end
        end
        setElementFrozen(veh, (vehicle["frozen"]) > 0)
        if vehicle["paintjob"] ~= 3 then
        setVehiclePaintjob(vehvehicle["paintjob"])
        end

Struktura tabeli:
CREATE TABLE `ogrpg_vehicles` (
  `idint(11NOT NULL,
  `modelint(11NOT NULL DEFAULT '411',
  `frozenint(11NOT NULL DEFAULT '0',
  `posvarchar(82NOT NULL DEFAULT '0, 0, 0, 0, 0, 0',
  `healthint(11NOT NULL DEFAULT '1000',
  `fuelint(11NOT NULL DEFAULT '100',
  `mileageint(11NOT NULL DEFAULT '0',
  `drivertext NOT NULL,
  `colorvarchar(50NOT NULL DEFAULT '255, 255, 255',
  `headlightsvarchar(41NOT NULL DEFAULT '255, 255, 255',
  `paintjobtinyint(1NOT NULL DEFAULT '3',
  `tuningtext NOT NULL,
  `panelstatestext NOT NULL,
  `rentvarchar(255CHARACTER SET utf32 COLLATE utf32_bin DEFAULT '0',
  `plateTexttext NOT NULL,
  `ownedGroupvarchar(111CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT '0',
  `ownedPlayerint(11NOT NULL DEFAULT '0',
  `parkingint(11NOT NULL DEFAULT '0',
  `neonint(11NOT NULL DEFAULT '0',
  `blokadatext NOT NULL,
  `registeredvarchar(10NOT NULL DEFAULT 'true',
  `texttext CHARACTER SET utf32 COLLATE utf32_polish_ci NOT NULL,
  `silniktext,
  `gazfloat NOT NULL,
  `GazZamonttext,
  `zawieszenietext,
  `drzwitext,
  `liczniktext
ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

Jak co? przepraszam jak ?le zrozumia?em i to nie to wklei?em.

[ Dodano: 2018-01-06, 15:14 ]
Dzi?kuje za ch?? pomocy, ale sam ju? do tego doszed?em g??wnie dzi?ki koxpl2x22, gdy? zauwa?y?em brak niekt?rych tabel, kt?re nie wiem sam kiedy zosta?y usuni?te.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-01-06, 15:28


koxpl2x22

MAPPER-ALLEREK






Wiek: 23
Na forum: 4556 dni
Posty: 375
Nick w MP: ALLEREK

Piwa: 1726

Respekt: 142,5
Respekt: 142,5

w strukturze nie ma wog?le
'firstowner'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-01-06, 15:36


Dawidos.

Vice Admin






Wiek: 26
Na forum: 3584 dni
Posty: 448
SPONSOR
Nick w MP: Dawidos

Piwa: 288

Respekt: 475,3
Respekt: 475,3


   Vice Admin: Jeśli potrzebujesz pomocy w sprawach organizacyjnych lub technicznych - skontaktuj się ze mną.
Tak wiem, ot?? te usuni?cia wydarzy?y si? w czasie, gdy serwer mi si? wy??czy?, a po ponownym dana rzecz ju? nie dzia?a?a, ale dzi?ki twojemu nakierowaniu mnie na to odtworzy?em brakuj?ce rzeczy w strukturze.

Podpis

Użytkownik - 11.08.2016r.
Support-Team - 03.02.2019r.
Test-Mod - 26.03.2019r.
Moderator - 30.04.2019r.
Mod-Team - 03.08.2019r.
Vice Admin - 03.05.2022r.

Postaw piwo autorowi tego posta
 

 
Tagi: niezapisywanie :: właściciela :: pojazdu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Niezapisywanie właściciela pojazdu Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku