Jump to content

Login/Register - Ayuda con el Client y Server


JuegosPato

Recommended Posts

Bueno.

Tengo un gui creado por mi, aunque yo soy tan inútil en el scripting, aunque se algo, pero espero que me ayuden.

El gui:

GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Window[1] = guiCreateWindow(392,73,502,662,"Login and Register GUI -bmx-",false) 
GUIEditor_Edit[1] =  
guiCreateEdit(0.2809,0.0559,0.5857,0.0438,"",true,GUIEditor_Window[1]) 
  
GUIEditor_Button[1] = 
guiCreateButton(0.0279,0.3369,0.3048,0.0801,"Login",true,GUIEditor_Window[1]) 
GUIEditor_Button[2] = 
guiCreateButton(0.3546,0.3353,0.3088,0.0816,"Register",true,GUIEditor_Window[1]) 
GUIEditor_Label[1] = 
guiCreateLabel(0.0857,0.0634,0.3526,0.0574,"Username:",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Label[2] = 
guiCreateLabel(0.0876,0.1435,0.3526,0.0574,"Password:",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[2],"dafault-bold-small") 
GUIEditor_Edit[2] = 
guiCreateEdit(0.2809,0.1375,0.5857,0.0438,"",true,GUIEditor_Window[1]) 
GUIEdiotr_Label[3] = guiCreateLabel(0.0279,0.2085,0.9402,0.1027,"Welcome to the server, this server will find parkour, Bmx, funs.",true,GUIEdior_Window[1]) 
GUIEdior_TabPanel[1] = 
guiCreateTabPanel(0.0179,0.4532,0.9641,0.5332,true,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = 
guiCreateTab("Information/Informacion",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[1] = guiCreateMemo(0.0227,0.0365,0.9566,0.921,"English:\n Hello, you're in the information of the server, this server is too many App cosas.Nuestro founder, he is too bueno.Unos mapper and our mapper is Gonza, Pato, Selene and TheGame.\n  
No somos un mal ejemplo, o algo así, estamos a sólo los adolescentes que se divierten en un clan y un servidor. 
\n También en este servidor, usted encontrará muchos amigos, o usted amigos nuevos pedidos porque buscamos cada uno de nosotros como una comunidad de verdad.",true,GUIEditor_Tab[1]) 
GUIEditor_Tab[2] = guiCreateTab("Members/Miembros",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[2] = 
guiCreateMemo(0.0207,0.0365,0.9545,0.9271,"English/Español\n\nChief/Jefe\n-[bMX]App                   -Founder/Fundador-\n-[bMX]Ricardo\n\nDeputy Chief/Sub-Jefe\n-[bMX]Gonza                -Hosting-Mapper-\n-[bMX]Pato                  -Scripter-Mapper-\n\nMember/Miembros\n-[bMX]TheGame           -Mapper-\n-[bMX]ExtremeKiller\n-[bMX]Selene               -Mapper-\n-[bMX]MigueLoq\n-[bMX]TedyMC\n\n\n",true,GUIEditor_Tab[2]) 
GUIEditor_Tab[3] = guiCreateTab("New Stuff/Nuevas Cosas",GUIEditor_TabPanel[1]) 
  
GUIEditor_Memo[3] = 
guiCreateMemo(0.0372,0.0334,0.938,0.9331,"English:\nNothing for now\n\nEspañol:\nNada por ahora\n",true,GUIEditor_Tab[3]) 
GUIEditor_Tab[4] = guiCreateTab("-bmx-",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[4] = 
guiCreateMemo(0.0269,0.0304,0.9463,0.9483,"English:\nWe also find out things you can, upload videos and pictures in our Facebook community and then if I want to give love on our website\n\nFacebook Community:\n[url=http://www.facebook.com/Comunidad.bmx]www.facebook.com/Comunidad.bmx[/url]  (Spanish and English Community)\n\nLike:\n[url=http://www.facebook.com/ClanbmxMtasa]www.facebook.com/ClanbmxMtasa[/url]\n\nEspañol:\nTambién te podes enterar cosas, subir videos y imagenes en nuestra comunidad de Facebook y luego, si queres darle Me gusta en nuestra pagina\n\nFacebook Comunidad:\n[url=http://www.facebook.com/Comunidad.bmx]www.facebook.com/Comunidad.bmx[/url]   (Spanish and English Community)\n\nMe gusta:\n[url=http://www.facebook.com/ClanbmxMtasa]www.facebook.com/ClanbmxMtasa[/url]",true,GUIEditor_Tab[4]) 
GUIEditor_Label[4] = guiCreateLabel(0.0279,0.287,0.9402,0.1027,"Bienvenido al servidor, este servidor se encuentra parkour, diversiones BMX.",true,GUIEditor_Window[1]) 

Link to comment
https://forum.multitheftauto.com/viewtopic.php?f=145&t=38050

lea las reglas porfavor. y trate de ser un poco mas explicito en cuanto a postear que pasa con tu post, o que quieres y decirnos que errores tiene. usa /debugscript 3 para saber que errores existen.

Ya lo leí, pero nunca dije que me agan los scripts o algo por el estilo, sino me que me ayuden.

Este es el client, esta bien?, para la ultima linea

local localPlayer = getLocalPlayer ( ) 
  
function windowHandler( ) 
    local playername = getPlayerName(localPlayer) 
     
    guiSetText(LoginUsername, "") 
    guiSetText(EditRegisterUsername, "") 
  
    guiSetText(LoginUsername, playername) 
    guiSetText(EditRegisterUsername, playername) 
  
    guiSetVisible (  GUIEditor_Window[1], true ) 
  
    guiSetInputEnabled(true) 
    showCursor ( true ) 
end 
  
function onClickBtn ( button, state ) 
    if (source == GUIEditor_Button[1]) then 
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) 
    end 
end 
  
function onClickBtn2 ( button, state ) 
    if (source == GUIEditor_Button[2]) then 
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) 
    end 
end 
  
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
end 
addEvent( "hideLoginWindow", true ) 
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 
  
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) 

Y este es el server.

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "1!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "asd", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 
  
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  
function onRegister ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "...", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Password/Username error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    end 
end 
  
addEvent( "onRegister", true ) 
addEventHandler( "onRegister", getRootElement(), onRegister ) 

Esta bien?

Edited by Guest
Link to comment

Bueno.Yo creo que esta, porque leí en la wiki paso por paso.Pero cuando lo habro no pasa nada.No aparece, cual es el problema?

Client.

GUIEditor_Window = {} 
GUIEditor_TabPanel = {} 
GUIEditor_Tab = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
  
GUIEditor_Window[1] = guiCreateWindow(392,73,502,662,"Login and Register GUI -bmx-",false) 
GUIEditor_Edit[1] =  
guiCreateEdit(0.2809,0.0559,0.5857,0.0438,"",true,GUIEditor_Window[1]) 
  
GUIEditor_Button[1] = 
guiCreateButton(0.0279,0.3369,0.3048,0.0801,"Login",true,GUIEditor_Window[1]) 
GUIEditor_Button[2] = 
guiCreateButton(0.3546,0.3353,0.3088,0.0816,"Register",true,GUIEditor_Window[1]) 
GUIEditor_Label[1] = 
guiCreateLabel(0.0857,0.0634,0.3526,0.0574,"Username:",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
GUIEditor_Label[2] = 
guiCreateLabel(0.0876,0.1435,0.3526,0.0574,"Password:",true,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[2],"dafault-bold-small") 
GUIEditor_Edit[2] = 
guiCreateEdit(0.2809,0.1375,0.5857,0.0438,"",true,GUIEditor_Window[1]) 
GUIEdiotr_Label[3] = guiCreateLabel(0.0279,0.2085,0.9402,0.1027,"Welcome to the server, this server will find parkour, Bmx, funs.",true,GUIEdior_Window[1]) 
GUIEdior_TabPanel[1] = 
guiCreateTabPanel(0.0179,0.4532,0.9641,0.5332,true,GUIEditor_Window[1]) 
GUIEditor_Tab[1] = 
guiCreateTab("Information/Informacion",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[1] = guiCreateMemo(0.0227,0.0365,0.9566,0.921,"English:\n Hello, you're in the information of the server, this server is too many App cosas.Nuestro founder, he is too bueno.Unos mapper and our mapper is Gonza, Pato, Selene and TheGame.\n  
No somos un mal ejemplo, o algo así, estamos a sólo los adolescentes que se divierten en un clan y un servidor. 
\n También en este servidor, usted encontrará muchos amigos, o usted amigos nuevos pedidos porque buscamos cada uno de nosotros como una comunidad de verdad.",true,GUIEditor_Tab[1]) 
GUIEditor_Tab[2] = guiCreateTab("Members/Miembros",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[2] = 
guiCreateMemo(0.0207,0.0365,0.9545,0.9271,"English/Español\n\nChief/Jefe\n-[bMX]App                   -Founder/Fundador-\n-[bMX]Ricardo\n\nDeputy Chief/Sub-Jefe\n-[bMX]Gonza                -Hosting-Mapper-\n-[bMX]Pato                  -Scripter-Mapper-\n\nMember/Miembros\n-[bMX]TheGame           -Mapper-\n-[bMX]ExtremeKiller\n-[bMX]Selene               -Mapper-\n-[bMX]MigueLoq\n-[bMX]TedyMC\n\n\n",true,GUIEditor_Tab[2]) 
GUIEditor_Tab[3] = guiCreateTab("New Stuff/Nuevas Cosas",GUIEditor_TabPanel[1]) 
  
GUIEditor_Memo[3] = 
guiCreateMemo(0.0372,0.0334,0.938,0.9331,"English:\nNothing for now\n\nEspañol:\nNada por ahora\n",true,GUIEditor_Tab[3]) 
GUIEditor_Tab[4] = guiCreateTab("-bmx-",GUIEditor_TabPanel[1]) 
GUIEditor_Memo[4] = 
guiCreateMemo(0.0269,0.0304,0.9463,0.9483,"English:\nWe also find out things you can, upload videos and pictures in our Facebook community and then if I want to give love on our website\n\nFacebook Community:\n[url=http://www.facebook.com/Comunidad.bmx]www.facebook.com/Comunidad.bmx[/url]  (Spanish and English Community)\n\nLike:\n[url=http://www.facebook.com/ClanbmxMtasa]www.facebook.com/ClanbmxMtasa[/url]\n\nEspañol:\nTambién te podes enterar cosas, subir videos y imagenes en nuestra comunidad de Facebook y luego, si queres darle Me gusta en nuestra pagina\n\nFacebook Comunidad:\n[url=http://www.facebook.com/Comunidad.bmx]www.facebook.com/Comunidad.bmx[/url]   (Spanish and English Community)\n\nMe gusta:\n[url=http://www.facebook.com/ClanbmxMtasa]www.facebook.com/ClanbmxMtasa[/url]",true,GUIEditor_Tab[4]) 
GUIEditor_Label[4] = guiCreateLabel(0.0279,0.287,0.9402,0.1027,"Bienvenido al servidor, este servidor se encuentra parkour, diversiones BMX.",true,GUIEditor_Window[1]) 
  
guiSetVisible ( GUIEditor_Window[1], false ) 
  
local localPlayer = getLocalPlayer ( ) 
  
function windowHandler( ) 
    local playername = getPlayerName(localPlayer) 
     
    guiSetText(LoginUsername, "") 
    guiSetText(EditRegisterUsername, "") 
  
    guiSetText(LoginUsername, playername) 
    guiSetText(EditRegisterUsername, playername) 
  
    guiSetVisible (  GUIEditor_Window[1], true ) 
  
    guiSetInputEnabled(true) 
    showCursor ( true ) 
end 
  
function onClickBtn ( button, state ) 
    if (source == GUIEditor_Button[1]) then 
        triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) 
    end 
end 
  
function onClickBtn2 ( button, state ) 
    if (source == GUIEditor_Button[2]) then 
        triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword)) 
    end 
end 
  
  
function hideLoginWindow() 
    guiSetInputEnabled(false) 
    guiSetVisible ( GUIEditor_Window[1], false ) 
    showCursor ( false ) 
end 
addEvent( "hideLoginWindow", true ) 
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow ) 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler ) 
  
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false ) 
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false ) 

Server.

function onLogin ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. 
    end 
end 
  
addEvent( "onLogin", true ) 
addEventHandler( "onLogin", getRootElement(), onLogin ) 
  
function onRegister ( player, user, pass ) 
    local account = getAccount ( user, pass ) 
    if ( account ~= false ) then 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    else 
        account = addAccount ( user, pass ) 
        if (logIn ( player, account, pass ) == true) then 
            triggerClientEvent ( "hideLoginWindow", getRootElement()) 
        else 
            outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. 
        end 
    end 
end 
  
addEvent( "onRegister", true ) 
addEventHandler( "onRegister", getRootElement(), onRegister ) 

Link to comment
  • Recently Browsing   0 members

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