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

Wysłany: 2019-01-14, 11:13


XnoryzPL

Skrypter LUA






Wiek: 26
Na forum: 3389 dni
Posty: 44
Nick w MP: XnoryzPL

Piwa: 771

Respekt: 50

Witam mam problem z panelem logowanie a wy??cznie
z linijk? 219 oraz 220 w c_logging.lua

Problem z linijakmi 219 i 220:
setElementData(zmienna_gracza,"gracz_hud",true)
                setElementData(zmienna_gracza,"gracz_hud_wogole",true)

Ca?y kod:

if getElementData(localPlayer, "player:uid") then return end
local root = getRootElement()
local blur = exports['blur']
local startTicking = getTickCount()
local dxfont0_1 = dxCreateFont("font/1.ttf", 12) or 'default'
local dxfont1_1 = dxCreateFont("font/1.ttf", 14) or 'default'
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
local eithus_zaznaczone = dxCreateTexture('img/checkbox1.png', 'argb', true, 'clamp')
local eithus_zwykle = dxCreateTexture('img/checkbox2.png', 'argb', true, 'clamp')
local zaznaczone = false
ogloszenie=[[Witaj na serwerze It's Your World!

Adres forum; mta-its.pl
Adres ts3; iy-w.pl
Wersja serwera; 1.0

W?a?ciciele serwera;
- Rusek
- Shaman
- Kurianusz
- CrosRoad95


CREDITS;
Graphic; © Maker

Copyright © It's Your World
Wszelkie prawa zastrze?one!
]]

local blurStrength = 2

local function isNumber(tekst)   --- Prosta funkcja by Kurianusz sprawdza czy tekst to liczby
    return (string.match(tekst,"[^%d]") == nil) end

local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")


function renderblur()
    if blur == true then
        dxUpdateScreenSource(myScreenSource)

        dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
        dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
        dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);

        dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
    end
end
addEventHandler("onClientRender", root, renderblur)

addEventHandler("onClientResourceStop", resourceRoot,
function()
    if (blurShader) and blur then
        destroyElement(blurShader)
        blurShader = nil
    end
end)

--x,y=2075.74,-1187.70-- my width
--intro_step=math.random(0,850)

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, tick=getTickCount(), checkbox={} }

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end
local dist = 400
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
    local a = math.rad(270 - angler)
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function getCenter(sx,sy)
    local screenW, screenH = guiGetScreenSize()
    local x, y = (screenW - sx) /2,(screenH - sy) /2
    return x, y
end
posx,posy=getCenter(740,462)
function getCenter(sx,sy)
    local screenW, screenH = guiGetScreenSize()
    local x, y = (screenW - sx) /2,(screenH - sy) /2
    return x, y
end
posxx,posyy=getCenter(365,30)

mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)

-- KUREK TUTAJ BUTTON OD ZAPAMI?TNIA HAS?A I LOGINU W LOGOWANIU 
--[[

GUIEditor = {
    checkbox = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.checkbox[1] = guiCreateCheckBox(110, 441, 195, 21, "Pami?taj mnie! (w trakcie prac)", true, false)    
    end
)

addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(126, 284, 96, 43, tocolor(255, 255, 255, 255), false)
    end
)

--]]

aktualnie="logowanie"
function renderLoginBox()
    if sx < 1024 and sy < 768 then
        setTime(2,0)
        blur = false
        windowx, windowy=sx/2-768/2, sy/2-350/2
        dxDrawRectangle(windowx, windowy, 768, 350, tocolor(0, 0, 0, 200), false)
        dxDrawText("Aby zagra? na serwerze zmie? ro?dzielczo?? na min. 1024x768\nPrzepraszamy za utrudnienia.", windowx+768/2, windowy+350/2, 768, 350, tocolor(255, 0, 0, 200), 1.00, "clear", "center", "center", false, true, false, false, false)
        return
    end
    setTime(2,0)
    blur = false
    dxDrawImage(0*w, 0*h, 1370*w, 770*h, "backg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(428*w, 175*h, 500*w, 546*h, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(828*w, 175*h, 500*w, 546*h, "bc.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawRectangle(590*w, 462*h, 188*w, 46*h, tocolor(0, 0, 0, 200), false)
    dxDrawRectangle(590*w, 540*h, 188*w, 46*h, tocolor(0, 0, 0, 200), false)
    dxDrawText("Zaloguj", 815*w, 462*h, 549*w, 508*h, tocolor(255, 255, 255, 255), 1.20, dxfont0_1, "center", "center", false, false, false, false, false)
    dxDrawText("Rejestracja", 360*w, 620*h, 1006*w, 508*h, tocolor(255, 255, 255, 255), 1.20, dxfont0_1, "center", "center", false, false, false, false, false)
    dxDrawText("Login:", 594*w, 254*h, 777*w, 292*h, tocolor(255, 255, 255, 255), 1.20, dxfont1_1, "center", "center", false, false, false, false, false)
    dxDrawText("Haslo:", 594*w, 331*h, 777*w, 369*h, tocolor(255, 255, 255, 255), 1.20, dxfont1_1, "center", "center", false, false, false, false, false)
    local hype = interpolateBetween(0, 0, 0, -15, 100, 0, ((getTickCount() - startTicking) / 2500), "SineCurve")
    dxDrawImage(497*w, 49*h + hype, 387*w, 207*h, "img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    if isMouseIn(590*w, 462*h, 188*w, 46*h) then
    dxDrawImage(590*w, 462*h, 188*w, 2*h, "pasek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
    dxDrawRectangle(590*w, 462*h, 188*w, 2*h, tocolor(255, 255, 255, 200), false)
    end
    if isMouseIn(590*w, 540*h, 188*w, 46*h) then
    dxDrawImage(590*w, 540*h, 188*w, 2*h, "pasek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
    dxDrawRectangle(590*w, 540*h, 188*w, 2*h, tocolor(255, 255, 255, 200), false)
    end
    if getTickCount()<data.tick then
        dxDrawText(data.info, 351*w, 221*h, 1016*w, 249*h, tocolor(255, 0, 0, 200), 1.00, "sans", "center", "center", false, true, true, false, false)
    end
    local x,y=getPointFromDistanceRotation(1838.10, -1564.02, dist, angler)
    setCameraMatrix(x,y,120, -1564.02, 60.57)
    angler=(angler+0.05)
    if zaznaczone then
        dxDrawImage(590*w, 404*h, 50*w, 50*h, eithus_zaznaczone, 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawImage(590*w, 404*h, 50*w, 50*h, eithus_zwykle, 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    dxDrawText("Zapami?taj has?o", 649*w, 410*h, 781*w, 449*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, true, false, false, false)
end





addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(590*w, 462*h, 188*w, 46*h) and data.showed then
                local login=guiGetText(data.button[1])
                local pass=guiGetText(data.button[2])
                local zapamietaj=zaznaczone
                --local checkbox = guiCreateCheckBox(590*w, 462*h, 188*w, 46*h, "Pami?taj mnie! (w trakcie prac)", true, false)  
                if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                                                                                                           data.info="Login i/lub has?o musz? mie? od 3 do 22 znak?w."
                    data.tick=getTickCount()+5000
                    return
                end
                triggerServerEvent("logging:checkAccount", resourceRoot, login, pass, zapamietaj)
         elseif isMouseIn(590*w, 540*h, 188*w, 46*h) and data.showed then
                local login=guiGetText(data.button[1])
                local pass=guiGetText(data.button[2])
                if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                    data.info="Login i/lub has?o musz? mie? od 3 do 22 znak?w."
                    data.tick=getTickCount()+5000
                    return
                end
                triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        elseif isMouseIn(590*w, 404*h, 50*w, 50*h) and data.showed then
            zaznaczone = not zaznaczone
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        -- Usuwamy elementy
        local time = getRealTime()
        setTime(time.hour,time.minute)
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        --destroyElement(data.button[3])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=info
        data.tick=getTickCount()+5000
                setElementData(zmienna_gracza,"gracz_hud",true)
                setElementData(zmienna_gracza,"gracz_hud_wogole",true)
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 0.5)
    setPlayerHudComponentVisible("all",false)
    guiSetInputMode("no_binds_when_editing")
    --setElementData(localPlayer,"status","Loguje si?")
    --setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    if sx < 1024 and sy < 768 then return end
    data.button[1]=guiCreateEdit(600*w, 292*h, 172*w, 29*h, "", false)
    data.button[2]=guiCreateEdit(600*w, 369*h, 172*w, 29*h, "", false)
--    data.button[3]=guiCreateCheckBox(640*w, 426*h, 133*w, 36*h, "Zapami?taj mnie", false, false) -- zast?piony dxdraw
    guiEditSetMasked(data.button[2], true)
    loadSavedAccount()
    localPlayer:setData("player:hud_visible", true)
end)

addEvent("createsaved:login",true)
addEventHandler("createsaved:login",localPlayer,function(l,h)
if not fileExists("savedpassword.txt") then
local file=fileCreate("savedpassword.txt")
if file then
str=""..l..","..teaEncode(h, "6N5u7MCtZgp3PbJVvJKbzuDk")..""
if not fileWrite(file, str) then
fileDelete("savedpassword.txt")
end
fileClose(file)
end
end
end)

function loadSavedAccount()
if File.exists("savedpassword.txt") then
file = fileOpen("savedpassword.txt", true)
if not file then return end
local txt = fileRead(file, fileGetSize(file)) or "" 
local tabela=split(txt, ",")
guiSetText(data.button[1], tabela[1])
guiSetText(data.button[2], teaDecode(tabela[2], "6N5u7MCtZgp3PbJVvJKbzuDk"))
--guiCheckBoxSetSelected(data.button[3],true)
fileClose(file)
end
end

addEvent("deletesaved:login",true)
addEventHandler("deletesaved:login",localPlayer,function()
if fileExists("savedpassword.txt") then
fileDelete("savedpassword.txt")
end
end)

[/list]

Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-14, 12:15


Wilq







Wiek: 24
Na forum: 4570 dni
Posty: 3409

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

?le wskazywa?e? gracza - po stronie klienta jest to getLocalPlayer() / localPlayer.

if getElementData(localPlayer, "player:uid") then return end
local root = getRootElement()
local blur = exports['blur']
local startTicking = getTickCount()
local dxfont0_1 = dxCreateFont("font/1.ttf", 12) or 'default'
local dxfont1_1 = dxCreateFont("font/1.ttf", 14) or 'default'
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()
local eithus_zaznaczone = dxCreateTexture('img/checkbox1.png', 'argb', true, 'clamp')
local eithus_zwykle = dxCreateTexture('img/checkbox2.png', 'argb', true, 'clamp')
local zaznaczone = false
ogloszenie=[[Witaj na serwerze It's Your World!

Adres forum; mta-its.pl
Adres ts3; iy-w.pl
Wersja serwera; 1.0

W?a?ciciele serwera;
- Rusek
- Shaman
- Kurianusz
- CrosRoad95


CREDITS;
Graphic; &copy; Maker

Copyright &copy; It's Your World
Wszelkie prawa zastrze?one!
]]

local blurStrength = 2

local function isNumber(tekst)   --- Prosta funkcja by Kurianusz sprawdza czy tekst to liczby
    return (string.match(tekst,"[^%d]") == nil) end

local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")


function renderblur()
    if blur == true then
        dxUpdateScreenSource(myScreenSource)

        dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
        dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
        dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);

        dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
    end
end
addEventHandler("onClientRender", root, renderblur)

addEventHandler("onClientResourceStop", resourceRoot,
function()
    if (blurShader) and blur then
        destroyElement(blurShader)
        blurShader = nil
    end
end)

--x,y=2075.74,-1187.70-- my width
--intro_step=math.random(0,850)

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, tick=getTickCount(), checkbox={} }

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end
local dist = 400
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
    local a = math.rad(270 - angler)
    local dx = math.cos(a) * dist;
    local dy = math.sin(a) * dist;
    return x+dx, y+dy;
end

function getCenter(sx,sy)
    local screenW, screenH = guiGetScreenSize()
    local x, y = (screenW - sx) /2,(screenH - sy) /2
    return x, y
end
posx,posy=getCenter(740,462)
function getCenter(sx,sy)
    local screenW, screenH = guiGetScreenSize()
    local x, y = (screenW - sx) /2,(screenH - sy) /2
    return x, y
end
posxx,posyy=getCenter(365,30)

mojeW,mojeH = 1366, 768
sW,sH = guiGetScreenSize()
w, h = (sW/mojeW), (sH/mojeH)

-- KUREK TUTAJ BUTTON OD ZAPAMI?TNIA HAS?A I LOGINU W LOGOWANIU 
--[[

GUIEditor = {
    checkbox = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
    function()
        GUIEditor.checkbox[1] = guiCreateCheckBox(110, 441, 195, 21, "Pami?taj mnie! (w trakcie prac)", true, false)    
    end
)

addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(126, 284, 96, 43, tocolor(255, 255, 255, 255), false)
    end
)

--]]

aktualnie="logowanie"
function renderLoginBox()
    if sx < 1024 and sy < 768 then
        setTime(2,0)
        blur = false
        windowx, windowy=sx/2-768/2, sy/2-350/2
        dxDrawRectangle(windowx, windowy, 768, 350, tocolor(0, 0, 0, 200), false)
        dxDrawText("Aby zagra? na serwerze zmie? ro?dzielczo?? na min. 1024x768\nPrzepraszamy za utrudnienia.", windowx+768/2, windowy+350/2, 768, 350, tocolor(255, 0, 0, 200), 1.00, "clear", "center", "center", false, true, false, false, false)
        return
    end
    setTime(2,0)
    blur = false
    dxDrawImage(0*w, 0*h, 1370*w, 770*h, "backg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(428*w, 175*h, 500*w, 546*h, "bg.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(828*w, 175*h, 500*w, 546*h, "bc.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawRectangle(590*w, 462*h, 188*w, 46*h, tocolor(0, 0, 0, 200), false)
    dxDrawRectangle(590*w, 540*h, 188*w, 46*h, tocolor(0, 0, 0, 200), false)
    dxDrawText("Zaloguj", 815*w, 462*h, 549*w, 508*h, tocolor(255, 255, 255, 255), 1.20, dxfont0_1, "center", "center", false, false, false, false, false)
    dxDrawText("Rejestracja", 360*w, 620*h, 1006*w, 508*h, tocolor(255, 255, 255, 255), 1.20, dxfont0_1, "center", "center", false, false, false, false, false)
    dxDrawText("Login:", 594*w, 254*h, 777*w, 292*h, tocolor(255, 255, 255, 255), 1.20, dxfont1_1, "center", "center", false, false, false, false, false)
    dxDrawText("Haslo:", 594*w, 331*h, 777*w, 369*h, tocolor(255, 255, 255, 255), 1.20, dxfont1_1, "center", "center", false, false, false, false, false)
    local hype = interpolateBetween(0, 0, 0, -15, 100, 0, ((getTickCount() - startTicking) / 2500), "SineCurve")
    dxDrawImage(497*w, 49*h + hype, 387*w, 207*h, "img/logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    if isMouseIn(590*w, 462*h, 188*w, 46*h) then
    dxDrawImage(590*w, 462*h, 188*w, 2*h, "pasek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
    dxDrawRectangle(590*w, 462*h, 188*w, 2*h, tocolor(255, 255, 255, 200), false)
    end
    if isMouseIn(590*w, 540*h, 188*w, 46*h) then
    dxDrawImage(590*w, 540*h, 188*w, 2*h, "pasek.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
    dxDrawRectangle(590*w, 540*h, 188*w, 2*h, tocolor(255, 255, 255, 200), false)
    end
    if getTickCount()<data.tick then
        dxDrawText(data.info, 351*w, 221*h, 1016*w, 249*h, tocolor(255, 0, 0, 200), 1.00, "sans", "center", "center", false, true, true, false, false)
    end
    local x,y=getPointFromDistanceRotation(1838.10, -1564.02, dist, angler)
    setCameraMatrix(x,y,120, -1564.02, 60.57)
    angler=(angler+0.05)
    if zaznaczone then
        dxDrawImage(590*w, 404*h, 50*w, 50*h, eithus_zaznaczone, 0, 0, 0, tocolor(255, 255, 255, 255), false)
    else
        dxDrawImage(590*w, 404*h, 50*w, 50*h, eithus_zwykle, 0, 0, 0, tocolor(255, 255, 255, 255), false)
    end
    dxDrawText("Zapami?taj has?o", 649*w, 410*h, 781*w, 449*h, tocolor(255, 255, 255, 255), 1.00, dxfont0_1, "center", "center", false, true, false, false, false)
end





addEventHandler("onClientClick", root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(590*w, 462*h, 188*w, 46*h) and data.showed then
                local login=guiGetText(data.button[1])
                local pass=guiGetText(data.button[2])
                local zapamietaj=zaznaczone
                --local checkbox = guiCreateCheckBox(590*w, 462*h, 188*w, 46*h, "Pami?taj mnie! (w trakcie prac)", true, false)  
                if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                                                                                                           data.info="Login i/lub has?o musz? mie? od 3 do 22 znak?w."
                    data.tick=getTickCount()+5000
                    return
                end
                triggerServerEvent("logging:checkAccount", resourceRoot, login, pass, zapamietaj)
         elseif isMouseIn(590*w, 540*h, 188*w, 46*h) and data.showed then
                local login=guiGetText(data.button[1])
                local pass=guiGetText(data.button[2])
                if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
                    data.info="Login i/lub has?o musz? mie? od 3 do 22 znak?w."
                    data.tick=getTickCount()+5000
                    return
                end
                triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
        elseif isMouseIn(590*w, 404*h, 50*w, 50*h) and data.showed then
            zaznaczone = not zaznaczone
        end
    end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
    if not info then info="" end
    if value then
        data.showed=false
        showZones(data.misc)
        -- Usuwamy elementy
        local time = getRealTime()
        setTime(time.hour,time.minute)
        destroyElement(data.button[1])
        destroyElement(data.button[2])
        --destroyElement(data.button[3])
        removeEventHandler("onClientRender", root, renderLoginBox)
    else
        data.info=info
        data.tick=getTickCount()+5000
        setElementData(localPlayer,"gracz_hud",true)
        setElementData(localPlayer,"gracz_hud_wogole",true)
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    showChat(false)
    showCursor(true)
    fadeCamera(true)
    data.showed=true
    setElementAlpha(localPlayer,0)
    data.misc=playSound("misc/intro.mp3",true)
    setSoundVolume(data.misc, 0.5)
    setPlayerHudComponentVisible("all",false)
    guiSetInputMode("no_binds_when_editing")
    --setElementData(localPlayer,"status","Loguje si?")
    --setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender", root, renderLoginBox)
    if sx < 1024 and sy < 768 then return end
    data.button[1]=guiCreateEdit(600*w, 292*h, 172*w, 29*h, "", false)
    data.button[2]=guiCreateEdit(600*w, 369*h, 172*w, 29*h, "", false)
--    data.button[3]=guiCreateCheckBox(640*w, 426*h, 133*w, 36*h, "Zapami?taj mnie", false, false) -- zast?piony dxdraw
    guiEditSetMasked(data.button[2], true)
    loadSavedAccount()
    localPlayer:setData("player:hud_visible", true)
end)

addEvent("createsaved:login",true)
addEventHandler("createsaved:login",localPlayer,function(l,h)
if not fileExists("savedpassword.txt") then
local file=fileCreate("savedpassword.txt")
if file then
str=""..l..","..teaEncode(h, "6N5u7MCtZgp3PbJVvJKbzuDk")..""
if not fileWrite(file, str) then
fileDelete("savedpassword.txt")
end
fileClose(file)
end
end
end)

function loadSavedAccount()
if File.exists("savedpassword.txt") then
file = fileOpen("savedpassword.txt", true)
if not file then return end
local txt = fileRead(file, fileGetSize(file)) or "" 
local tabela=split(txt, ",")
guiSetText(data.button[1], tabela[1])
guiSetText(data.button[2], teaDecode(tabela[2], "6N5u7MCtZgp3PbJVvJKbzuDk"))
--guiCheckBoxSetSelected(data.button[3],true)
fileClose(file)
end
end

addEvent("deletesaved:login",true)
addEventHandler("deletesaved:login",localPlayer,function()
if fileExists("savedpassword.txt") then
fileDelete("savedpassword.txt")
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-01-14, 13:15


XnoryzPL

Skrypter LUA






Wiek: 26
Na forum: 3389 dni
Posty: 44
Nick w MP: XnoryzPL

Piwa: 771

Respekt: 50

Teraz mam problem z 88 linijk?
z s_logging



if(tonumber(q[1].logowania_nagroda)<q3[1].logowania_nagroda)then



Ca?y kod

--[[
     Panel Logowania by Kurianusz @2016 . 
     Regulamin /Licencja
     Korzystanie z tego kodu tylko je?eli posiadasz tzw. copyrights. Zakaz usuwania tej notatki!
     Pami?taj ?e nielegalne korzystanie z kodu podpada pod kodeks karny :> Tak samo jak usuni?cie tej notatki!
]]



function sprawdzorganizacje(plr)
local x = exports['ogrpg-db']:dbGet("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 x and #x > 0 then
local t = split(x[1].spawn, ",")
    return t
end
return false
end

function getAdmin(plr,level)
    if level then
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=? AND level=?", getPlayerSerial(plr), level)
        if result and #result > 0 then
            return true
        else
            return false
        end
    else
        local result=exports["ogrpg-db"]:dbGet("SELECT * from ogrpg_admins WHERE serial=?", getPlayerSerial(plr))
        if result and #result > 0 then
            return true
        else
            return false
        end
    end
end

addEvent("logging:checkAccount", true)
addEventHandler("logging:checkAccount", resourceRoot, function(login,pass,save)
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        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", resourceRoot, false, "Nie mo?esz si? zalogowa? na to konto!","nope")
            end
        end
        if result[1].login == login and result[1].pass == md5(pass) then
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET pass=? WHERE login=?",teaEncode(pass,"Trujeczka"),login)
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Zaaktualizowano twoj profil! Zaloguj sie ponownie!.","git")
            return
        end
        if result[1].login == login and result[1].pass == teaEncode(pass,"Ryjek") then
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET pass=? WHERE login=?",teaEncode(pass,"Trujeczka"),login)
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Zaaktualizowano twoj profil! Zaloguj sie ponownie!.","git")
            return
        end
        if result[1].login == login and result[1].pass == teaEncode(pass,"Trujeczka") then
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET pass=? WHERE login=?",teaEncode(pass,"*****"),login)
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Zaaktualizowano twoj profil! Zaloguj sie ponownie!.","git")
            return
        end
        if result[1].login == login and result[1].pass == teaEncode(pass,"*****") then
            local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET pass=? WHERE login=?",teaEncode(pass,"wypierdalacchuje"),login)
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Zaaktualizowano twoj profil! Zaloguj sie ponownie!.","git")
            return
        end
        if result[1].login == login and result[1].pass == teaEncode(pass,"wypierdalacchuje") then
            for i,player in pairs(getElementsByType("player")) do
                if getElementData(player,"player:uid") == result[1].id then
                triggerClientEvent(client, "logging:result", resourceRoot, false, "Kto? jest zalogowany na to konto!!!!!.","blad")
                return
            end
            end
            --local result2=exports['ogrpg-db']:dbGet("SELECT login2 from ogrpg_users where id=?",result[1].id)
            if result[1].login2 == false then
            setPlayerName(client, login)
            else
            setPlayerName(client, result[1].login2)
            triggerClientEvent(client, "iyw_notifications:send", client, "info", "Wykupiono us?uge zmiana pseudonimu, tw?j nick to: "..result[1].login2.."")
            end
            q=exports["ogrpg-db"]:dbGet("select logowania_nagroda from ogrpg_users where id=? limit 1",result[1].id)
            exports["ogrpg-db"]:dbSet("update ogrpg_users set logowania_nagroda=logowania_nagroda+1 WHERE DATE(ostatnio_online) = DATE(NOW() - INTERVAL 1 DAY) and id=? limit 1",result[1].id)
            q3=exports["ogrpg-db"]:dbGet("select logowania_nagroda from ogrpg_users where id=? limit 1",result[1].id)
            if(tonumber(q[1].logowania_nagroda)<q3[1].logowania_nagroda)then
                nagrody[q3[1].logowania_nagroda](client)
                if(q3[1].logowania_nagroda==7)then
                    exports["ogrpg-db"]:dbSet("update ogrpg_users set logowania_nagroda=0 WHERE DATE(ostatnio_online) = DATE(NOW() - INTERVAL 1 DAY) and id=? limit 1",result[1].id)
                end
            else
                exports["ogrpg-db"]:dbSet("update ogrpg_users set logowania_nagroda=0 WHERE DATE(ostatnio_online)<DATE(NOW() - INTERVAL 1 DAY) and id=? limit 1",result[1].id)
            end
            if(save) then
                triggerClientEvent(client, "createsaved:login",client,login,pass)
            else
                triggerClientEvent(client, "deletesaved:login",client)
            end
            exports["ogrpg-db"]:dbSet("update ogrpg_users set ostatnio_online=NOW() where id=?", result[1].id)
            setElementData(client, "player:uid", result[1].id)
            triggerClientEvent(client, "logging:result", resourceRoot, true, "Zalogowa?e? si? pomyslnie","git")
            triggerEvent("SprawdzDom",root,client)
            setElementData(client,"player:organization:spawn",sprawdzorganizacje(client))
            setElementData(client,"p:title",result[1].rp_tytul)
            if result[1].register_serial == false then
            --local query=exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET register_serial=? WHERE login=?",getPlayerSerial(client),login)
            end
            local logs=exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_logs_login (name,serial,data) VALUES (?,?,NOW())", string.format(login.."("..result[1].id..")"),getPlayerSerial(client))
        else
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Podane dane s? nieprawid?owe.","blad")
        end
    else
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login nie istnieje w bazie.","blad")
    end
end)
local maks_ilosc_kont = 2 -- Maksymalna ilosc kont do rejestracji
addEvent("logging:newAccount", true)
addEventHandler("logging:newAccount", resourceRoot, function(login,pass)
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE register_serial=?", getPlayerSerial(client))
    if result and #result >= maks_ilosc_kont then
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Na ten serial zostala utworzona maksymalna ilosc kont.","blad")
    return end
    local result=exports["ogrpg-db"]:dbGet("SELECT * FROM ogrpg_users WHERE login=?", login)
    if result and #result > 0 then
        triggerClientEvent(client, "logging:result", resourceRoot, false, "Podany login ju? istnieje w bazie.","blad")
    else
        local query=exports["ogrpg-db"]:dbSet("INSERT INTO ogrpg_users (login,pass,register_serial,changedpw) VALUES (?,?,?,?)", login, teaEncode(pass,"wypierdalacchuje"),getPlayerSerial(client),1)
        if query then
            triggerClientEvent(client, "logging:result", resourceRoot, false, "Pomyslnie zarejestrowales(as) sie!","git")
            setElementData(client, "player:logged", true)
        end
    end
end)


nagrody={
[1]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To twoj pierwszy dzien kiedy jestes u nas pod rzad! Niedlugo otrzymasz na nagrode")
end,
[2]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j drugi dzie? kiedy jeste? u nas pod rz?d! Otrzymujesz 500PLN!")
    plr:giveMoney(500)
end,
[3]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j trzeci dzie? kiedy jeste? u nas pod rz?d! Otrzymujesz 600PLN!")
    plr:giveMoney(600)
end,
[4]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j czwarty dzie? kiedy jeste? u nas pod rz?d! Otrzymujesz 750PLN!")
    plr:giveMoney(750)
end,
[5]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j pi?ty dzie? kiedy jeste? u nas pod rz?d! Otrzymujesz 900PLN!")
    plr:giveMoney(900)
end,
[6]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j sz?sty dzie? kiedy jeste? u nas pod rz?d! Otrzymujesz 1000PLN!")
    plr:giveMoney(1000)
end,
[7]=function(plr)
    triggerClientEvent(client, "iyw_notifications:send", client, "info", "To tw?j si?dmy dzie? kiedy jeste? u nas pod rz?d! 1 punkt premium!")
    exports["ogrpg-db"]:dbSet("update ogrpg_users set pp=pp+1 where id=? limit 1",plr:getData("player:uid"))
end,
}
 


Postaw piwo autorowi tego posta
 

 
Tagi: panel :: logowanie
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