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

Wysłany: 2017-02-15, 11:52


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Witam posiadam organizacje lecz one nie dzia?aj?

kod b??du
Kod:


WARNING: ogrpg-db/s_db.lua:27: dbPoll failed; Not unique table/alias: 'ogrpg_organizations'


c_zarzadzanie


local wm={
    window={},
    added={},
    edit={},
    close={},
    delete={},
    gridlist={},
    faction=nil,
}



-- Panel cz?onk?w
wm.window[1]=guiCreateWindow(0.180.230.640.57"Panel Organizacji"true)
guiWindowSetMovable(wm.window[1], false)
guiWindowSetSizable(wm.window[1], false)
guiSetVisible(wm.window[1], false)
wm.gridlist[1]=guiCreateGridList(0.020.050.970.73truewm.window[1])
guiGridListAddColumn(wm.gridlist[1], "NICK"0.3)
guiGridListAddColumn(wm.gridlist[1], "UID"0.3)
guiGridListAddColumn(wm.gridlist[1], "Ranga"0.3)
guiGridListAddColumn(wm.gridlist[1], "Aktywny"0.3)
wm.added[1]=guiCreateButton(0.020.800.260.16"Dodaj"truewm.window[1])
wm.edit[1]=guiCreateButton(0.380.800.260.16"Edytuj"truewm.window[1])
wm.delete[1]=guiCreateButton(0.730.800.260.16"Wyrzu?"truewm.window[1])

-- Dodawanie cz?onka/edycja jego
wm.window[2]=guiCreateWindow(0.350.430.300.22"Dodawanie cz?onka - wpisz nick i kliknij dodaj"true)
guiWindowSetMovable(wm.window[2], false)
guiWindowSetSizable(wm.window[2], false)
guiSetVisible(wm.window[2], false)
wm.edit[2]=guiCreateEdit(0.090.210.810.20""truewm.window[2])
wm.close[1]=guiCreateButton(0.550.520.360.31"Zamknij"truewm.window[2])
wm.added[2]=guiCreateButton(0.090.520.360.31"Dodaj"truewm.window[2])

function fillUsersData(result)
    guiGridListClear(wm.gridlist[1])
    for i,v in pairs(result) do
        local row=guiGridListAddRow(wm.gridlist[1])
        guiGridListSetItemText(wm.gridlist[1], row1v["login"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row2v["uid"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row3v["rank"], falsefalse)
        guiGridListSetItemText(wm.gridlist[1], row4v["actived"], falsefalse)
        
    end
end

addEventHandler("onClientMarkerLeave"resourceRoot, function(el,md)
    if el~=localPlayer then return end
    if guiGetVisible(wm.window[1]) == true then
        showCursor(false)
        guiSetVisible(wm.window[1], false)
        guiSetVisible(wm.window[2], false)
    end
end)

addEventHandler("onClientGUIClick"resourceRoot, function()
    if source == wm.added[1then
        guiSetVisible(wm.window[2], true)
        guiMoveToBack(wm.window[1])
        guiSetText(wm.added[2],"Dodaj")
        guiSetText(wm.edit[2],"")
        guiSetText(wm.window[2],"Dodawanie cz?onka - wpisz UID gracza i kliknij dodaj")
    end
    if source == wm.edit[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then return end
        local rank=guiGridListGetItemText(wm.gridlist[1], selectedRow3)
        if tonumber(rank) == 4 then outputChatBox("Gracz ma lidera!!!!",255,0,0) return end
        guiSetVisible(wm.window[2], true)
        guiMoveToBack(wm.window[1])
        guiSetText(wm.added[2],"Edycja")
        guiSetText(wm.edit[2],"")
        guiSetText(wm.window[2],"Edycja cz?onka - wpisz ID rangi (0-3) i kliknij edycja! Ranga 3 = (vice-lidero)")
    end
    if source == wm.close[1then
        guiSetVisible(wm.window[2], false)
    end
    if source == wm.added[2then
        local text=guiGetText(wm.edit[2])
        if guiGetText(wm.added[2]) ~= "Dodaj" then
            local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
            if not selectedRow or selectedRow 0 then return end
            local name=guiGridListGetItemText(wm.gridlist[1], selectedRow2)
            if not name then return end
            if not text then return end
            if tonumber(text) and tonumber(text) <= 3 then
                triggerServerEvent("lidero:editUser"resourceRootnametextwm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
            else
                guiSetText(wm.window[2], "Podaj range w liczbach! Maksymalna to 3(vice-lidero)!")
            end
        else
            if not text then return end
            triggerServerEvent("lidero:addUser"resourceRoottextwm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
        end
    end
    if source == wm.delete[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then return end
        local rank=guiGridListGetItemText(wm.gridlist[1], selectedRow3)
        if tonumber(rank) == 4 then outputChatBox("Gracz ma lidera!!!!",255,0,0) return end
        local name=guiGridListGetItemText(wm.gridlist[1], selectedRow2)
        if not name then return end
        triggerServerEvent("lidero:deleteUser"resourceRootnamewm.faction)
                triggerEvent("lidero:showGUI",resourceRoot,"brak","brak")
    end
    if source == wm.gridlist[1then
        local selectedRow=guiGridListGetSelectedItem(wm.gridlist[1])
        if not selectedRow or selectedRow 0 then
            guiSetEnabled(wm.edit[1], false)
            guiSetEnabled(wm.delete[1], false)
        else
            guiSetEnabled(wm.edit[1], true)
            guiSetEnabled(wm.delete[1], true)
        end
    end
end)

addEvent("lidero:showGUI"true)
addEventHandler("lidero:showGUI"resourceRoot, function(fid,result)
    if guiGetVisible(wm.window[1]) == false then
        -- Ustawienia
        showCursor(true,false)
        guiSetVisible(wm.window[1], true)

        guiSetEnabled(wm.edit[1], false)
        guiSetEnabled(wm.delete[1], false)


        wm.faction=fid -- deklarujemy frakcj?

        -- Sprawdzamy cz?onk?w
        fillUsersData(result)
    else
            showCursor(false,false)
        guiSetVisible(wm.window[1], false)
        guiSetEnabled(wm.edit[1], false)
        guiSetEnabled(wm.delete[1], false)
        guiSetVisible(wm.window[2], false)
    end
end)

addEvent("lidero:refresh"true)
addEventHandler("lidero:refresh"resourceRootfillUsersData)


s_utility

--[[
Developed by Yolos 
All rights reserved!
You cannot use this without permission!
--]]

function getOnlinePlayersinOrganization(org)
    local number=0
    for i,v in ipairs(getElementsByType("player")) do
        if getElementData(v,"player:organization") == org then
            number=number+1
        end
    end
    return number
end

function getPlayerOrganization(el)
    local uid=getElementData(el,"player:uid")
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? LIMIT 1;"uid) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        return result[1].name
    else
        return false
    end
end

function getPlayerOrganizationRank(el,org)
    local uid=getElementData(el,"player:uid")
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"orguid) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        return result[1].rank
    else
        return false
    end
end


s_zarzadzanie

local zaproszenia = {}
local max_people_in_org 15 ---- MAKSYMALNA LICZBA LUDZI W ORGANIZACJI!
function findPlayer(plr,cel)
    local target=nil
    if (tonumber(cel) ~= nilthen
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if getElementData(thePlayer,"player:uid") == tonumber(celthen target thePlayer end
        end
    else -- podano fragment nicku
        for _,thePlayer in ipairs(getElementsByType("player")) do
            if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x"""), cel:lower(), 0truethen
                if (targetthen
                    outputChatBox("Znaleziono wiecej niz jednego gracza o pasujacym nicku, podaj wiecej liter."plr)
                    return nil
                end
                target=thePlayer
            end
        end
    end
    if target and getElementData(target,"p:inv"then return nil end
    return target
end

addEvent("lidero:editUser"true)
addEventHandler("lidero:editUser"resourceRoot, function(text,rank,faction)
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end 
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiontext) -- pobieramy tylko JEDEN rekord
    if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
    local ranke=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiongetElementData(client,"player:uid")) -- pobieramy tylko JEDEN rekord
    if not ranke or #ranke < 0 then outputChatBox("*Nie znajdujesz si? w tej organizacji!",client,255,0,0) return end
    if tonumber(ranke[1].rank) <= and (tonumber(rank) > 2then outputChatBox("*Posiadasz za ma?? range!",client,255,0,0) return end
    local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organizations SET rank=? WHERE uid=? AND code=?"ranktextfaction)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    if query1 then
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
        triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
        outputChatBox("* Pomy?lnie zmieniono rang? graczowi "..result1[1].login.." o uid: "..text.." na "..rank.." w organizacji."client)
    end
    local target findPlayer(client,text)
    if target then outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana. Aby odej?? wpisz /opusc",targetend
end)
addEvent("lidero:addUser"true)
addEventHandler("lidero:addUser"resourceRoot, function(text,faction)
    if string.len(text) <= 0 then return end
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"textfaction)
    if result2 and #result2 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
    if result and #result >= max_people_in_org then outputChatBox("* Posiadasz ju? maksymaln? liczbe ludzi w organizacji.", client, 255, 0, 0) return end
    local result3=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?"text)
    if result3 and #result3 > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
    local target=findPlayer(client,text)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    if target then
        if zaproszenia[targetthen outputChatBox("**Gracz ju? dosta? zaproszenie!",client) return end
        if zaproszenia[target] and isTimer(zaproszenia[target][3]) then killTimer(zaproszenia[target][3]) end
        zaproszenia[target] = {faction,client,setTimer(function() zaproszenia[target] = nil end ,10000,1),nazwa}
        outputChatBox("* Zosta?e? zaproszony do organizacji o nazwie :"..nazwa.."!",target,0,255,0)
        outputChatBox("* Masz 10 sekund na zaakceptowanie zaproszenia! (Wpisz /akceptuj)",target,0,255,0)
    end
end)
addEvent("lidero:deleteUser"true)
addEventHandler("lidero:deleteUser"resourceRoot, function(text,faction)
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"text)
    if not result1 or #result1 < 0 then outputChatBox("* Podany u?ytkownik nie istnieje w bazie danych.", client, 255, 0, 0) return end 
    local result2=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1;"factiontext) -- pobieramy tylko JEDEN rekord
    if not result2 or #result2 < 0 then outputChatBox("*Podany u?ytkownik nie znajduje si? w tej organizacji",client,255,0,0) return end
    local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",textfaction)
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"faction)
    local nazwa exports["ogrpg-db"]:dbGet("SELECT name FROM ogrpg_organization_list WHERE id=?"faction)
    local nazwa nazwa[1].name
    triggerClientEvent(client,"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie usunieto gracza "..result1[1].login.." o uid: "..text.." z organizacji" client)
    local target findPlayer(client,text)
    if target then outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana.",target); setElementData(target,"player:organization",falseend
end)

addCommandHandler("panel-organizacji",function (plr,cmd,...)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    if not code then return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,code) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        if result[1].rank <= 2 then outputChatBox("*Brak uprawnien do panelu organizacji",plr) return end
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations JOIN ogrpg_organization_list ON ogrpg_organizations.code=ogrpg_organization_list.id and ogrpg_organizations.code=? JOIN ogrpg_users on ogrpg_users.id = ogrpg_organizations.uid order by ogrpg_organizations.rank desc",code)
        triggerClientEvent(plr"lidero:showGUI"resourceRoot,coderesulted)
    end
end)
addCommandHandler("akceptuj",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    if not zaproszenia[plrthen outputChatBox("*Nie masz zaproszenia do organizacji lub przedawni?o si?!!",plr,255,0,0) return end
    local result1=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE id=?"uid)
    if not result1 or #result1 < 0 then outputChatBox("*Wystapil blad # Brak Ciebie w bazie danych!.", plr, 255, 0, 0) return end 
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,  zaproszenia[plr][1])
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w tej organizacji.", client, 255, 0, 0) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=?"uid)
    if result and #result > 0 then outputChatBox("* Podany u?ytkownik ju? znajduje si? w innej organizacji.", client, 255, 0, 0) return end
    local query1=exports["ogrpg-db"]:dbSet("INSERT ogrpg_organizations (uid,code) VALUES (?,?)",uidzaproszenia[plr][1])
    if isElement(zaproszenia[plr][2]) then
    if isTimer(zaproszenia[plr][3]) then killTimer(zaproszenia[plr][3]) end
    local resulted=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=?"zaproszenia[plr][1])
    triggerClientEvent(zaproszenia[plr][2],"lidero:refresh",resourceRoot,resulted)
    outputChatBox("* Pomy?lnie dodano gracza "..result1[1].login.." o uid: "..uid.." w organizacji na 1 poziom"zaproszenia[plr][2])
    end
    outputDebugString("Organizacja : "..zaproszenia[plr][4].." UID :"..uid)
    outputChatBox("Akceptowales zaproszenie do organizacji o nazwie :"..zaproszenia[plr][4]..". Aby odej?? wpisz /opusc",plr) 
    setElementData(plr,"player:organization:id",zaproszenia[plr][1])
    setElementData(plr,"player:organization",zaproszenia[plr][4])
    exports['ogrpg-db']:dbSet("UPDATE ogrpg_organizations SET actived=curdate() WHERE uid=?"getElementData(plr,"player:uid"))
    zaproszenia[plr] = nil
end)
addCommandHandler("opusc",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    local nazwa=getElementData(plr,"player:organization")
    if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
    local query1=exports["ogrpg-db"]:dbSet("DELETE FROM ogrpg_organizations WHERE uid=? AND code=?",uidcode)
    outputChatBox("Twoja przynaleznosc w organizacji :"..nazwa.." zostala zaaktualizowana.",plr); setElementData(plr,"player:organization",falsesetElementData(plr,"player:organization:id",false)
end)

addCommandHandler("ustawspawn",function (plr,cmd)
    local uid=getElementData(plr,"player:uid")
    if not uid then return end
    local code=getElementData(plr,"player:organization:id")
    if not code then outputChatBox("Nie jestes w ?adnej organizacji!",plr) return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE uid=? and code=?"uid,code) -- pobieramy tylko JEDEN rekord
    if result and #result > 0 then
        if result[1].rank <= 3 then outputChatBox("*Nie jestes g?ownym liderem",plr) return end
    end
    local int getElementInterior(plr)
    local dim getElementDimension(plr)
    local x,y,getElementPosition(plr)
    if int 0 then  outputChatBox("Spawn nie moze byc w interiorze!",plr) return end
    if dim 0 then  outputChatBox("Spawn nie moze byc w innym dimensionie!",plr) return end
    local query1=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_organization_list set spawn=? where id=?", ("%s,%s,%s"):format(x,y,z),code)
    outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",plr)
    for _,p in pairs(getElementsByType('player')) do
        local gan getElementData(p,"player:organization:id")
        if gan == code then
            outputChatBox("Spawn w twojej organizacji zostal zaaktualizowany.",p)
        end
    end
end)

function globalMessage(plrcmd, ...)
    local frakcja=getElementData(plr,'player:organization')
    if not frakcja then
        return
    end
    local msg table.concat ( { ... }, " " )
    local admins=getElementsByType('player')
    for i,v in pairs(admins) do
    local pfrakcje=getElementData(v,'player:organization')
        if frakcja == pfrakcje then
            outputChatBox("[Radio] ("..getElementData(plr,"id")..") "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..": "..msgv0255240false)
        end
    end
end
addCommandHandler("organizacja"globalMessage)




addEventHandler("onResourceStart"root, function() 
local players=getElementsByType('player')
for _p in pairs(players) do
bindKey(p"o""down""chatbox""organizacja")
end
end)

addEventHandler"onPlayerSpawn"getRootElement(),
    function (_)
    bindKey(source"o""down""chatbox""organizacja")
    end
)


Baza danych jest poprawnie dzia?aj?ca

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:12


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Brak tabeli
Kod:

ogrpg_organizations
w mysql

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:18


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

"xJakob" napisał/a:

Brak tabeli
Kod:

ogrpg_organizations
w mysql


Jest ta tabela

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:18


mis14







Wiek: 25
Na forum: 3924 dni
Posty: 185

Piwa: 73

Respekt: -149

posiadasz organizacje z its musisz mie? 2 tabele mysql ogrpg_organization,ogrpg_organization_list i one b?d? ci dzia?a? jak napiszesz skrypt na wczytywanie organizacji w ogrpg-core saveplayers.lua jest tam w its zakodowany plik wczytywanie niestety nie jestem wstanie co? takiego napisa? mo?e inni ci to pomog? napisa? taki owy skrypt .

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:36


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Wszystko doda?em nawet do saveplayer

local org=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_organizations WHERE code=? AND uid=? LIMIT 1"getElementData(plr,"player:organization"), getElementData(plr,"player:uid")) -- pobieramy tylko JEDEN rekord
        local name getPlayerName(plr):gsub("#%x%x%x%x%x%x","")
        if org and #org > 0 then
            setElementData(plr,"player:organization",org[1].code)
            outputChatBox("* Jeste? w organizacji "..org[1].code..""plr)
            exports['ogrpg-db']:dbSet("UPDATE ogrpg_organizations SET actived=curdate() WHERE uid=?"getElementData(plr,"player:uid"))

i nadal to samo

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:47


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

Ale tabele do mysql pewnie nie masz albo masz ale nie takie.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:50


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:51


xJakob







Wiek: 31
Na forum: 3661 dni
Posty: 164
Nick w MP: tylkoyolo

Piwa: 984

Respekt: 155,3
Respekt: 155,3Respekt: 155,3

To jest co? w?a?nie z po??czeniem linika 27 w ogrpg-db

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 14:58


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

co? takiego mam

local result=dbPoll(query, -1)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 15:29


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22

"xJakob" napisał/a:

local result=dbPoll(query, -1)
Spr?buj


Niestety nic

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 18:27


marcin778

Krytyk serwerów MTA






Wiek: 24
Na forum: 4149 dni
Posty: 2268
Nick w MP: Marcineg

Piwa: 4662

Respekt: 1436,8
Respekt: 1436,8

Poka? kod s_db

Podpis
Moje prace: https://www.youtube.com/c...MuaWGHPp1mhlGnw

-- obecnie
-- obecnie
-- dawniej
-- dawniej
-- dawniej
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-02-15, 18:33


killercycDDS

Migacz






Wiek: 25
Na forum: 4512 dni
Posty: 629
Nick w MP: killer_cyc[DDS]

Piwa: 1659

Respekt: 22


--[[
    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="p488539_rpg"
DBUser="p488539_rpg"
DBPass="xxx" 
DBHost="xxx"

-- Functions
function dbSet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbExec(DBHandlerstringe)
    return query
end

function dbGet(...)
    if not {...} then return end
    local stringe=dbPrepareString(DBHandler,...)
    local query=dbQuery(DBHandlerstringe)
    local result=dbPoll(query, -1)
    return result
end


addEventHandler("onResourceStart"resourceRoot, function()
    DBHandler=dbConnect("mysql""dbname="..DBName..";host="..DBHost..""DBUserDBPass"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="p488539_rpg"
local SQL_PASSWD="xxx"
local SQL_DB="p488539_rpg"
local SQL_HOST="xxx"
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
        --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(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


[ Dodano: 2017-02-15, 20:39 ]
wszystko gra tylko panel mi si? nie wy?wietla

Postaw piwo autorowi tego posta
 

 
Tagi: organizacje
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