Wysłany: 2017-01-04, 18:50
MarkiusSK
Wiek: 31 Na forum: 3687 dni Posty: 3
Nick w MP: Marek762001
Please help me, I have got 1 script where is everything from gamemode ( It is database ) and how to connect it with my database online ( dbadmin.sk I can give you password and you can do it please ) But when I click to IMPORT and take this file ERROR and when I click to database and copy this text there ERROR
Wysłany: 2017-01-04, 18:59
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
Is polish mta forum u could use https://forum.mtasa.com/ ,but i think is http://dbadmin.sk/ bug. U must call to support of this web.
This is script to sql connect and functions:
local SQL
local function connect ()
-- w ponizszej linii uzupelnij dane autoryzacji
SQL = dbConnect ( "mysql" , "dbname=xxx;host=xxx" , "xxx" , "xxx" , "share=1" )
if ( not SQL ) then
outputServerLog ( "BRAK POLACZENIA Z BAZA DANYCH!" )
else
outputDebugString ( "DB PASS" )
zapytanie ( "SET NAMES utf8;" )
end
end
addEventHandler ( "onResourceStart" , resourceRoot , connect )
function pobierzTabeleWynikow (...)
local h = dbQuery ( SQL ,...)
if ( not h ) then
return nil
end
local rows = dbPoll ( h , - 1 )
return rows
end
function pobierzWyniki (...)
local h = dbQuery ( SQL ,...)
if ( not h ) then
return nil
end
local rows = dbPoll ( h , - 1 )
if not rows then return nil end
return rows [ 1 ]
end
function zapytanie (...)
local h = dbQuery ( SQL ,...)
local result , numrows , last_id = dbPoll ( h ,- 1 )
return numrows
end
function zapytanieID (...)
local h = dbQuery ( SQL ,...)
local result , numrows , last_id = dbPoll ( h ,- 1 )
return numrows , last_id
end
function update (...)
local h = dbExec ( SQL ,...)
return h
end
This is function to connect mysql database
Więcej informacji znajdziesz w Wikipedii MTA: dbConnect
Wysłany: 2017-01-04, 19:20
MarkiusSK
Wiek: 31 Na forum: 3687 dni Posty: 3
Nick w MP: Marek762001
I have got this -
DBHandler = nil
DBName = "db_17749"
DBUser = "db_17749"
DBPass = "5dsfw3DdS"
DBHost = "mysql-fr1.ServerProject.pl"
-- 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 = "db_17749"
local SQL_PASSWD = "5dsfw3DdS"
local SQL_DB = "db_17749"
local SQL_HOST = "mysql-fr1.ServerProject.pl"
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
[ Dodano : 2017-01-04, 19:21 ]
And what I can do it with this and once the same too and where I can put this files
Ostatnio zmieniony przez luki123luki123 2017-01-04, 19:33, w całości zmieniany 1 raz
Wysłany: 2017-01-04, 19:30
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
MarkiusSK , if u have in db3 (/debugscript 3) messageConnect to server MYSQL... then ur gamemode is connected
Wysłany: 2017-01-04, 19:34
MarkiusSK
Wiek: 31 Na forum: 3687 dni Posty: 3
Nick w MP: Marek762001
Please can you visit my server ? Sorry for adding IP to forum but I need really help : CUT and password is 123 ( difficult )
[ Dodano : 2017-01-04, 19:49 ]
Please really please beacause I need help
[ Dodano : 2017-01-04, 20:21 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?
[ Dodano : 2017-01-04, 21:34 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?
[ Dodano : 2017-01-04, 21:35 ]
Ah okay and when I give you password and username to dbadmin.sk can you help me and finish it ?
Ostatnio zmieniony przez marcin778 2017-01-04, 20:18, w całości zmieniany 1 raz
Tagi: mysql :: database
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: