Jump to content

Problems doing a Login/Register system.


LucasMorais

Recommended Posts

Hi, it's me again! I need some help with this. I already have the GUI, but I can't make it appear when the player Join. Please notice that i'm new in LUA scripting.

Client-Side file:

function () 
GUIEditor_Window = {} 
GUIEditor_Button = {} 
GUIEditor_Memo = {} 
GUIEditor_Label = {} 
GUIEditor_Edit = {} 
GUIEditor_Scrollbar = {} 
guiSetInputEnabled(false) 
GUIEditor_Window[1] = guiCreateWindow(284,338,483,172,"LOGUE-SE OU REGISTRE-SE!",false) 
guiWindowSetMovable(GUIEditor_Window[1],false) 
guiWindowSetSizable(GUIEditor_Window[1],false) 
GUIEditor_Label[1] = guiCreateLabel(13,28,118,19,"Nome de usuário:",false,GUIEditor_Window[1]) 
GUIEditor_Edit[1] = guiCreateEdit(9,47,143,19,"",false,GUIEditor_Window[1]) 
GUIEditor_Label[2] = guiCreateLabel(11,68,118,19,"Senha:",false,GUIEditor_Window[1]) 
GUIEditor_Edit[2] = guiCreateEdit(9,47,143,19,"",false,GUIEditor_Window[1]) 
guiEditSetMaxLength(GUIEditor_Edit[2],15) 
GUIEditor_Edit[3] = guiCreateEdit(9,84,143,19,"",false,GUIEditor_Window[1]) 
guiEditSetMasked(GUIEditor_Edit[3],true) 
GUIEditor_Button[1] = guiCreateButton(9,113,70,29,"Login",false,GUIEditor_Window[1]) 
GUIEditor_Button[2] = guiCreateButton(84,114,70,29,"Registro",false,GUIEditor_Window[1]) 
GUIEditor_Label[3] = guiCreateLabel(100,149,313,18,"Advanced Roleplay 2011 - [url=http://www.advanced-roleplay.com]www.advanced-roleplay.com[/url]",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[3],"default-bold-small") 
GUIEditor_Label[4] = guiCreateLabel(164,22,308,18,"Atualizações:",false,GUIEditor_Window[1]) 
guiSetFont(GUIEditor_Label[4],"clear-normal") 
GUIEditor_Memo[1] = guiCreateMemo(164,42,298,98,"v0.1 BETA:\n- GUI @ Login feita.\n-------------------------------------------------------------------\nPróximas atualizações:\nv0.2 BETA:\n- Sistema de salvamento de contas.",false,GUIEditor_Window[1]) 
guiSetVisible(GUIEditor_Window[1], true) 
end 
addEventHandler("onPlayerJoin", getRootElement(), loginWindow) 

I don't need to post the server-side file, because it has nothing related to the client-side file. I know, i have to do something in the server-side file to activate the client-side, but I don't know wich one to use and how-to. Help please!

Link to comment
  
    function loginWindow() 
    GUIEditor_Window = {} 
    GUIEditor_Button = {} 
    GUIEditor_Memo = {} 
    GUIEditor_Label = {} 
    GUIEditor_Edit = {} 
    GUIEditor_Scrollbar = {} 
    guiSetInputEnabled(false) 
    GUIEditor_Window[1] = guiCreateWindow(284,338,483,172,"LOGUE-SE OU REGISTRE-SE!",false) 
    guiWindowSetMovable(GUIEditor_Window[1],false) 
    guiWindowSetSizable(GUIEditor_Window[1],false) 
    GUIEditor_Label[1] = guiCreateLabel(13,28,118,19,"Nome de usuário:",false,GUIEditor_Window[1]) 
    GUIEditor_Edit[1] = guiCreateEdit(9,47,143,19,"",false,GUIEditor_Window[1]) 
    GUIEditor_Label[2] = guiCreateLabel(11,68,118,19,"Senha:",false,GUIEditor_Window[1]) 
    GUIEditor_Edit[2] = guiCreateEdit(9,47,143,19,"",false,GUIEditor_Window[1]) 
    guiEditSetMaxLength(GUIEditor_Edit[2],15) 
    GUIEditor_Edit[3] = guiCreateEdit(9,84,143,19,"",false,GUIEditor_Window[1]) 
    guiEditSetMasked(GUIEditor_Edit[3],true) 
    GUIEditor_Button[1] = guiCreateButton(9,113,70,29,"Login",false,GUIEditor_Window[1]) 
    GUIEditor_Button[2] = guiCreateButton(84,114,70,29,"Registro",false,GUIEditor_Window[1]) 
    GUIEditor_Label[3] = guiCreateLabel(100,149,313,18,"Advanced Roleplay 2011 - [url=http://www.advanced-roleplay.com]http://www.advanced-roleplay.com[/url]",false,GUIEditor_Window[1]) 
    guiSetFont(GUIEditor_Label[3],"default-bold-small") 
    GUIEditor_Label[4] = guiCreateLabel(164,22,308,18,"Atualizações:",false,GUIEditor_Window[1]) 
    guiSetFont(GUIEditor_Label[4],"clear-normal") 
    GUIEditor_Memo[1] = guiCreateMemo(164,42,298,98,"v0.1 BETA:\n- GUI @ Login feita.\n-------------------------------------------------------------------\nPróximas atualizações:\nv0.2 BETA:\n- Sistema de salvamento de contas.",false,GUIEditor_Window[1]) 
    guiSetVisible(GUIEditor_Window[1], true) 
    end 
    addEventHandler("onClientResourceStart", getResourceRootElement(), loginWindow) 

PS: I hope your GUI works, because all I did was make it pop up when you join the server / start the resource

Link to comment

Well, I need help again. With binding keys.

This is server-side, it's correct?

function keys(keyPresser, key, keyState) 
if(key == "m") and if(keyState == "down") and if(isCursorShowing == false) 
showCursor(true) 
end 
if(key == "m") and if(keyState == "down") and if(isCursorShowing == true) 
showCursor(false) 
    end 
end 
function bindedKeys() 
bindKey("m", "down", keys) 
end 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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