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

Wysłany: 2017-04-12, 17:34


KacperXx

Doświadczony Mapper






Wiek: 23
Na forum: 3624 dni
Posty: 21
Nick w MP: krapeq

Piwa: 161

Respekt: 60

No wszystko mam ok ale denerwuj? te e rrory troszk?.

[2017-04-12 14:46] ERROR: ogrpg-core/vehicles.lua:69: call: failed to call 'ogrpg-db:pobierzWyniki' [string "?"]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-12, 17:37


Remix110

Pewna osóbka :3






Wiek: 40
Na forum: 3663 dni
Posty: 291
Nick w MP: GoodNight

Piwa: 15

Respekt: 51

poka? kod :D

Podpis
pomogłem? :P Możesz dać piwko, przyda się na imprezę :D
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-12, 17:41


KacperXx

Doświadczony Mapper






Wiek: 23
Na forum: 3624 dni
Posty: 21
Nick w MP: krapeq

Piwa: 161

Respekt: 60

Wog?le to ci?gle jest co? z tym ogrpg-core.


kod OGRPG-DB

--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]

-- Settings
DBHandler=nil
DBName="jakistamname"
DBUser="jakistamuser"
DBPass="jakiestamhaslo"
DBHost="sql-waw2.ServerProject.pl"

-- 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..""DBUserDBPass"share=1")
    if DBHandler then
        outputDebugString("* Connect to server MYSQL...")
    else
        outputDebugString("* No Connecting to server MYSQL..")
    end
end)


local SQL_LOGIN="niexd"
local SQL_PASSWD="niexd"
local SQL_DB="niexd"
local SQL_HOST="sql-waw2.ServerProject.pl"
local SQL_PORT=3306

local root getRootElement()

local SQL

local function connect()
    SQL mysql_connect(SQL_HOSTSQL_LOGINSQL_PASSWDSQL_DBSQL_PORT)
    if (not SQLthen
        outputServerLog("BRAK POLACZENIA Z BAZA DANYCH!")
    else
    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(keepAlive300000)
end)

function esc(value)
    return mysql_escape_string(SQL,value)
end

