Jump to content

Bad argument @ 'logIn'


iFoReX

Recommended Posts

Bueno, como dice en el titulo, aparece este error en la console, 'aca' era mi nick, porfavor ayudenme a solucionarlo :P

[2012-09-21 02:28:55] WARNING: ElMota\server.lua:19: Bad argument @ 'logIn' [Expected account at argument 2, got string 'aca']

client

label = {} 
  
RGUI = guiCreateWindow(0.3703,0.3503,0.2914,0.2695,"Register Panel",true) 
guiWindowSetMovable(RGUI,false) 
guiWindowSetSizable(RGUI,false) 
label[1] = guiCreateLabel(25,47,317,20,"Registrate ya !, asi guardaras datos y todo eso...",false,RGUI) 
guiSetFont(label[1],"clear-normal") 
EPassword = guiCreateEdit(21,91,155,32,"",false,RGUI) 
Registrarme = guiCreateButton(181,90,92,32,"Registrarme !",false,RGUI) 
label[2] = guiCreateLabel(63,124,76,17,"CONTRASEÑA",false,RGUI) 
guiSetFont(label[2],"default-bold-small") 
label[3] = guiCreateLabel(15,149,183,21,"Ve ya a nuestro nuevo Foro ! ...",false,RGUI) 
label[4] = guiCreateLabel(107,174,171,18,"http://bhzserver.forochile.com",false,RGUI) 
  
LGUI = guiCreateWindow(0.4516,0.3112,0.1758,0.1237,"Loguin GUI(60 Sec)",true) 
guiWindowSetSizable(LGUI,false) 
Lpassword = guiCreateLabel(20,36,54,19,"Password",false,LGUI) 
EPasswordL = guiCreateEdit(77,28,137,33,"",false,LGUI) 
Login = guiCreateButton(16,64,200,22,"Login",false,LGUI) 
  
guiSetVisible(RGUI,false) 
showCursor(false) 
guiSetVisible(LGUI,false) 
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function() 
        triggerServerEvent("on:Visible:", getLocalPlayer()) 
    end 
) 
  
function clientSubmitaccount ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        local username = getPlayerName( getLocalPlayer() ) 
        local password = guiGetText(EPassword) 
        if ( username and password ) then 
            triggerServerEvent("cuenta", localPlayer, username, password) 
        else 
           outputChatBox("Porfavor pon tu Nick y tu Contraseña.") 
        end 
    end 
end 
addEventHandler("onClientGUIClick", Registrarme, clientSubmitaccount, false) 
  
addEvent ( "closeLoginGUI", true ) 
addEventHandler ( "closeLoginGUI", root, 
    function ( ) 
       guiSetVisible ( RGUI, false ) 
       showCursor ( false ) 
       guiSetVisible( LGUI, false ) 
    end 
) 
  
function clientSubmitLogin ( button, state ) 
    if ( button == "left" and state == "up" ) then 
        triggerServerEvent("archivo", localPlayer, file) 
        local username = xmlNodeGetAttribute( file, "name" ) 
        local password = guiGetText(EPasswordL) 
        if ( username and password ) then 
            triggerServerEvent("submitLoginEM", localPlayer, username, password) 
        else 
           outputChatBox("Porfavor pon tu Nick y tu Contrase?a.") 
        end 
    end 
end 
addEventHandler("onClientGUIClick", Login, clientSubmitLogin, false) 
  
  
addEvent("openLGUI",true) 
addEventHandler("openLGUI", root, function() 
    guiSetVisible(LGUI,true) 
    showCursor(true) 
end 
) 
  
addEvent("openRGUI",true) 
addEventHandler("openRGUI", root, function() 
    guiSetVisible(RGUI,true) 
    showCursor(true) 
end 
) 

server

addEvent("cuenta", true) 
addEventHandler("cuenta", root, 
function ( username, password ) 
  
    if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil ) then 
        if ( not getAccount ( username ) ) then 
            local accountAdded = addAccount ( username, password ) 
            if ( accountAdded ) then 
                outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado y loggeado", source ) 
  
                local file = xmlCreateFile(username .." .xml","root") 
      local node = xmlCreateChild(file,"stats") 
      xmlNodeSetAttribute( node, "name", username ) 
      local check = xmlNodeSetAttribute( node, "pass", password) 
                xmlSaveFile(file) 
                if file then 
                   outputChatBox ( "Tu Character se a creado con exito !.", source ) 
                   triggerClientEvent ( source, "closeLoginGUI", source ) 
                   logIn ( source, xmlNodeGetAttribute( node, "name" ), xmlNodeGetAttribute( node, "pass" ) ) 
                end 
            else 
               outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) 
         end 
       else 
            outputChatBox ( "Esta Cuenta Ya Existe..", source ) 
        end 
    else 
        outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) 
    end 
end 
) 
  
function loginHandler(username,password) 
    if ( username ) then 
    local acc = getAccount(username, password) 
        if (acc) then 
            logIn ( source, acc, password ) 
            fadeCamera(source, true) 
            setCameraTarget(source) 
            triggerClientEvent ( source, "closeLoginGUI", source ) 
            outputChatBox("Enjoy your time!", source) 
        else 
            outputChatBox("invalid username and password. Please re-connect and try again.", source) 
            end 
        end 
end 
addEvent("submitLoginEM",true) 
addEventHandler("submitLoginEM",root, loginHandler) 
  
addEvent("on:Visible:",true) 
addEventHandler("on:Visible:",root, 
function() 
    local username = getPlayerName( source ) 
    local file = xmlLoadFile( username .." .xml" ) 
    if ( file ) then 
        triggerClientEvent(source, "openLGUI", source) 
    elseif not ( file ) then 
        triggerClientEvent(source, "openRGUI", source) 
    end 
    end 
    ) 
    
addEvent("archivo", true) 
addEventHandler("archivo", root, 
function( file ) 
    local username = getPlayerName( source ) 
    local file = xmlLoadFile( username .." .xml" ) 
end 
) 

Link to comment
addEvent("cuenta", true) 
addEventHandler("cuenta", root, 
function ( username, password ) 
  
    if ( password ~= "" and password ~= nil and username ~= "" and username ~= nil ) then 
        if ( not getAccount ( username ) ) then 
            local accountAdded = addAccount ( username, password ) 
            if ( accountAdded ) then 
                outputChatBox ( "Gracias " .. getPlayerName ( source ) .. ", Ya estas Registrado y loggeado", source ) 
  
                local file = xmlCreateFile(username .." .xml","root") 
      local node = xmlCreateChild(file,"stats") 
      xmlNodeSetAttribute( node, "name", username ) 
      local check = xmlNodeSetAttribute( node, "pass", password) 
                xmlSaveFile(file) 
                if file then 
                   outputChatBox ( "Tu Character se a creado con exito !.", source ) 
                   triggerClientEvent ( source, "closeLoginGUI", source ) 
                   logIn ( source, getAccount ( xmlNodeGetAttribute( node, "name" ), xmlNodeGetAttribute( node, "pass" ) ), xmlNodeGetAttribute( node, "pass" ) ) 
                end 
            else 
               outputChatBox ( "Error creando la Cuenta por Favor contacta a un Admin.", source ) 
         end 
       else 
            outputChatBox ( "Esta Cuenta Ya Existe..", source ) 
        end 
    else 
        outputChatBox ( "Porfavor Pon tus datos Correctos.", source ) 
    end 
end 
) 
  
function loginHandler(username,password) 
    if ( username ) then 
    local acc = getAccount(username, password) 
        if (acc) then 
            logIn ( source, acc, password ) 
            fadeCamera(source, true) 
            setCameraTarget(source) 
            triggerClientEvent ( source, "closeLoginGUI", source ) 
            outputChatBox("Enjoy your time!", source) 
        else 
            outputChatBox("invalid username and password. Please re-connect and try again.", source) 
            end 
        end 
end 
addEvent("submitLoginEM",true) 
addEventHandler("submitLoginEM",root, loginHandler) 
  
addEvent("on:Visible:",true) 
addEventHandler("on:Visible:",root, 
function() 
    local username = getPlayerName( source ) 
    local file = xmlLoadFile( username .." .xml" ) 
    if ( file ) then 
        triggerClientEvent(source, "openLGUI", source) 
    elseif not ( file ) then 
        triggerClientEvent(source, "openRGUI", source) 
    end 
    end 
    ) 
    
addEvent("archivo", true) 
addEventHandler("archivo", root, 
function( file ) 
    local username = getPlayerName( source ) 
    local file = xmlLoadFile( username .." .xml" ) 
end 
) 

Link to comment
  • Recently Browsing   0 members

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