Wysłany: 2017-01-13, 15:34
Vintage
Wiek: 23 Na forum: 3555 dni Posty: 64
Piwa : 1
Witam mam problem z MYSQL OGRPG
--[[
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 = "dbqwq377"
DBUser = "dbqwqw7"
DBPass = "pass"
DBHost = "host"
-- 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 = "db_15655"
local SQL_PASSWD = "2l483DBx"
local SQL_DB = "db_15655"
local SQL_HOST = "sql-waw2.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 )
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
Tabele mam wgran? i po??czone
SS : http://imgur.com/a/XdVtw
Więcej szczegółów
Wystawiono 1 piw(a):dawidmajka
Wysłany: 2017-01-13, 17:41
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
Nic chyba nie pod??czy?es
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Więcej szczegółów
Wystawiono 1 piw(a):ProGamerCSGO7
Wysłany: 2017-01-13, 17:54
Vintage
Wiek: 23 Na forum: 3555 dni Posty: 64
Piwa : 1
mixLoLmix2 , ju? poprawiam
Wysłany: 2017-01-13, 18:20
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
-- Settings
DBHandler = nil
DBName = "dbqwq377"
DBUser = "dbqwqw7"
DBPass = "pass"
DBHost = "host"
Uzupe?nij to
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Wysłany: 2017-01-13, 18:40
Vintage
Wiek: 23 Na forum: 3555 dni Posty: 64
Piwa : 1
Wysłany: 2017-01-14, 17:24
karasisko
Wiek: 25 Na forum: 3747 dni Posty: 15
Nick w MP: karas
Piwa : 1
Wysłany: 2017-01-14, 17:47
2002kondzior
Wiek: 27 Na forum: 3835 dni Posty: 36
Piwa : 6
Witaj, nie masz wgranego modu?u mta_mysql,
Je?li nie chcesz go wgrywa? to tu masz m?j kod:
--[[
Autor : KondzioLP
Kontakt : kondzio @ fictionalstories . eu / TeamSpeak3 : LubimyPlacki . eu
]]
handler = nil
db_host = "host"
db_name = "nazwa_bazydanych"
db_user = "u?ytkownik"
db_pass = "has?o"
function connect ()
handler = dbConnect ( "mysql" , "dbname=" .. db_name .. ";host=" .. db_host .. "" , db_user , db_pass , "share=1" )
if handler then
outputDebugString ( "* Connect to server MYSQL..." )
else
outputDebugString ( "* No Connecting to server MYSQL.." )
end
end
addEventHandler ( "onResourceStart" , resourceRoot , connect )
function setRekord (...)
if not {...} then return end
local query = dbExec ( handler , ...)
return query
end
function getRekord (...)
if not {...} then return end
local query = dbQuery ( handler , ...)
local result = dbPoll ( query , - 1 )
return result
end
Nie sprawdzane, ale powinno dzia?a?.
Wysłany: 2017-01-17, 08:54
mixLoLmix2
Programista
Wiek: 35 Na forum: 4113 dni Posty: 454
Nick w MP: TomeQmix
Piwa : 1915
Kolego do tego kodu wpisz pasy do MySQL i bedzie dzalac czyli host to np. Fs.4.serverpro....login db_0000 i twoje haslo do mysql(nie hostingu)
Podpis
Zajmuję się pisaniem zaawansowanych skryptów lua na zamówienie za bardzo niską cene.
Oraz pomoc przy serwerze mta/forum i tym podobnych.
Discord: TomeQmix#7106
Wysłany: 2017-01-17, 15:22
Vintage
Wiek: 23 Na forum: 3555 dni Posty: 64
Piwa : 1
mixLoLmix2 , mam ale nie chce ?eby mi kto? na baze wchodzi?
[ Dodano : 2017-01-17, 18:12 ]
2002kondzior , 2002kondzior , nie dzia?a
Wysłany: 2017-01-17, 19:33
nanKy
Wiek: 22 Na forum: 3866 dni Posty: 498
Nick w MP: nanky
Piwa : 1773
Nie ma w MTA ju? takiej funkcji jak mysql_connect zast?p to funkcj? dbConnect
Wysłany: 2017-01-18, 10:59
_Haze
Peace Yo!
Wiek: 24 Na forum: 4184 dni Posty: 1648
Nick w MP: Haze
Piwa : 2628
HerbatnikTv , musisz wgra? modu? MySQL albo zast?pi? to na dbQuery dbConnect dbExec dbPoll i dbFree
Wysłany: 2017-01-18, 12:38
2002kondzior
Wiek: 27 Na forum: 3835 dni Posty: 36
Piwa : 6
"HerbatnikTv" napisał/a :mixLoLmix2 , mam ale nie chce ?eby mi kto? na baze wchodzi?
[ Dodano : 2017-01-17, 18:12 ]
2002kondzior , 2002kondzior , nie dzia?a
Dzia?a Przed chwil? sprawdzi?em u siebie, mo?liwe ?e wpisa?e? z?e pasy.
Edit: Chodzi mi oczywi?cie o pasy do bazy danych, nie do hostingu.
Tagi: mysql :: ogrpg
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: