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

Wysłany: 2018-08-06, 13:30


koksownik8

PseudoSkrypter






Wiek: 20
Na forum: 3260 dni
Posty: 17
Nick w MP: NotRed

Piwa: 5

Respekt: 50

[2018-08-06 13:29] ERROR: [skrypty_glowne]/ogrpg-db/s_db.lua:80: attempt to call global 'mysql_query' (a nil value)
[2018-08-06 13:29] ERROR: [skrypty_glowne]/ogrpg-offices-v2/selectjobs/s_selectjob.lua:27: call: failed to call 'ogrpg-db:pobierzTabeleWynikow' [string "?"]

Mam taki problem pomo?e ktos

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-06, 13:47


BlackSkorpion

Uczę się LUA






Wiek: 25
Na forum: 3471 dni
Posty: 53
Nick w MP: Black

Piwa: 371

Respekt: 50

podaj kod s_db.lua

Podpis
Pomagam na tyle ile mogę :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-06, 14:12


koksownik8

PseudoSkrypter






Wiek: 20
Na forum: 3260 dni
Posty: 17
Nick w MP: NotRed

Piwa: 5

Respekt: 50

-[[
Resource: OURGame v2
Developers: Split <[email protected]>
You have no right to use this code without my permission.
(c) 2015 <[email protected]>. All rights reserved.
]]

-- Settings
DBHandler=nil
DBName=""
DBUser=""
DBPass=""
DBHost=""

-- 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=""
local SQL_PASSWD=""
local SQL_DB=""
local SQL_HOST=""
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

Usunalem dane ?eby nie bylo wlamania

Podpis
Mój pseudolek :) https://discord.gg/RFYCbS
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-06, 14:25


_jvneczek







Wiek: 22
Na forum: 4326 dni
Posty: 1513
Nick w MP: _jvneczek

Piwa: 3949

Respekt: 337,5
Respekt: 337,5Respekt: 337,5Respekt: 337,5

?ap, powinno na 99% zadzia?a?, mozesz postawic piwko i repke za pomoc ;p
--[[
Obsluga baz danychinterfejs do bazy MySQL realizowany za pomoca wbudowanych w MTA funkcji db...

@author Lukasz Biegaj <wielebny@bestplay.pl>
@author WUBE <wube@lss-rp.pl>
@copyright 2011-2013 Lukasz Biegaj <wielebny@bestplay.pl>
@license Dual GPLv2/MIT
@package MTA-XyzzyRP
@link https://github.com/lpiob/MTA-XyzzyRP GitHub
]]--

local SQL

local function connect()
    -- w ponizszej linii uzupelnij dane autoryzacji
    SQL dbConnect("mysql""dbname=tunazwabazydanych;host=tutajhost""tutajuser","tutajhaslo","share=1")
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
        zapytanie("SET NAMES utf8;")
    end

end

addEventHandler("onResourceStart",resourceRootconnect)

function `TabeleWynikow(...)
    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=dbPoll(h,-1)
    return numrows
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


Podpis

Support Team: 04.10.2020 - 01.09.2020
Test Moderator: 03.05.2021 - 01.09.2021
Moderator: 01.09.2021 - 23.10.2021

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-07, 11:17


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Jezu znawcy ogrpg si? znale?li . Musisz w??czy? modu? powiniene? mie? taki folder modules w deathmatch je?eli go masz odpalasz komend? w konsoli loadmodule mta_mysql.so . Jak to zrobisz pami?taj o restarcie ogrpg-db

i w tym skrypcie s_selectjob.lua:27: call: failed to call 'ogrpg-db:pobierzTabeleWynikow' [string "?"]

[ogrpg-db] zmien na [DB2] bo tam jest pobieranie tabeli wynik?w. Chyba ?e po w??czonym module nie b?dzie b??du

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-09, 16:51


koksownik8

PseudoSkrypter






Wiek: 20
Na forum: 3260 dni
Posty: 17
Nick w MP: NotRed

Piwa: 5

Respekt: 50

[2018-08-09 16:51] loadmodule: Requested by Console
[2018-08-09 16:51] MODULE: File not found - x64/modules/mta_mysql.so
[2018-08-09 16:51] loadmodule: Module failed to load
[2018-08-09 16:51] loadmodule: Couldn't find module file

To mi wyskakuje

[ Dodano: 2018-08-09, 16:55 ]
[2018-08-09 16:54] loadmodule: Requested by Console
[2018-08-09 16:54] MODULE: Unable to load x64/modules/mta_mysql.so (/home/data/michuu21/710243.mta/x64/modules/mta_mysql.so: wrong ELF class: ELFCLASS32)
[2018-08-09 16:54] loadmodule: Module failed to load
[2018-08-09 16:54] loadmodule: Couldn't find module file

Podpis
Mój pseudolek :) https://discord.gg/RFYCbS
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-09, 21:32


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

masz folder modules w deathmatch? i w folderze module mta_mysql.so ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-10, 14:13


koksownik8

PseudoSkrypter






Wiek: 20
Na forum: 3260 dni
Posty: 17
Nick w MP: NotRed

Piwa: 5

Respekt: 50

Nie mam folderu ja mam serwer na pukawce a mysql z projecta.

Podpis
Mój pseudolek :) https://discord.gg/RFYCbS
Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-08-10, 16:27


DylemaT929

Nikt






Wiek: 28
Na forum: 4041 dni
Posty: 333
Nick w MP: dylemat929

Piwa: 3195

Respekt: 165,8
Respekt: 165,8Respekt: 165,8

Masz tutaj wyt?umaczone jak zainstalowa? ten modu?

https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL

Postaw piwo autorowi tego posta
 

 
Tagi: paczka :: yad
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Paczka YAD 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