Resulcan Posted April 2, 2020 Posted April 2, 2020 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?
The_GTA Posted April 2, 2020 Posted April 2, 2020 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!
Resulcan Posted April 2, 2020 Author Posted April 2, 2020 addEventHandler("onClientResourceStart", resourceRoot, function kayıt() local screenW, screenH = guiGetScreenSize() Kayıtol = guiCreateWindow((screenW - 348) / 2, (screenH - 180) / 2, 348, 180, "Kayıt Ol", false) guiWindowSetSizable(Kayıtol, false) GUIEditor.label[1] = guiCreateLabel(10, 26, 110, 15, "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(10, 63, 110, 15, "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(10, 102, 110, 15, "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(134, 18, 200, 33, "", false, Kayıtol) GUIEditor.edit[2] = guiCreateEdit(134, 55, 200, 33, "", false, Kayıtol) GUIEditor.edit[3] = guiCreateEdit(134, 94, 200, 33, "", false, Kayıtol) girişyap = guiCreateButton(15, 131, 119, 41, "Giriş Yap", false, Kayıtol) guiSetProperty(girişyap, "NormalTextColour", "FFAAAAAA") Kayıt = guiCreateButton(215, 131, 119, 41, "Register", false, Kayıtol) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFAAAAAA") end ) function login() local screenW, screenH = guiGetScreenSize() window = guiCreateWindow((screenW - 348) / 2, (screenH - 181) / 2, 348, 181, "RPG : Login Panel", false) guiWindowSetSizable(window, false) GUIEditor.label[1] = guiCreateLabel(10, 41, 117, 15, "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(10, 83, 117, 15, "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(126, 30, 197, 36, "", false, window) GUIEditor.edit[2] = guiCreateEdit(127, 76, 197, 36, "", false, window) girişyap = guiCreateButton(15, 131, 111, 38, "login", false, window) guiSetProperty(girişyap, "NormalTextColour", "FFAAAAAA") KayıtOl = guiCreateButton(213, 129, 111, 38, "Register", false, window) guiSetProperty(KayıtOl, "NormalTextColour", "FFAAAAAA") showCurusor(true) addEventHandler("onClientGUIClick",kayıt,function() end ----------------------------------------------------------------------By the way, thanks------------------------------------------------------------------------------------------------------------
The_GTA Posted April 2, 2020 Posted April 2, 2020 (edited) 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 April 2, 2020 by The_GTA 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now