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
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.
Wysłany: 2018-01-06, 11:55
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
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
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
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 ( DBHandler , stringe )
return query
end
function dbGet (...)
if not {...} then return end
local stringe = dbPrepareString ( DBHandler ,...)
local query = dbQuery ( DBHandler , stringe )
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "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_HOST , SQL_LOGIN , SQL_PASSWD , SQL_DB , SQL_PORT )
if ( not SQL ) then
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 ( keepAlive , 30000 , 0 )
end )
function esc ( value )
return mysql_escape_string ( SQL , value )
end
function pobierzTabeleWynikow ( query )
local result = mysql_query ( SQL , query )
if ( not result ) then
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 result ) then 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 ( result ) then 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 result ) then return nil end
local tabela ={}
while true do
local row = mysql_fetch_row ( result )
if ( not row ) then 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.
Wysłany: 2018-01-06, 14:07
koxpl2x22
MAPPER-ALLEREK
Wiek: 23 Na forum: 4556 dni Posty: 375
Nick w MP: ALLEREK
Piwa : 1726
Poka? nam struktur? tabeli pojazd?w.
Oraz kod s_vehbuy.lua w okolicach linijki 58 (najlepiej 10 najbli?szych linijek+tabele)
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
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 ( veh , color [ 1 ], color [ 2 ], color [ 3 ], color [ 4 ], color [ 5 ], color [ 6 ], color [ 7 ], color [ 8 ], color [ 9 ], color [ 10 ], color [ 11 ], color [ 12 ])
setVehicleHeadLightColor ( veh , lights [ 1 ], lights [ 2 ], lights [ 3 ])
if vehicle [ "plateText" ] ~= "" then
setVehiclePlateText ( veh , vehicle [ "plateText" ])
else
if tonumber ( vehicle [ "id" ]) < 10001 then
setVehiclePlateText ( veh , tostring ( "L " .. vehicle [ "id" ]))
else
setVehiclePlateText ( veh , tostring ( "R " .. vehicle [ "id" ]))
end
end
setElementFrozen ( veh , ( vehicle [ "frozen" ]) > 0 )
if vehicle [ "paintjob" ] ~= 3 then
setVehiclePaintjob ( veh , vehicle [ "paintjob" ])
end
Struktura tabeli:
CREATE TABLE ` ogrpg_vehicles ` (
` id ` int ( 11 ) NOT NULL ,
` model ` int ( 11 ) NOT NULL DEFAULT '411' ,
` frozen ` int ( 11 ) NOT NULL DEFAULT '0' ,
` pos ` varchar ( 82 ) NOT NULL DEFAULT '0, 0, 0, 0, 0, 0' ,
` health ` int ( 11 ) NOT NULL DEFAULT '1000' ,
` fuel ` int ( 11 ) NOT NULL DEFAULT '100' ,
` mileage ` int ( 11 ) NOT NULL DEFAULT '0' ,
` driver ` text NOT NULL ,
` color ` varchar ( 50 ) NOT NULL DEFAULT '255, 255, 255' ,
` headlights ` varchar ( 41 ) NOT NULL DEFAULT '255, 255, 255' ,
` paintjob ` tinyint ( 1 ) NOT NULL DEFAULT '3' ,
` tuning ` text NOT NULL ,
` panelstates ` text NOT NULL ,
` rent ` varchar ( 255 ) CHARACTER SET utf32 COLLATE utf32_bin DEFAULT '0' ,
` plateText ` text NOT NULL ,
` ownedGroup ` varchar ( 111 ) CHARACTER SET ascii COLLATE ascii_bin NOT NULL DEFAULT '0' ,
` ownedPlayer ` int ( 11 ) NOT NULL DEFAULT '0' ,
` parking ` int ( 11 ) NOT NULL DEFAULT '0' ,
` neon ` int ( 11 ) NOT NULL DEFAULT '0' ,
` blokada ` text NOT NULL ,
` registered ` varchar ( 10 ) NOT NULL DEFAULT 'true' ,
` text ` text CHARACTER SET utf32 COLLATE utf32_polish_ci NOT NULL ,
` silnik ` text ,
` gaz ` float NOT NULL ,
` GazZamont ` text ,
` zawieszenie ` text ,
` drzwi ` text ,
` licznik ` text
) 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.
Wysłany: 2018-01-06, 15:28
koxpl2x22
MAPPER-ALLEREK
Wiek: 23 Na forum: 4556 dni Posty: 375
Nick w MP: ALLEREK
Piwa : 1726
w strukturze nie ma wog?le
'firstowner'
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
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.
Tagi: niezapisywanie :: właściciela :: pojazdu
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: