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

Wysłany: 2020-06-01, 14:45


KucharSolo







Wiek: 35
Na forum: 3438 dni
Posty: 94
Nick w MP: Kuchar

Piwa: 2

Respekt: 31

ten jest po stronie serwera

local element createElement("users""users")
local q exports["ys_db"]:query("select id,login from ogrpg_users")
local temp_table={}
for i,v in ipairs(q) do
    table.insert(temp_tabletonumber(v.id), {login v.loginuid v.id})
end
element:setData("users"temp_table)

function sprawdzorganizacje(plr)
local x exports["ys_db"]:query("SELECT spawn from ogrpg_organization_list join ogrpg_organizations on ogrpg_organizations.code = ogrpg_organization_list.id WHERE uid=? and not(spawn=?)",getElementData(plr,"player:uid"),"0,0,0")
if and #x > 0 then
local t split(x[1].spawn",")
    return t
end
return false
end

function SprawdzDom gracz )
    local q=exports["ys_db"]:query("select id,house from ogrpg_users where id=? and house IS NOT NULL",getElementData(gracz,"player:uid"))
    if #q < 1 then
        local dbdomy=exports["ys_db"]:query("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN ogrpg_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
        for __,v in ipairs(dbdomy) do
            local uid=tonumber(getElementData(gracz,"player:uid"))
            local r=v.ownerid
            v.drzwi=split(v.drzwi,",")
            for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
            if r then 
                if == uid then 
                    tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
                    setElementData(gracz,"player:house:spawn",tak)
                end
            end
        end
    elseif #q > 0 then
        local qr=exports["ys_db"]:query("select ownerid,drzwi,id from lss_domy where id=?"q[1].house)
        for i,v in ipairs(qr) do
            local uid=tonumber(getElementData(gracz,"player:uid"))
            v.drzwi=split(v.drzwi,",")
            for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
            tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
            setElementData(gracz,"player:house:spawn",tak)
        end
    end
    local q=exports["ys_db"]:query("select id from lss_domy where ownerid=?"getElementData(gracz"player:uid"))
    setElementData(gracz"player:houses"#q)
end

doubleAccount = function(plrnameuid)
    return_state=false;
    for i,v in ipairs(Element.getAllByType("player")) do 
        if == plr then break end
        if v.name == name and tonumber(v:getData("player:uid")) ~= tonumber(uidthen 
            v.name=math.random(99)..name..math.random(99)
            return_state=false;
            break
        end
        if tonumber(v:getData("player:uid")) == tonumber(uidthen
            return_state=true;
            break
        end 
    end
    return return_state;
end

function add_logs_login(plruidsuccess)
    local serial plr.serial;
    local ip plr.ip;
    exports["ys_db"]:query("insert into Logi_logowanie (serial, ip, account, success) values(?,?,?,?)"serialipuidsuccess and or 0)
end

function get_premium(plr)
    local queryA=string.format("SELECT *, TIMESTAMPDIFF(SECOND,now(),`premiumdate`) as roznica FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1"getElementData(plr,"player:uid"))
    local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
    if (resultAthen
        if resultA.roznica <= 86400 then
            setElementData(plr,"player:premium:need_checking",true)
        end
        setElementData(plr,"player:premium",true)
        setPlayerNametagColor(plr2552000)
    end
end

function find_xD(uid)
    local tbl={}
    for i,v in ipairs(getElementsByType("player")) do
        if v:getData("player:uid"then
            if tonumber(v:getData("player:uid")) == uid then
                table.insert(tblv);
            end
        end
    end
    return tbl;
end

addEvent("logging:checkAccount"true)
addEventHandler("logging:checkAccount"resourceRoot, function(login,pass)
    local result=exports["ys_db"]:query("select * from ogrpg_users where login=?"login)
    if result and #result > 0 then
        if result[1].password == sha256(passthen
            if doubleAccount(clientloginresult[1].idthen
                triggerClientEvent(client"logging:result"resourceRootfalse"Kto?&#8250; jest juĹĽ zalogowany na to konto!")
                return
            end
            local result4 exports["ys_db"]:query("select * from kary where uid_player=? and (type=? or type=?) and active=1 and data_punish>now() limit 1"result[1].id"BAN""PBAN")
            if #result4 > 0 then
                banPlayer(clientfalsefalsetrue"Console""Omijanie bana - (GID: "..result[1].id..")"0)
                return
            end
            local serial=getPlayerSerial(client)
            if result[1].register_serial~=serial then
                tak=true
                for i,v in ipairs(split(result[1].seriale,",")) do
                    if v==serial then tak=false end
                end
                if tak then
                    return triggerClientEvent(client"logging:result"resourceRootfalse"Nie moĹĽesz si?&#8482; zalogowa?&#8225; na to konto!","nope")
                end
            end
            add_logs_login(clientresult[1].idtrue);
            if result[1].login2 == false then
                setPlayerName(clientresult[1].login)
            else
                setPlayerName(clientresult[1].login2)
                outputChatBox("* Wykupiono us?&#8218;uge zmiany pseudonimu, twĂłj nick to: "..result[1].login2client255255255)
            end 
            if result[1].register_serial == false then
                exports["ys_db"]:query("update ogrpg_users set register_serial=? where id=?"client.serialresult[1].id)
            end
            setElementData(client"player:uid"result[1].id)
            setElementData(client,"player:organization:spawn",sprawdzorganizacje(client))
            SprawdzDom(client)
            if getElementData(client"player:houses") > 1 then
                outputChatBox("* Posiadasz wi?&#8482;cej niĹĽ jeden dom, moĹĽesz zmieni?&#8225; dom w ktĂłrym chcesz zosta?&#8225; zespawnowany za pomoc?&#8230; komendy /spawn_dom."client255255255)
            end
            get_premium(client);
            setElementData(client"last:pos", {result[1].xresult[1].yresult[1].zresult[1].interiorresult[1].dimension})
            Timer(function(client)
                local uid=client:getData("player:uid")
                local allPlr find_xD(uid)
                if #allPlr > 1 then
                    for i,v in ipairs(allPlr) do
                        if isElement(vthen
                            kickPlayer(v"*****?&#8218;o ci?&#8482; ch?&#8218;opaku")
                        end
                    end
                end
            end10001client)
            local result=exports["ys_db"]:query("SELECT * FROM ogrpg_organizations WHERE uid=?"result[1].id)
            if result and #result > 0 then
                if tonumber(result[1].rank) == 3 then
                    outputChatBox("* Jeste?&#8250; liderem organizacji, aby ustawi?&#8225; spawn w ktĂłrym cz?&#8218;onkowie mog?&#8230; si?&#8482; spawnowa?&#8225; uĹĽyj komendy /spawn_organizacja."client255255255)
                end
            end
            triggerClientEvent(client"logging:result"resourceRoottruenilloginpass)
        else
            triggerClientEvent(client"logging:result"resourceRootfalse"Podano nieprawid?&#8218;owy login i/lub has?&#8218;o!")
        end
    else
        triggerClientEvent(client"logging:result"resourceRootfalse"Nie znaleziono takiego konta!")
    end
end)

serials={
    ["3F219490B56F5D7539C3EFEA4AE97042"] = true,
    ["E52FAB62AD4F359AB96A3D8304BABDA4"] = true,
}

function get_limit(gracz)
    local serial getPlayerSerial(gracz)
    if serials[serialthen
        return 2;
    else
        return 1;
    end
end


addEvent("logging:registerAccount"true)
addEventHandler("logging:registerAccount"resourceRoot, function(login,pass)
    local result=exports["ys_db"]:query("select * from ogrpg_users where login=?"login)
    if result and #result > 0 then
        triggerClientEvent(client"logging:result"resourceRootfalse"Istnieje juĹĽ konto z takim loginem!")
        return
    end
    
    local register exports["ys_db"]:query("select * from ogrpg_users where register_serial=?"client.serial)
    if(#register >= get_limit(client)) then
        triggerClientEvent(client"logging:result"resourceRootfalse"Osi?&#8230;gnieto limit kont na tym serialu!")
        return
    end
    q,id=exports["ys_db"]:query("insert into ogrpg_users (login,password,register_serial) VALUES (?,?,?)"loginsha256(pass), client.serial)
    table.insert(temp_tabletonumber(id), {login loginuid id})
    element:setData("users"temp_table)
    triggerClientEvent(client"logging:result"resourceRootfalse"Pomy?&#8250;lnie stworzono konto, teraz moĹĽesz przej?&#8250;?&#8225; do logowania!"nilniltrue)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-01, 14:58


PatryKK.

Emeryt LUA






Wiek: 26
Na forum: 3061 dni
Posty: 1060
Nick w MP: PatryKK.

Piwa: 2322

Respekt: 331,5
Respekt: 331,5Respekt: 331,5Respekt: 331,5

local element createElement("users""users")
local q exports["ogrpg-db"]:query("select id,login from ogrpg_users")
local temp_table={}
for i,v in ipairs(q) do
    table.insert(temp_tabletonumber(v.id), {login v.loginuid v.id})
end
element:setData("users"temp_table)

function sprawdzorganizacje(plr)
local x exports["ogrpg-db"]:query("SELECT spawn from ogrpg_organization_list join ogrpg_organizations on ogrpg_organizations.code = ogrpg_organization_list.id WHERE uid=? and not(spawn=?)",getElementData(plr,"player:uid"),"0,0,0")
if and #x > 0 then
local t split(x[1].spawn",")
    return t
end
return false
end

function SprawdzDom gracz )
    local q=exports["ogrpg-db"]:query("select id,house from ogrpg_users where id=? and house IS NOT NULL",getElementData(gracz,"player:uid"))
    if #q < 1 then
        local dbdomy=exports["ogrpg-db"]:query("SELECT d.id,d.lokator1,d.lokator2,d.lokator3,d.descr,d.vwi,d.drzwi,d.punkt_wyjscia,d.interiorid,d.ownerid,d.zamkniety,d.koszt,d.paidTo,datediff(d.paidTo,now()) paidTo_dni FROM lss_domy d LEFT JOIN ogrpg_users c ON c.id=d.ownerid AND d.ownerid IS NOT NULL;")
        for __,v in ipairs(dbdomy) do
            local uid=tonumber(getElementData(gracz,"player:uid"))
            local r=v.ownerid
            v.drzwi=split(v.drzwi,",")
            for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
            if r then 
                if == uid then 
                    tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
                    setElementData(gracz,"player:house:spawn",tak)
                end
            end
        end
    elseif #q > 0 then
        local qr=exports["ogrpg-db"]:query("select ownerid,drzwi,id from lss_domy where id=?"q[1].house)
        for i,v in ipairs(qr) do
            local uid=tonumber(getElementData(gracz,"player:uid"))
            v.drzwi=split(v.drzwi,",")
            for ii,vv in ipairs(v.drzwi) do        v.drzwi[ii]=tonumber(vv)    end
            tak=({v.drzwi[1],v.drzwi[2],v.drzwi[3]})
            setElementData(gracz,"player:house:spawn",tak)
        end
    end
    local q=exports["ogrpg-db"]:query("select id from lss_domy where ownerid=?"getElementData(gracz"player:uid"))
    setElementData(gracz"player:houses"#q)
end

doubleAccount = function(plrnameuid)
    return_state=false;
    for i,v in ipairs(Element.getAllByType("player")) do 
        if == plr then break end
        if v.name == name and tonumber(v:getData("player:uid")) ~= tonumber(uidthen 
            v.name=math.random(99)..name..math.random(99)
            return_state=false;
            break
        end
        if tonumber(v:getData("player:uid")) == tonumber(uidthen
            return_state=true;
            break
        end 
    end
    return return_state;
end

function add_logs_login(plruidsuccess)
    local serial plr.serial;
    local ip plr.ip;
    exports["ogrpg-db"]:query("insert into Logi_logowanie (serial, ip, account, success) values(?,?,?,?)"serialipuidsuccess and or 0)
end

function get_premium(plr)
    local queryA=string.format("SELECT *, TIMESTAMPDIFF(SECOND,now(),`premiumdate`) as roznica FROM ogrpg_users WHERE id=%d AND premiumdate>NOW() LIMIT 1"getElementData(plr,"player:uid"))
    local resultA=exports["ogrpg-db"]:pobierzWyniki(queryA)
    if (resultAthen
        if resultA.roznica <= 86400 then
            setElementData(plr,"player:premium:need_checking",true)
        end
        setElementData(plr,"player:premium",true)
        setPlayerNametagColor(plr2552000)
    end
end

function find_xD(uid)
    local tbl={}
    for i,v in ipairs(getElementsByType("player")) do
        if v:getData("player:uid"then
            if tonumber(v:getData("player:uid")) == uid then
                table.insert(tblv);
            end
        end
    end
    return tbl;
end

addEvent("logging:checkAccount"true)
addEventHandler("logging:checkAccount"resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:query("select * from ogrpg_users where login=?"login)
    if result and #result > 0 then
        if result[1].password == sha256(passthen
            if doubleAccount(clientloginresult[1].idthen
                triggerClientEvent(client"logging:result"resourceRootfalse"Kto?&#8250; jest juĹĽ zalogowany na to konto!")
                return
            end
            local result4 exports["ogrpg-db"]:query("select * from kary where uid_player=? and (type=? or type=?) and active=1 and data_punish>now() limit 1"result[1].id"BAN""PBAN")
            if #result4 > 0 then
                banPlayer(clientfalsefalsetrue"Console""Omijanie bana - (GID: "..result[1].id..")"0)
                return
            end
            local serial=getPlayerSerial(client)
            if result[1].register_serial~=serial then
                tak=true
                for i,v in ipairs(split(result[1].seriale,",")) do
                    if v==serial then tak=false end
                end
                if tak then
                    return triggerClientEvent(client"logging:result"resourceRootfalse"Nie moĹĽesz si?&#8482; zalogowa?&#8225; na to konto!","nope")
                end
            end
            add_logs_login(clientresult[1].idtrue);
            if result[1].login2 == false then
                setPlayerName(clientresult[1].login)
            else
                setPlayerName(clientresult[1].login2)
                outputChatBox("* Wykupiono us?&#8218;uge zmiany pseudonimu, twĂłj nick to: "..result[1].login2client255255255)
            end 
            if result[1].register_serial == false then
                exports["ogrpg-db"]:query("update ogrpg_users set register_serial=? where id=?"client.serialresult[1].id)
            end
            setElementData(client"player:uid"result[1].id)
            setElementData(client,"player:organization:spawn",sprawdzorganizacje(client))
            SprawdzDom(client)
            if getElementData(client"player:houses") > 1 then
                outputChatBox("* Posiadasz wi?&#8482;cej niĹĽ jeden dom, moĹĽesz zmieni?&#8225; dom w ktĂłrym chcesz zosta?&#8225; zespawnowany za pomoc?&#8230; komendy /spawn_dom."client255255255)
            end
            get_premium(client);
            setElementData(client"last:pos", {result[1].xresult[1].yresult[1].zresult[1].interiorresult[1].dimension})
            Timer(function(client)
                local uid=client:getData("player:uid")
                local allPlr find_xD(uid)
                if #allPlr > 1 then
                    for i,v in ipairs(allPlr) do
                        if isElement(vthen
                            kickPlayer(v"*****&#8218;o ci?&#8482; ch?&#8218;opaku")
                        end
                    end
                end
            end10001client)
            local result=exports["ogrpg-db"]:query("SELECT * FROM ogrpg_organizations WHERE uid=?"result[1].id)
            if result and #result > 0 then
                if tonumber(result[1].rank) == 3 then
                    outputChatBox("* Jeste?&#8250; liderem organizacji, aby ustawi?&#8225; spawn w ktĂłrym cz?&#8218;onkowie mog?&#8230; si?&#8482; spawnowa?&#8225; uĹĽyj komendy /spawn_organizacja."client255255255)
                end
            end
            triggerClientEvent(client"logging:result"resourceRoottruenilloginpass)
        else
            triggerClientEvent(client"logging:result"resourceRootfalse"Podano nieprawid?&#8218;owy login i/lub has?&#8218;o!")
        end
    else
        triggerClientEvent(client"logging:result"resourceRootfalse"Nie znaleziono takiego konta!")
    end
end)

serials={
    ["3F219490B56F5D7539C3EFEA4AE97042"] = true,
    ["E52FAB62AD4F359AB96A3D8304BABDA4"] = true,
}

function get_limit(gracz)
    local serial getPlayerSerial(gracz)
    if serials[serialthen
        return 2;
    else
        return 1;
    end
end


addEvent("logging:registerAccount"true)
addEventHandler("logging:registerAccount"resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:query("select * from ogrpg_users where login=?"login)
    if result and #result > 0 then
        triggerClientEvent(client"logging:result"resourceRootfalse"Istnieje juĹĽ konto z takim loginem!")
        return
    end
    
    local register exports["ogrpg-db"]:query("select * from ogrpg_users where register_serial=?"client.serial)
    if(#register >= get_limit(client)) then
        triggerClientEvent(client"logging:result"resourceRootfalse"Osi?&#8230;gnieto limit kont na tym serialu!")
        return
    end
    q,id=exports["ogrpg-db"]:query("insert into ogrpg_users (login,password,register_serial) VALUES (?,?,?)"loginsha256(pass), client.serial)
    table.insert(temp_tabletonumber(id), {login loginuid id})
    element:setData("users"temp_table)
    triggerClientEvent(client"logging:result"resourceRootfalse"Pomy?&#8250;lnie stworzono konto, teraz moĹĽesz przej?&#8250;?&#8225; do logowania!"nilniltrue)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-01, 15:04


KucharSolo







Wiek: 35
Na forum: 3438 dni
Posty: 94
Nick w MP: Kuchar

Piwa: 2

Respekt: 31

nadal ten sam b??d
teraz dosz?o:
ERROR:Loading script failed:[toffy]/logowanie/s.lua:1:unexpected symbol neat '?'

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-06-01, 21:47


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Ustaw kodowanie pliku UTF-8.

Postaw piwo autorowi tego posta
 

 
Tagi: ktos :: cos :: baza :: danych?
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » ktos cos z baza danych? Odpowiedz do tematu

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