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

Wysłany: 2021-03-19, 10:57


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

Witam chcialem zrobic zapamietywanie w xml do logowania lecz cos nie dziala w db3 taki blad
Kod:

WARNING pystories-logging\c_logging.lua:233: Bad argument @ 'xmlFindChild' [Expected xml-node at argument 1, got boolean]

Kod:

WARNING pystories-logging\c_logging.lua:234: Bad argument @ 'xmlFindChild' [Expected xml-node at argument 1, got boolean]


tutaj kod

setWorldSoundEnabled(00falsetrue)
setWorldSoundEnabled(029falsetrue)
setWorldSoundEnabled(030falsetrue)
setWorldSoundEnabled(05falsetrue)
setAmbientSoundEnabled"general"false )
setAmbientSoundEnabled"gunfire"false )


local screenWscreenH guiGetScreenSize()

czas getTickCount()
function roundedRectangle(xyrxrycolorradius)
    rx rx radius 2
    ry ry radius 2
    x radius
    y radius

    if (rx >= 0) and (ry >= 0then
        dxDrawRectangle(xyrxrycolor)
        dxDrawRectangle(xradiusrxradiuscolor)
        dxDrawRectangle(xryrxradiuscolor)
        dxDrawRectangle(radiusyradiusrycolor)
        dxDrawRectangle(rxyradiusrycolor)

        dxDrawCircle(xyradius180270colorcolor7)
        dxDrawCircle(rxyradius270360colorcolor7)
        dxDrawCircle(rxryradius090colorcolor7)
        dxDrawCircle(xryradius90180colorcolor7)
    end
end


local sw,sh guiGetScreenSize()
local zoom 1
if sw 1920 then
    zoom math.min(21920 sw)
end

if getElementData(localPlayer"player:sid"then return end

local root getRootElement()
local resourceRoot getResourceRootElement(getThisResource())
local screenWidthscreenHeight guiGetScreenSize()



local f1dxCreateFont("uni.otf"13/zoom)
local f2dxCreateFont("calibrib.ttf"10/zoom)
local dxfont1_normal dxCreateFont("normal.ttf"10/zoom)
local dxfont2_normal dxCreateFont("normal.ttf"12/zoom)
local dxfont3_normal dxCreateFont("normal.ttf"11/zoom)
local myScreenSource dxCreateScreenSource(screenWidthscreenHeight)


local f2ffdxCreateFont("calibrib.ttf"20/zoom)
local f1ffdxCreateFont("normal.ttf"15/zoom)



local checkbox = {}
checkbox.login nil 


local sx,sy=guiGetScreenSize()
local data={ showed=nilbutton={}, info=nilmisc=nil, }

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 100
local angler 0
function getPointFromDistanceRotation(xydistangler)
    local a math.rad(90 angler)
    local dx math.cos(a) * dist;
    local dy math.sin(a) * dist;
    return x+dxy+dy;
end

function renderLoginBox()
    dxDrawImage(00sxsy"bglog.png"000tocolor(255255255255), false)
       dxDrawImage(screenW 0.3438screenH 0.1861screenW 0.3125screenH 0.6287"panellog.png"000tocolor(255255255255), false)
        if isMouseIn(screenW 0.3901screenH 0.5769screenW 0.0922screenH 0.0407then
          roundedRectangle(screenW 0.3901screenH 0.5769screenW 0.0922screenH 0.0407,  tocolor(555), 15/zoom)
        else
        roundedRectangle(screenW 0.3901screenH 0.5769screenW 0.0922screenH 0.0407,  tocolor(101010), 15/zoom)
        end
        if isMouseIn(screenW 0.5167screenH 0.5769screenW 0.0922screenH 0.0407then
          roundedRectangle(screenW 0.5167screenH 0.5769screenW 0.0922screenH 0.0407,  tocolor(555), 15/zoom)
        else
        roundedRectangle(screenW 0.5167screenH 0.5769screenW 0.0922screenH 0.0407,  tocolor(101010), 15/zoom)
        end        
        dxDrawText("ZALOGUJ"screenW 0.3896screenH 0.5750screenW 0.4833screenH 0.6185tocolor(255255255255), 1.00f1"center""center"falsefalsefalsefalsefalse)
        dxDrawText("ZAREJESTRUJ"screenW 0.5161screenH 0.5750screenW 0.6099screenH 0.6185tocolor(255255255255), 1.00f1"center""center"falsefalsefalsefalsefalse)
        if data.info then
        dxDrawText(data.infoscreenW 0.4031screenH 0.6398screenW 0.5969screenH 0.7315tocolor(25500255), 1.00f2"center""center"falsefalsefalsefalsefalse)
end
        dxDrawText("Zapami?taj mnie", (1920/2), 658lefttoptocolor(150150150255), 1f1"center""center"falsefalsefalsefalsefalse)
        if checkbox.login == true then 
            dxDrawRectangle((1920/2)-956472020tocolor(2552040255), false)
        elseif checkbox.login == false then 
            dxDrawRectangle((1920/2)-956472020tocolor(404040255), false)
        end
--dxDrawText(guiGetText(zaloguj), 802/zoom360/zoom1166/zoom414/zoomtocolor(255255255255), 1.00dxfont1_normal"left""center"falsefalsetruefalsefalse)
--dxDrawText(string.gsub(guiGetText(zarejestruj), ".""*"), 800/zoom472/zoom1166/zoom528/zoomtocolor(255255255255), 1dxfont2_normal"left""center"falsefalsetruefalsefalse)

end






addEventHandler("onClientClick"root, function(bs)
    if == "left" and == "down" then 
        if isMouseIn((1920/2)-956472020then 
            if checkbox.login == false then 
                checkbox.login true 
            else
                checkbox.login false 
            end 
        end
    end
end)

addEvent("zapamietajMnie"true)
addEventHandler"zapamietajMnie"root, function(  )
    login =  editbox:dxGetEditText("login")
    pass =  editbox:dxGetEditText("has?o")
    if checkbox.login == true then 
    if not xml then
        xml xmlCreateFile("zapamietaj.xml","login")
        loginXML xmlCreateChild(xml,"login")
        passXML xmlCreateChild(xml,"password")
        checkboxXML xmlCreateChild(xml,"checkboxState")
        xmlNodeSetValue(loginXMLlogin)
        xmlNodeSetValue(passXMLpass)
        xmlNodeSetValue(checkboxXML"1")
        xmlSaveFile(xml)
      else
        loginXML xmlFindChild(xml,"login",0)
        passXML xmlFindChild(xml,"password",0)
        checkboxXML xmlFindChild(xml,"checkboxState",0)
        end
    end 
end)
        

addEvent("usunXML"true)
addEventHandler"usunXML"root, function(  )
    if checkbox.login == false then 
    fileDelete ("zapamietaj.xml")
    end 
end)

addEventHandler("onClientClick"root, function(btn,state)
    if btn=="left" and state=="down" then
        if isMouseIn(screenW 0.3901screenH 0.5769screenW 0.0922screenH 0.0407) and data.showed then
            local login exports['pystories_editbox']:dxGetEditText("login")
            local pass exports['pystories_editbox']:dxGetEditText("haslo")
            if string.len(login) < or string.len(pass) < 2 then
                data.info="Nale?y wype?ni? wszystkie pola."
                return
            end
            triggerServerEvent("logging:checkAccount"resourceRootloginpass)
        end
        
        if isMouseIn(screenW 0.5167screenH 0.5769screenW 0.0922screenH 0.0407) and data.showed then
            local login exports['pystories_editbox']:dxGetEditText("login")
            local pass exports['pystories_editbox']:dxGetEditText("haslo")
            if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < or string.len(pass) < 3 then
                data.info="Login i has?o powinno zawiera? od 3 do 22 znak?w."
                return
            end
            local xml xmlLoadFile("zapamietaj.xml")
            local checkXML xmlFindChild(xml,"checkboxState"0)
            local checkGetChildValue xmlNodeGetValue(checkXML)
                if checkGetChildValue == "1" then 
                logXML xmlFindChild(xml,"login"0)
                passXML xmlFindChild(xml,"password"0)
                logGetChildValue =  xmlNodeGetValue(logXML)
                passGetChildValue xmlNodeGetValue(passXML)
                checkbox.login true 
                exports['pystories_editbox']:dxSetEditText("login"logGetChildValue)
                exports['pystories_editbox']:dxSetEditText("has?o"passGetChildValue)
                else 
                    checkbox.login false  
                end                   
            triggerServerEvent("logging:newAccount"resourceRootloginpass)
        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
        exports['pystories_editbox']:dxDestroyEdit("login")
        exports['pystories_editbox']:dxDestroyEdit("haslo")
        removeEventHandler("onClientRender"rootrenderLoginBox)
    else
        data.info=tostring(info)
        setTimer(function() data.info=nil end30001)
    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)
    showPlayerHudComponent("radar",false)
    setSoundVolume(data.misc1.0)
    showPlayerHudComponent("all",false)
    guiSetInputMode("no_binds_when_editing")
    setElementData(localPlayer,"status","Loguje si?")
    local xml xmlLoadFile("zapamietaj.xml")
    if not xml then 
        checkbox.login false 
    end 
    local checkXML xmlFindChild(xml,"checkboxState"0)
    local checkGetChildValue xmlNodeGetValue(checkXML)
    if checkGetChildValue == "1" then 
        logXML xmlFindChild(xml,"login"0)
        passXML xmlFindChild(xml,"password"0)
        logGetChildValue =  xmlNodeGetValue(logXML)
        passGetChildValue xmlNodeGetValue(passXML)
        
        checkbox.login true 
        exports['pystories_editbox']:dxSetEditText("login"logGetChildValue)
        exports['pystories_editbox']:dxSetEditText("has?o"passGetChildValue)
        else 
            checkbox.login false  
    end  
    
    --setElementData(localPlayer,"player:logged",false)
    addEventHandler("onClientRender"rootrenderLoginBox)
    local nick getPlayerNamelocalPlayer )
                exports['pystories_editbox']:dxCreateEdit("login""""Wpisz sw?j login"screenW 0.4172screenH 0.3333screenW 0.1807screenH 0.0472false255255falsefalse);

            exports['pystories_editbox']:dxCreateEdit("haslo""""Wpisz swoje has?o"screenW 0.4172screenH 0.4426screenW 0.1807screenH 0.0472true255255falsefalse);


end)


blad jest w onClientResourceStart
dokladnie tu

    local checkXML xmlFindChild(xml,"checkboxState"0)
    local checkGetChildValue xmlNodeGetValue(checkXML)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-19, 12:33


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

W pliku XML nie ma childu "checkboxState".

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Wysłany: 2021-03-19, 12:38


NoNamik







Wiek: 35
Na forum: 2185 dni
Posty: 289
Nick w MP: JestemNoNamem

Piwa: 374

Respekt: 60

marcin778, a gdzie to dodac

[ Dodano: 2021-03-27, 10:13 ]
marcin778, pomozesz czy nie?

Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
borsuk
Tagi: zapamietywanie :: xml
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






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