Jump to content

[INACTIVO] loginPlayersLogger(XML)


UserToDelete

Recommended Posts

Quiero poner un script que regitre el dia, el mes, y el año en el que un jugador entra por ultima vez en el sever en un archivo XML, lo unico que logre hacer es esto.

Pero en el XML no me registra nada D: :cry::cry::cry::cry::cry:

  
function lastLogin_ (source,_) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    año = tiempo.year 
    xmlFile = xmlLoadFile("lastLogin.xml") 
    playerAccount = getAccountName (getPlayerAccount(source)) 
    finder = xmlFindChild(xmlFile, playerAccount, 0) 
    if finder == playerAccount then 
        xmlNodeSetAttribute(finder,""..tostring(dia).." de "..tostring(mes).." de "..tostring(año)) 
    end 
    if not finder == playerAccount then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
            if not JugadorChi == false then 
                xmlNodeSetAttribute(finder,""..tostring(dia).." de "..tostring(mes).." de "..tostring(año)) 
            end 
    else end 
    xmlSaveFile(xmlFile) 
    outputChatBox(""..tostring(playerAccount)..", "..tostring(finder).."",root) 
    outputChatBox(""..tostring(dia).." de "..tostring(mes).." de "..tostring(año).."",root) 
end 
addCommandHandler("ll", lastLogin_) 
  

y de hecho ni siquiera salta ninguna chatbox

y este es el XML D:

<lastLogin> 
  
</lastLogin> 

Edited by Guest
Link to comment

Aun quitandole año, no registra en el archivo XML, y he cambiado varias cosillas para hacerlo funcionar, y nada

function lastLogin_ (source,_) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    --año = tiempo.year 
    xmlFile = xmlLoadFile("lastLogin.xml") 
    playerAccount = getAccountName (getPlayerAccount(source)) 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    finderContent = xmlNodeGetName(finder) 
    if finderContent == playerAccount then 
        xmlNodeSetValue(finderContent,""..tostring(dia).." de "..tostring(mes)) 
    else --finderContent == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
            if finderContent == playerAccount then 
                xmlNodeSetValue(finderContent,""..tostring(dia).." de "..tostring(mes)) 
            end 
    end 
    xmlSaveFile(xmlFile) 
end 
addCommandHandler("ll", lastLogin_) 

Alguna otra solucion? D:

PD: Ahora registra esto:

<lastLogin> 
    <venadHD></venadHD> 
</lastLogin> 
  

y no tira ningun error!

Link to comment

Lo volvi a modificar y nada, sigue sin registrar y sin mostrar ningun error

function lastLogin_ (jugador) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    xmlFile = xmlLoadFile("lastLogin.xml") 
    playerAccount = getAccountName (getPlayerAccount(jugador)) 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    if xmlNodeGetName(finder) == playerAccount then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    if xmlNodeGetName(finder) == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
end 
addEventHandler("onPlayerLogin",root,lastLogin_) 

Link to comment
Hidden
Lo volvi a modificar y nada, sigue sin registrar y sin mostrar ningun error
function lastLogin_ (jugador) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    xmlFile = xmlLoadFile("lastLogin.xml") 
    playerAccount = getAccountName (getPlayerAccount(jugador)) 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    if xmlNodeGetName(finder) == playerAccount then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    if xmlNodeGetName(finder) == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
end 
addEventHandler("onPlayerLogin",root,lastLogin_) 

Por que no usas un createFile(lastLogin.xml) ? creo que seria lo mismo y pones adelante de la fecha pones el name para saber de quien es nose se me ocurrio corriganme si esta mal.

Link to comment

Nada, sigue sin funcionar, hay algo que no funciona bien, pero hay una parte buena, funciona una parte del script, pero no el resto, dejo los errores abajo, porque no soy capaz de solucionarlo :/

en el outputChatBox devuelve esto: "false, false"

probe de varias maneras usando el (_,jugador), pero ni aun asi, necesito el script pero ya :cry::cry:

function lastLogin (_,jugador) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    xmlFile = xmlLoadFile("ll.xml") 
    playerAccount = getAccountName (getPlayerAccount(jugador)) 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    finder2 = xmlNodeGetName(finder) 
    if tostring(finder2) == tostring(playerAccount) then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    if tostring(finder2) == "false" then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
    outputChatBox(""..tostring(finder2)..", "..tostring(finder).."",root,255,0,0,true) 
end 
addEventHandler("onPlayerLogin",root,lastLogin) 

Supuestamente el outputChatBox tenia que devolver "venadHD, venadHD", pero no, devuelve "false, false"

El error:

(Supuestamente aqui hay una imagen)

Link por si no carga: http://www.trosnos.ga/_i/forum_84132_1.jpg

forum_84132_1.jpg

Link to comment
Hidden
Nada, sigue sin funcionar, hay algo que no funciona bien, pero hay una parte buena, funciona una parte del script, pero no el resto, dejo los errores abajo, porque no soy capaz de solucionarlo :/

en el outputChatBox devuelve esto: "false, false"

probe de varias maneras usando el (_,jugador), pero ni aun asi, necesito el script pero ya :cry::cry:

function lastLogin (_,jugador) 
    tiempo = getRealTime() 
    dia = tiempo.monthday 
    mes = tiempo.month 
    xmlFile = xmlLoadFile("ll.xml") 
    playerAccount = getAccountName (getPlayerAccount(jugador)) 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    finder2 = xmlNodeGetName(finder) 
    if tostring(finder2) == tostring(playerAccount) then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    if tostring(finder2) == "false" then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
    outputChatBox(""..tostring(finder2)..", "..tostring(finder).."",root,255,0,0,true) 
end 
addEventHandler("onPlayerLogin",root,lastLogin) 

Supuestamente el outputChatBox tenia que devolver "venadHD, venadHD", pero no, devuelve "false, false"

El error:

(Supuestamente aqui hay una imagen)

Link por si no carga: http://www.trosnos.ga/_i/forum_84132_1.jpg

forum_84132_1.jpg

E visto que lo que intentas hacer es algo que yo ya hice para mi panel de sopporte aca te dejo mi código que si funciona y te fijas como lo hice para que soluciones tu error espero te sirva de algo.

Codigo:

addEvent("onEnviar",true) 
addEventHandler("onEnviar",getRootElement(), 
function (player,Texto,check) 
    ID = math.random(111111111,999999999) 
    filename = "reportes"..tostring(check).."-"..tostring(getPlayerName(player)).."-"..tostring(ID)..".xml" 
    RootNode = xmlCreateFile(tostring(filename),"Reporte") 
    NewNode = xmlCreateChild(RootNode, "Texto") 
    xmlNodeSetValue(NewNode,Texto) 
    xmlSaveFile(RootNode) 
end) 
  

Link to comment
Hidden
function lastLogin_ (_, playerAccount) 
    local tiempo = getRealTime() 
    local dia = tiempo.monthday 
    local mes = tiempo.month 
    playerAccount = getAccountName(playerAccount) 
    local xmlFile 
    if fileExists("lastLogin.xml") then 
         xmlFile = xmlLoadFile("lastLogin.xml") 
    else 
        xmlFile = xmlCreateFile("lastLogin.xml", "lastLogin") 
    end 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    if xmlNodeGetName(finder) == playerAccount then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes+1)) 
    end 
    if xmlNodeGetName(finder) == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
addEventHandler("onPlayerLogin",root,lastLogin_) 

Link to comment

lo he probado durante 24 horas y nada, tiene un error muy raro, solo registró el primer valor, luego nada

function lastLogin_ (_, playerAccount) 
    local tiempo = getRealTime() 
    local dia = tiempo.monthday 
    local mes = tiempo.month 
    playerAccount = getAccountName(playerAccount) 
    local xmlFile 
    if fileExists("lastLogin.xml") then 
         xmlFile = xmlLoadFile("lastLogin.xml") 
    else 
        xmlFile = xmlCreateFile("lastLogin.xml", "lastLogin") 
    end 
    finder = xmlFindChild(xmlFile, tostring(playerAccount), 0) 
    if xmlNodeGetName(finder) == playerAccount then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes+1)) 
    end 
    if xmlNodeGetName(finder) == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
addEventHandler("onPlayerLogin",root,lastLogin_) 

El script es el original de SASU, pero mirad el xml

<lastLogin> 
    <venadHD>12 de 1</venadHD> <!--Cuando debia ser 13 de 1 --> 
    <ola123></ola123> 
    <ale400></ale400> 
    <matralix></matralix> 
    <xCr1st1anx></xCr1st1anx> 
    <MapacheTroll_2></MapacheTroll_2> 
    <>Kross<></>Kross<> 
</lastLogin> 
  

Solo me ha registrado a mi, y para eso, de ayer!, que ha pasado?

Nose si tiene algo que ver, que haya mas funciones en el mismo archivo, este es el archivo LUA completo:

function getPlayerFromPartialName(name) 
    local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil 
    if name then 
        for _, player in ipairs(getElementsByType("player")) do 
            local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() 
            if name_:find(name, 1, true) then 
                return player 
            end 
        end 
    end 
end 
  
function lastLogin_ (_, playerAccount) 
    local tiempo = getRealTime() 
    local dia = tiempo.monthday 
    local mes = tiempo.month 
    playerAccount = getAccountName(playerAccount) 
    local xmlFile 
    if fileExists("lastLogin.xml") then 
         xmlFile = xmlLoadFile("lastLogin.xml") 
    else 
        xmlFile = xmlCreateFile("lastLogin.xml", "lastLogin") 
    end 
    finder = xmlFindChild(xmlFile, playerAccount, 0) 
    if xmlNodeGetName(finder) == playerAccount then 
        xmlNodeSetValue(finder,""..tostring(dia).." de "..tostring(mes+1)) 
    end 
    if xmlNodeGetName(finder) == false then 
        JugadorChi = xmlCreateChild (xmlFile, playerAccount) 
        xmlNodeSetValue(JugadorChi,""..tostring(dia).." de "..tostring(mes)) 
    end 
    xmlSaveFile(xmlFile) 
    xmlUnloadFile(xmlFile) 
end 
addEventHandler("onPlayerLogin",root,lastLogin_) 
  
function transfer (source, _, name, dinero) 
    dinero2 = tonumber(dinero) or 0 
    player = getPlayerFromPartialName(name) 
    playerName = getPlayerName(source) 
    playerGetMoney = getPlayerMoney(source) 
    if player then 
        if playerGetMoney > tonumber(dinero) then 
            takeFromSource = takePlayerMoney(source, dinero2) 
            outputChatBox("Dinero transferido", source, 0, 255, 0, true) 
            givePlayerMoney(player ,dinero) 
            outputChatBox("Has recibido: "..dinero2.."$ de: "..playerName, player, 0, 255, 0, true) 
        else 
            outputChatBox("No tienes dinero suficiente", source, 255, 0, 0, true) 
        end 
    else 
        outputChatBox("Uso: /givem [jugador] [dinero]", source, 255, 0, 0, true) 
    end 
end 
addCommandHandler("givem",transfer) 
  

Sigue dando el mismo error que en el anterior post

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...