Wysłany: 2018-02-10, 17:02
AspWalczak12
Wiek: 46 Na forum: 3113 dni Posty: 33
Witam, ostatnio napotka?em ten poradnik:https://www.youtube.com/watch?v=9PAjNkCaFdU
Stworzy?em baze danych na komputerze, ale co? nie dzia?a....
Consola: https://i.imgur.com/cjBXx9h.png
db3 https://i.imgur.com/IDRwMru.png
Kod db i jak uzupe?ni?em dane.
--[[
Resource : OURGame v2
Developers : Split < split . programista @ gmail . com >
You have no right to use this code without my permission .
( c ) 2015 < split . programista @ gmail . com >. All rights reserved .
]]
-- Settings
DBHandler = nil
DBName = "root"
DBUser = "root"
DBPass = ""
DBHost = "localhost"
-- Functions
function dbSet (...)
if not {...} then return end
local query = dbExec ( DBHandler , ...)
return query
end
function dbGet (...)
if not {...} then return end
-- outputDebugString ( tostring (...))
local query = dbQuery ( DBHandler , ...)
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "share=1" )
if DBHandler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end )
local SQL_LOGIN = "root"
local SQL_PASSWD = ""
local SQL_DB = "root"
local SQL_HOST = "localhost"
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 )
outputDebugString ( tostring ( 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 )
outputDebugString ( tostring ( 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 )
outputDebugString ( tostring ( 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
Za pomoc daje zimne piwko i respekt.
Wysłany: 2018-02-10, 17:16
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Wysłany: 2018-02-10, 17:36
Xrent
-
Wiek: 21 Na forum: 3047 dni Posty: 230
Nick w MP: Pazdam
Piwa : 535
Mo?esz wgra? modu? je?li, nie umiesz to masz kodzik kt?ry zast?pisz ogrpg-db.
-- Settings
DBHandler = nil
DBName = "nazwa_db"
DBUser = "nazwa_db"
DBPass = "has?o"
DBHost = "host"
-- Functions
function dbSet (...)
if not {...} then return end
local query = dbExec ( DBHandler , ...)
return query
end
function dbGet (...)
if not {...} then return end
local query = dbQuery ( DBHandler , ...)
local result = dbPoll ( query , - 1 )
return result
end
addEventHandler ( "onResourceStart" , resourceRoot , function()
DBHandler = dbConnect ( "mysql" , "dbname=" .. DBName .. ";host=" .. DBHost .. "" , DBUser , DBPass , "share=1" )
if DBHandler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end )
+ temat w kt?rym pomaga?em http://gtao.pl/ogrpg-db-54-vt118576.htm
Wysłany: 2018-02-10, 18:47
AspWalczak12
Wiek: 46 Na forum: 3113 dni Posty: 33
Ten kod nie dzia?a, co do instalowania modu?u nie mam folderu x86.
Wysłany: 2018-02-10, 19:48
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
Przeczytaj Sobie. Tam wszystko pisze jak wgra? modu? na windows i linux
Wysłany: 2018-02-11, 09:00
AspWalczak12
Wiek: 46 Na forum: 3113 dni Posty: 33
W instrukcji pisze, ?eby wej?? w folder x64
64 bit: Copy 64 bit mta_mysql.dll into the MTA San Andreas\server\x64\modules
A problem jest taki, ?e w folderze server mam tylko folder mods i dumps
Wysłany: 2018-02-11, 15:20
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
"AspWalczak12" napisał/a :W instrukcji pisze, ?eby wej?? w folder x64
64 bit: Copy 64 bit mta_mysql.dll into the MTA San Andreas\server\x64\modules
A problem jest taki, ?e w folderze server mam tylko folder mods i dumps
A, ja nie widz? problemu, aby stworzy? takowy folder i przekierowa? do niego modu?y.
Wysłany: 2018-02-11, 15:38
AspWalczak12
Wiek: 46 Na forum: 3113 dni Posty: 33
Wysłany: 2018-02-11, 15:46
Ciastuuś
Truck soon...
Wiek: 26 Na forum: 3071 dni Posty: 799
Nick w MP: Ciastuuś
Piwa : 4297
"AspWalczak12" napisał/a :
Nie poprawna data w kolumnie premiumdate. Musi to by? data kt?ra b?dzie oznacza?a zako?czenie dzia?a premium.
Tagi: baza :: danych :: nie :: działa
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: