Jump to content

Login Panel


Resulcan

Recommended Posts

52 minutes ago, Resulcan said:

I'm developing friends Luada Can You Help Me?

I want to make a login panel first. How can I do?

logIn

addAccount

 getAccount - guiGetText - triggerServerEvent

I don't know how, how can I do?

Hello Resulcan,

welcome to our MTA scripting community :) 

Did you know about the MTA wiki? There is an article specifically about scripting the GUI.

https://wiki.multitheftauto.com/wiki/Introduction_to_Scripting_the_GUI

Could you please try doing that tutorial? If you have any questions then feel free to post them here!

Link to comment
addEventHandler("onClientResourceStart", resourceRoot,
    function kayıt()
local screenW, screenH = guiGetScreenSize()
        Kayıtol = guiCreateWindow((screenW - 348) / 2, (screenH - 180) / 2348180"Kayıt Ol"false)
        guiWindowSetSizable(Kayıtol, false)
 
        GUIEditor.label[1] = guiCreateLabel(102611015"UserNAME :"false, Kayıtol)
        guiSetFont(GUIEditor.label[1], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
        GUIEditor.label[2] = guiCreateLabel(106311015"Password :"false, Kayıtol)
        guiSetFont(GUIEditor.label[2], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
        GUIEditor.label[3] = guiCreateLabel(1010211015"Password :"false, Kayıtol)
        guiSetFont(GUIEditor.label[3], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[3], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[3], "center")
        GUIEditor.edit[1] = guiCreateEdit(1341820033""false, Kayıtol)
        GUIEditor.edit[2] = guiCreateEdit(1345520033""false, Kayıtol)
        GUIEditor.edit[3] = guiCreateEdit(1349420033""false, Kayıtol)
        girişyap = guiCreateButton(1513111941"Giriş Yap"false, Kayıtol)
        guiSetProperty(girişyap, "NormalTextColour""FFAAAAAA")
        Kayıt = guiCreateButton(21513111941"Register"false, Kayıtol)
        guiSetProperty(GUIEditor.button[1], "NormalTextColour""FFAAAAAA")    
    end
)




 
function login()
        local screenW, screenH = guiGetScreenSize()
        window = guiCreateWindow((screenW - 348) / 2, (screenH - 181) / 2348181"RPG : Login Panel"false)
        guiWindowSetSizable(window, false)
 
        GUIEditor.label[1] = guiCreateLabel(104111715"User Name:"false, window)
        guiSetFont(GUIEditor.label[1], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[1], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[1], "center")
        GUIEditor.label[2] = guiCreateLabel(108311715"Password:"false, window)
        guiSetFont(GUIEditor.label[2], "default-bold-small")
        guiLabelSetHorizontalAlign(GUIEditor.label[2], "center"false)
        guiLabelSetVerticalAlign(GUIEditor.label[2], "center")
        GUIEditor.edit[1] = guiCreateEdit(1263019736""false, window)
        GUIEditor.edit[2] = guiCreateEdit(1277619736""false, window)
        girişyap = guiCreateButton(1513111138"login"false, window)
        guiSetProperty(girişyap, "NormalTextColour""FFAAAAAA")
        KayıtOl = guiCreateButton(21312911138"Register"false, window)
        guiSetProperty(KayıtOl, "NormalTextColour""FFAAAAAA")    
        
        showCurusor(true)
        addEventHandler("onClientGUIClick",kayıt,function() 
end


 

 

----------------------------------------------------------------------By the way, thanks------------------------------------------------------------------------------------------------------------

Link to comment

You need to use addEventHandler using the onClientGUIClick event to know when somebody presses any of the buttons. Assuming that you have read the tutorial I have posted, you then require a server-side account system. You can use the MTA provided one. Inside of the onClientGUIClick event handler you should send data to the server using the triggerServerEvent function. Let's call this new server event "onRequestPlayerLogin". Inside of said event handler you can use the "client" global variable with two event parameters "username" and "password" using the logIn function to perform the logging in.

You should do it very simiilarly for the registration of users. Just that you use the addAccount function instead.

Edited by The_GTA
  • Like 1
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...