Jump to content

Help mi with Reg/Log GUI


dudeks

Recommended Posts

HI :)

I modified a Login GUI forum development.mtasa.com

All work, when i wanna log in or register i can't.

My code is:

It's a client side

rootElement = getRootElement() 
  
function drawWindow(res) 
if res == getThisResource ( ) then 
showCursor(true) 
reglog = guiCreateWindow(220,155,386,251,"Rejestracja i Logowanie",false) 
reglogTab = guiCreateTabPanel(0.0311,0.0916,0.9456,0.8685,true,reglog) 
LogTab = guiCreateTab("Logowanie",reglogTab) 
RegTab = guiCreateTab("Rejestracja",reglogTab) 
Informacje = guiCreateTab("Informacje",reglogTab) 
Autor = guiCreateTab("Autor",reglogTab) 
edituser = guiCreateEdit(0.011,0.2431,0.4274,0.134,"User",true,LogTab) 
editpass = guiCreateEdit(0.011,0.6546,0.4356,0.1289,"Haslo",true,LogTab) 
redituser = guiCreateMemo(0.011,0.2431,0.4274,0.134,"User",true,RegTab) 
reditpass = guiCreateEdit(0.011,0.6546,0.4356,0.1289,"Haslo",true,RegTab) 
logbtn = guiCreateButton(0.5644,0.2523,0.3753,0.5,"Loguj!",true,LogTab) 
regbtn = guiCreateButton(0.5644,0.2523,0.3753,0.5,"Rejestruj!",true,RegTab) 
InfoMemo = guiCreateMemo(0.0274,0.1753,0.9507,0.768,"Jest to gamemod RP + DM. Jezeli nie chcesz bana... zachowuj sie",true,Informacje) 
LogUser = guiCreateLabel(0.0137,0.1239,0.9562,0.0928,"Uzytkownik:",true,LogTab) 
guiLabelSetVerticalAlign(LogUser,"top") 
guiLabelSetHorizontalAlign(LogUser,"left",false) 
LogPass = guiCreateLabel(0.0164,0.5,0.9644,0.1082,"Haslo:",true,LogTab) 
guiLabelSetVerticalAlign(LogPass,"top") 
guiLabelSetHorizontalAlign(LogPass,"left",false) 
RegUser = guiCreateLabel(0.0137,0.1239,0.9562,0.0928,"Uzytkownik:",true,RegTab) 
guiLabelSetVerticalAlign(RegUser,"top") 
guiLabelSetHorizontalAlign(RegUser,"left",false) 
RegPass = guiCreateLabel(0.0164,0.5,0.9644,0.1082,"Haslo:",true,RegTab) 
guiLabelSetVerticalAlign(RegUser,"top") 
guiLabelSetHorizontalAlign(RegUser,"left",false) 
Label6 = guiCreateLabel(0.0493,0.1422,0.9151,0.2577,"Autorem mapy jest: dudeks",true,Autor) 
guiLabelSetVerticalAlign(Label6,"top") 
guiLabelSetHorizontalAlign(Label6,"left",false) 
guiSetFont(Label6,"sa-header") 
Label7 = guiCreateLabel(0.0411,0.5,0.8849,0.2732,"Kontakt: [email protected]",true,Autor) 
guiLabelSetVerticalAlign(Label7,"top") 
guiLabelSetHorizontalAlign(Label7,"left",false) 
  
  
 guiSetVisible(reglog, false) 
showCursor(true) 
end 
end 
  
addEventHandler("onClientResourceStart", getRootElement(), drawWindow) 
         
function clientSubmitLogin(button) 
  
        if button == "left" then 
                if ( guiGetText( edituser ) ~= "" ) and ( guiGetText( editpass ) ~= "" ) then 
                end   
                triggerServerEvent("clientSubmitLogin", getRootElement(), guiGetText(edituser), guiGetText(editpass)) 
                guiSetInputEnabled(false) 
                guiSetVisible(reglog, false) 
                showCursor(false) 
        end 
end 
  
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), 
  
        function () 
                drawWindow() 
                addEventHandler("onClientGUIClick", logbtn, clientSubmitLogin, false) 
                addEventHandler("onClientGUIClick", regbtn, clientSubmitRegister, false) 
                outputChatBox("Welcome to My MTA DM Server, please log in.  ") 
  
                if (wdwLogin ~= nil) then 
                guiSetVisible(wdwLogin, true) 
                end 
  
                showCursor(true) 
                guiSetInputEnabled(true) 
        end 
) 
  
function clientSubmitRegister(button) 
  
        if button == "left" then 
            if ( guiGetText( redituser ) ~= "" ) and ( guiGetText( reditpass ) ~= "" ) then 
            end     
                triggerServerEvent("clientSubmitRegister", getRootElement(), guiGetText(redituser), guiGetText(reditpass)) 
                guiSetInputEnabled(false) 
                guiSetVisible(reglog, false) 
                showCursor(false) 
        end 
end 
  
  
  
addEvent("SubmitLogin", true) 
addEvent("SubmitRegister", true) 
addEventHandler("SubmitLogin", getRootElement(), joinHandler) 
addEventHandler("SubmitRegister", getRootElement(), joinHandler) 

Server side:

function joinHandler(username, password) 
  
        local x,y,z 
       x = 1959.55 
       y = -1714.46 
        z = 10 
        if (client) then 
              spawnPlayer(client, x, y, z) 
              fadeCamera(client, true) 
              outputChatBox("Aha", client) 
        end 
end 
  
  

Please help me

Edited by Guest
Link to comment

Those events weren't added client-side in the tutorial you probably followed. You just miss-understood the tutorial or you wanted to modify it with a failure result. Just move the 4 lines (where your error points, that is addEvent and addEventHandler) to the server-side script. You have the joinHandler already declared server-side. Then it should work properly.

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...