function pobierzTabeleWynikow(query)
    local result=mysql_query(SQL,query)
    if (not resultthen 
        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 resultthen 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 (resultthen 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 resultthen return nil end
    local tabela={}

    while true do
        local row mysql_fetch_row(result)
        if (not rowthen break end
        table.insert(tabela,row)
    end
    mysql_free_result(result)
    return tabela
end


function getSQLLink()
    return SQL
end


KOD ogrpg-core/vehicles

--[[
    ResourceOURGame v2
    DevelopersSplit <split.programista@gmail.com>
    You have no right to use this code without my permission.
    (c2015 <split.programista@gmail.com>. All rights reserved.
]]
-- Get vehicle keys
function getVehicleKey(plr,veh)
    if plr and veh then
        local uid=getElementData(plr,"player:uid")
        if not uid then return end
        if getElementData(plr,"player:admin") or uid == getElementData(veh,"vehicle:ownedPlayer"then
            return true
        else
            return false
        end
    end
end
local categoryL={[592] = true,[553] = true,[577] = true,[488] = true,[511] = true,[497] = true,[548] = true,[563] = true,[512] = true,[476] = true,[593] = true,[447] = true,[425] = true,[519] = true,[520] = true,[460] = true,[417] = true,[469] = true,[487] = true,[513] = true}
local categoryA1={[462] = true,[468] = true}
addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if getElementHealth(source) < 302 then
        setElementHealth(source,302)
    end
end)
function jestwtabeli(***,truj)
    for k,v in pairs(***) do
        if == truj then
           return true
        end
    end
    return false
end
addCommandHandler("vdodaj",function(plr,cmd,target)
    local veh getPedOccupiedVehicle(plr)
    if not veh then outputChatBox("* Nie siedzisz w aucie!",plr,255,0,0) return end
    if getElementData(veh,"vehicle:ownedPlayer") ~= getElementData(plr,"player:uid"then outputChatBox("* Ten pojazd nie nale?y od ciebie!",plr,255,0,0) return end
    if not target then
        outputChatBox("* Zabrano dostep wszystkim gracz?!",plr,255,0,0)
        setElementData(veh,"vehicle:rent",0)
    else
        local target=findPlayer(plrtarget)
        if not target then
            outputChatBox("* Nie znaleziono gracza online!",plr,255,0,0)
            return
        end
        local rent getElementData(veh,"vehicle:rent")
        if (type(rent) ~= "table"then
            local tabelka = {}
            table.insert(tabelka,getElementData(target,"player:uid"))
            setElementData(veh,"vehicle:rent",tabelka)
            outputChatBox(string.format("*Dodano gracza "..getPlayerName(target).."(UID :"..getElementData(target,"player:uid")..") do wypo?ycze?"),plr)
        else
            local tabelka rent
            if jestwtabeli(tabelka,getElementData(target,"player:uid")) then outputChatBox("* Ten gracz aktualnie posiada kluczyki do twojego pojazdu!",plr) return end
             if #tabelka > 5 then outputChatBox("Mo?esz wypo?yczy? maksymalnie 5 gracz?!",plr) return end
            table.insert(tabelka,getElementData(target,"player:uid"))
            setElementData(veh,"vehicle:rent",tabelka)
            outputChatBox(string.format("*Dodano gracza "..getPlayerName(target).."(UID :"..getElementData(target,"player:uid")..") do wypo?ycze?"),plr)
        end
    end
end)

-- Tutaj dalsza cze?c kodu
addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if categoryL[getElementModel(source)] then return end
    local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko"getPlayerSerial(plr))
    local result=exports["ogrpg-db"]:pobierzWyniki(query)
    if (resultthen
        --outputChatBox(" Posiadasz zawieszone prawo jazdy do "..result["time"]..", za: "..result["reason"], plr25500)
        cancelEvent()
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""prawko"getPlayerSerial(plr))
    end
end)

addEventHandler("onVehicleEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if categoryL[getElementModel(source)] then return end
        local queryA=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","prawko"getPlayerSerial(plr))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultAthen
            --setControlState plr"enter_exit"true )
            setTimer(setControlState8001plr,"enter_exit"true)
            setTimer(setControlState18001plr,"enter_exit"false)
            --outputChatBox("* Posiadasz zawieszone prawo jazdy do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""prawko"getPlayerSerial(plr))
        end
end)

addEventHandler("onVehicleStartEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if not categoryL[getElementModel(source)] then return end
    local query=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L"getPlayerSerial(plr))
    local result=exports["ogrpg-db"]:pobierzWyniki(query)
    if (resultthen
    --    outputChatBox(" Posiadasz zawieszona licencje  do "..result["time"]..", za: "..result["reason"], plr25500)
        cancelEvent()
    else
        exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""L"getPlayerSerial(plr))
    end
end)

addEventHandler("onVehicleEnter"root, function(plr,seat,jacked)
    if seat ~= 0 then return end
    if not categoryL[getElementModel(source)] then return end
        local queryA=string.format("SELECT * FROM ogrpg_punish WHERE type=%q AND active=1 AND serial=%q AND time>NOW() LIMIT 1","L"getPlayerSerial(plr))
        local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
        if (resultAthen
            --setControlState plr"enter_exit"true )
            setTimer(setControlState8001plr,"enter_exit"true)
            setTimer(setControlState18001plr,"enter_exit"false)
    --        outputChatBox("* Posiadasz zawieszona licencje do "..resultA["time"]..", za: "..resultA["reason"], plr25500)
        else
            exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_punish WHERE type=? AND active=1 AND serial=?""L"getPlayerSerial(plr))
        end
end)

addCommandHandler("vopis", function(plr,cmd,...)
    if not getElementData(plr"player:admin"then outputChatBox("*Brak uprawnien"plr) return end
    local desc=table.concat(arg" ")
    local veh=getPedOccupiedVehicle(plr)
    if not veh then
        outputChatBox("* Musisz siedzie? w poje?dzie kt?rego opis chcesz zmieni?."plr25500)
        return
    end
    if getElementData(veh"vehicle:desc"then
        setElementData(veh"vehicle:desc"false)
    return end
    if string.len(desc) < 2 then
        outputChatBox("* U?ycie: /vopis <opis min 2 znaki>"plr)
        return
    end

    descc=string.format("%s"desc)
    setElementData(veh,"vehicle:desc",descc)
end)

addEventHandler "onVehicleEnter"getRootElement(), function(thePlayerseatjacked) 
    if seat==0 then
--        setVehicleDoorOpenRatio(source20500)
        if (getVehicleDoorState(source,2)==0then
            setVehicleDoorState(source,2,1)
            setVehicleDoorState(source,2,0)
        end
    elseif seat==1 then
        if (getVehicleDoorState(source,3)==0then
            setVehicleDoorState(source,3,1)
            setVehicleDoorState(source,3,0)
        end
    else
--        if (getVehicleDoorState(source,4)==0then
            setVehicleDoorState(source,4,1)
            setVehicleDoorState(source,4,0)
--        end
--        if (getVehicleDoorState(source,5)==0then
            setVehicleDoorState(source,5,1)
            setVehicleDoorState(source,5,0)
--        end

    end
end)

addEventHandler("onPlayerQuit"root, function()
    if not getElementData(source,"player:job"then return end
    local veh=getPedOccupiedVehicle(source)
    if not veh then return end
    local id=getElementData(veh,"vehicle:id")
    if not id then
    if getElementData(source,"player:job") == "Sweepers" then return end
    triggerEvent("destroyVehicle"rootveh)
    end
end)


Komentarz HazeMaFaze dodany 2017-04-12, 21:07stosuj tagi [lua] następnym razem
Ostatnio zmieniony przez _Haze 2017-04-12, 21:07, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-12, 19:25


MagiK.

Lua :-)






Wiek: 26
Na forum: 3441 dni
Posty: 102

Piwa: 391

Respekt: 35,8

Brak po??czenia z Baz? danych.
wype?nij

DBHandler=nil
DBName="" -- Tutaj wpiszujesz swoj? nazw? Bazy
DBUser="" - Wpisujesz to samo co db
DBPass="" -- Has?o
DBHost="l" -- Hosting

Wszelkie informacje, znajdziesz na Hostingu SP

Przyk?ad:

DBHandler=nil
DBName="db_101"
DBUser="db_101"
DBPass="heaselo01"
DBHost="" - Musisz znale?c, jaki posiadasz hosting

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-12, 19:33


KacperXx

Doświadczony Mapper






Wiek: 23
Na forum: 3624 dni
Posty: 21
Nick w MP: krapeq

Piwa: 161

Respekt: 60

Przecie? jest wszystko dobrze wype?nione ..

[ Dodano: 2017-04-12, 19:34 ]
Tylko po zakrywa?em dane bazy.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-04-12, 20:10


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

KacperXx, Masz poda? kod z vehicles a nie db...

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: nie :: pobiera :: wyników :: dziwny :: ror.
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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