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

Wysłany: 2021-01-20, 11:03


NekeYT







Wiek: 23
Na forum: 2528 dni
Posty: 58
Nick w MP: Cytrus

Piwa: 6

Respekt: 50

panel logowanie nie dzia?a, wyskakuj? b??dy
ERROR: Client (krecik_2121) triggered serverside event logowanie:zaloguj, but event is not added serverside
ERROR: Client (krecik_2121) triggered serverside event logowanie:rejestracja, but event is not added serverside [DUP x6]

kod:
--[[
Skrypt zosta?‚ wykonany przez:
   -Asper (nezymr69@gmail.com),
   -Hardu?› ([email protected]).
]]

local db exports['polaczenie']

function getPlayersHavePremium()
    local q db:query('select * from users where not premium_date=000-00-00')
    return (and #q > 0 and #q) or 0
end

function loadPlayerData(playerresultpassword)
    local q_mute db:query('select * from kary where (serial=? or ip=? or nick=?) and active=1 and type=? and date>now() limit 1'getPlayerSerial(player), getPlayerIP(player), getPlayerName(player), 'mute')
    local q_ban db:query('select * from kary where (serial=? or ip=? or nick=?) and active=1 and type=? and date>now() limit 1'getPlayerSerial(player), getPlayerIP(player), getPlayerName(player), 'ban')

    if q_mute and #q_mute > 0 then
        outputChatBox('-------------------------------------------'player25500)
        outputChatBox('Jeste?› wyciszony!'player25500)
        outputChatBox('Osoba wyciszaj?…ca: '..q_mute[1]['admin'], player25500)
        outputChatBox('PowĂłd wyciszenia: '..q_mute[1]['reason'], player25500)
        outputChatBox('Czas wyciszenia: '..q_mute[1]['date'], player25500)
        outputChatBox('----------------------------------------'player25500)

        setElementData(player'user:mute'true)
    else
        db:query('update kary set active=0 where (serial=? or ip=? or nick=?) and type=? limit 1',getPlayerSerial(player), getPlayerIP(player), getPlayerName(player), 'mute')
    end

    if q_ban and #q_ban > 0 then
        triggerClientEvent('wybieramyspawn:logowanie'playerplayerresulttrue)
        triggerClientEvent(player'pokaz:bana'resourceRootq_ban)
        return
    else
        db:query('update kary set active=0 where (serial=? or ip=? or nick=?) and type=? limit 1',getPlayerSerial(player), getPlayerIP(player), getPlayerName(player), 'ban')
    end

    setPlayerName(playerresult[1]['login'])
    setPlayerMoney(playerresult[1]['money'])
    setElementHealth(playerresult[1]['health'])

    db:query('update users set lastlogin=now(), logged=1 where id=? limit 1'result[1]['id'])

    if result[1]['save'] == 1 then
        triggerClientEvent(player'saveDateToXML'resourceRootresult[1]['login'], password)
    end

    setElementData(player'user:dbid'result[1]['id'])
    setElementData(player'user:register'result[1]['registered'])
    setElementData(player'user:online'result[1]['online'])
    setElementData(player'user:sesion_online'0)
    setElementData(player'user:prawkoA'result[1]['prawkoA'])
    setElementData(player'user:prawkoB'result[1]['prawkoB'])
    setElementData(player'user:prawkoC'result[1]['prawkoC'])
    setElementData(player'user:prawkoL'result[1]['prawkoL'])
    setElementData(player'user:premiumDate'result[1]['premium_date'])
    setElementData(player'user:premiumPoints'result[1]['premium_points'])
    setElementData(player'user:achievements'fromJSON(result[1]['achievements']))
    setElementData(player'shaders'fromJSON(result[1]['shaders']))
    setElementData(player'settings'fromJSON(result[1]['settings']))
    setElementData(player'interaction:trigger''wymiany')

    setElementData(player"user:fid"result[1].faction)
    setElementData(player"user:frank"result[1].frank)
    setElementData(player"user:ftime"result[1].ftime)

    setElementData(player"user:oranga"result[1].orank)

    setElementData(player"licka:rybak"result[1].rybak == and false or true)

    local q4 db:query("select * from frakcje where id=?"result[1].faction)
    if #q4 > 0 then
        setElementData(player"user:fname"q4[1].frakcja)
        setElementData(player"user:fdata"q4)
    end

    local q3 db:query("select * from organizacje where id=?"result[1].org)
    if #q3 > 0 then
        setElementData(player"user:oname"q3[1].organizacja)
        setElementData(player"user:odata"q3)
    end

    if result[1]['cut'] == 'TAK' then
        setElementData(player'user:logged'true)
    end

    local lastPos false
    if result[1]['premium_date'] ~= '0000-00-00' then
        local q db:query("select * from users where premium_date<now() and id=?"result[1].id)
        if(and #q > 0)then
            outputChatBox("Twoje konto premium wygas?&#8218;o."player)
            db:query("update users set premium_date=? where id=?""0000-00-00"result[1].id)
            return
        end

        setElementData(player'user:premium'true)
        outputChatBox('Posiadasz konto premium aktywne do: '..result[1]['premium_date'], player2552550)
        lastPos fromJSON(result[1].pos)
    end

    local r db:query('select * from domki where wlasciciel=?'result[1]['id'])
    --local org db:query('select * from domki where organizacja=?'result[1].oname)
    triggerClientEvent('wybieramyspawn:logowanie'playerplayerresultfalselastPosrorg)
end

addEvent('logowanie:rejestracja'true)
addEventHandler('logowanie:rejestracja'resourceRoot, function(playerloginhasloemail)
    login escapeString(login)
    haslo escapeString(haslo)

    local czytaj db:query('SELECT * FROM users WHERE login=? limit 1'login)
    if czytaj and #czytaj > 0 then
        triggerClientEvent(player'addNotificationPanel'resourceRoot'Konto o takiej nazwie uĹĽytkownika juĹĽ istnieje.', {25500})
         return
    end

    local r db:query('select * from users where serial=? limit 1'getPlayerSerial(player))
    if and #r >= 2 then
        triggerClientEvent(player'addNotificationPanel'resourceRoot'MoĹĽesz posiada?&#8225; maksymalnie dwa konta.', {25500})
        return
    end

    local q db:query('INSERT INTO users (login,email,password,reputation,serial) VALUES (?,?,?,0,?)'loginemailpasswordHash(haslo'bcrypt', {}), getPlayerSerial(player))
    if not q then
        triggerClientEvent(player'addNotificationPanel'resourceRoot'Wyst?&#8230;pi?&#8218; b?&#8218;?&#8230;d podczas tworzenia konta. Zg?&#8218;o?&#8250; ten b?&#8218;?&#8230;d administratorowi na forum.', {2552550})
        return
    end

    local czytaj db:query('SELECT * FROM users WHERE login=? limit 1'login)
    if czytaj and #czytaj > 0 then
        loadPlayerData(playerczytajhaslo)
    end
end)

addEvent('logowanie:zaloguj'true)
addEventHandler('logowanie:zaloguj'resourceRoot, function(playerloginhaslo)
    login escapeString(login)
    haslo escapeString(haslo)

    local czytaj db:query('SELECT * FROM users WHERE login=? limit 1'login)
    if czytaj and #czytaj > 0 then
        if passwordVerify(hasloczytaj[1]['password']) then
            if tonumber(czytaj[1]['logged']) == 1 then
                triggerClientEvent(player'addNotificationPanel'resourceRoot'Podane konto jest aktualnie uĹĽywane.', {25500})
                return
            end

            loadPlayerData(playerczytajhaslo)
        else
            triggerClientEvent(player'addNotificationPanel'resourceRoot'Podane has?&#8218;o jest nieprawid?&#8218;owe.', {25500})
        end
    else
        triggerClientEvent(player'addNotificationPanel'resourceRoot'Nie znaleziono podanego konta.', {25500})
    end
end)

function zapiszGracza(player)
    local dbid getElementData(player'user:dbid')
    if not dbid then return end

    local q db:query('SELECT * FROM users WHERE id=? limit 1'dbid)
    if and #q > 0 then
        local achv toJSON((getElementData(player'user:achievements') or {}))
        local save getElementData(player'zapamietajLogin') or 0
        local health getElementHealth(player) or 100
        local shaders toJSON((getElementData(player'shaders') or {}))
        local settings toJSON((getElementData(player'settings') or {}))
        local premium_points getElementData(player'user:premiumPoints') or 0
        local online getElementData(player'user:online') or 0    
        local rybak getElementData(player"licka:rybak") or 0

        
        local x,y,getElementPosition(player)
        db:query('update users set save=?, achievements=?, health=?, shaders=?, settings=?, premium_points=?, online=?, rybak=?, pos=? where id=? limit 1'saveachvhealthshaderssettingspremium_pointsonlinerybaktoJSON({xyz}), dbid)
    end
end
addEventHandler('onPlayerQuit'root, function() zapiszGracza(sourceend)

addEvent('getSave'true)
addEventHandler('getSave'resourceRoot, function()
    local q db:query('SELECT * FROM users WHERE serial=? and save=1 limit 1'getPlayerSerial(client))
    if and #q > 0 then
        triggerClientEvent(client'setDates'resourceRoottrue)
        return
    end

    triggerClientEvent(client'setDates'resourceRootfalse)
end)

addEvent('logowanie:zrespGracza'true)
addEventHandler('logowanie:zrespGracza'resourceRoot, function(playerxyzint_dimhousefalse)
    local q db:query('select * from users where login=? limit 1'getPlayerName(player))
    if and #q > 0 then
        triggerClientEvent(player'loadingScreen'resourceRoot)

        fadeCamera(playerfalse)
        setElementFrozen(playertrue)
        setTimer(function()
            interior = (int_dim and #int_dim > 0) and int_dim[1] or 0
            dimension = (int_dim and #int_dim > 0) and int_dim[2] or 0

            fadeCamera(playertrue)

            setTimer(function()
                setElementFrozen(playerfalse)
            end10001)

            spawnPlayer(playerxyz90q[1]['skin'], interiordimension)
        end10001)

        setElementData(player,'wPaneluLogowania',nil)
        showChat(playertrue)
        showCursor(playerfalse)
        setElementData(player'pokaz:hud'true)
        setElementData(player'grey_shader'0)
        setCameraTarget(player,player)
        triggerClientEvent(player'stopMusic'resourceRoot)
    end
end)

addEvent('logowanie:zatwierdzPoradnik'true)
addEventHandler('logowanie:zatwierdzPoradnik'resourceRoot, function(playertype)
    type tonumber(type)

    if type == 1 then
        exports["polaczenie"]:query("UPDATE users SET tutorial=? WHERE login=? limit 1""TAK"getPlayerName(player))
    elseif type == 2 then
        exports["polaczenie"]:query("UPDATE users SET cut=? WHERE login=? limit 1""TAK"getPlayerName(player))
    end
end)

addEventHandler('onPlayerCommand'root, function(command)
    if not getElementData(source'user:logged') and getPlayerSerial(source) ~= '74AD615CFE02B293D95D63C9918358B3' and getPlayerSerial(source) ~= '69DC9557CEBBB00E7CDEAD6B7D029043' then
        cancelEvent()
    elseif command == 'register' then
        cancelEvent()
    elseif command == 'login' and getPlayerSerial(source) ~= '74AD615CFE02B293D95D63C9918358B3' and getPlayerSerial(source) ~= '69DC9557CEBBB00E7CDEAD6B7D029043' then
        cancelEvent()
    elseif command == 'logout' then
        cancelEvent()
    end
end)

function getPlayersOnline()
    local q db:query('select * from users where logged=1 limit 1')
    for i,v in pairs(q) do
        if not getPlayerFromName(v['login']) then
            db:query('update users set logged=0 where login=? limit 1'v['login'])
            break
        end
    end
end
getPlayersOnline()
setTimer(getPlayersOnline3000000)

addEventHandler('onPlayerQuit'root, function()
    local dbid getElementData(source'user:dbid')
    if not dbid then return end

    db:query('update users set logged=0 where id=? limit 1'dbid)
end)

addEventHandler('onPlayerLogout'root, function()
    cancelEvent()
end)

addEventHandler('onPlayerChangeNick'root, function()
    cancelEvent()
end)

function escapeString(text)
    local str string.gsub(tostring(text), "'"'')
    str string.gsub(str'"''')
    str string.gsub(str';''')
    str string.gsub(str'\''')
    str string.gsub(str'/*''')
    str string.gsub(str'*/''')
    str string.gsub(str"'"'')
    str string.gsub(str'`''')
    str string.gsub(str' ''')
    return str
function escapeString(text)
    local str string.gsub(tostring(text), "'"'')
    str string.gsub(str'"''')
    str string.gsub(str';''')
    str string.gsub(str'\''')
    str string.gsub(str'/*''')
    str string.gsub(str'*/''')
    str string.gsub(str"'"'')
    str string.gsub(str'`''')
    str string.gsub(str' ''')
    return str
    end
end


Ostatnio zmieniony przez Wilq 2021-01-20, 11:42, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-20, 11:43


Wilq







Wiek: 24
Na forum: 4429 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Czy eventy pr?bujesz wykona? z tego samego skryptu?
Czy wyst?puj? jakie? inne b??dy z tego skryptu?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2021-01-20, 11:50


NekeYT







Wiek: 23
Na forum: 2528 dni
Posty: 58
Nick w MP: Cytrus

Piwa: 6

Respekt: 50

"Wilq" napisał/a:

Czy eventy pr?bujesz wykona? z tego samego skryptu?
Czy wyst?puj? jakie? inne b??dy z tego skryptu?


Tak, eventy z tego samego skryptu, a b??dy tylko te, kt?re wypisa?em.

Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowania :: nie :: działa
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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