Jump to content

Abbas_gamer100

Members
  • Posts

    24
  • Joined

  • Last visited

About Abbas_gamer100

  • Birthday January 17

Details

  • Gang
    Russian Mafia
  • Location
    Astrakhan, Astrakhan Oblast, Russia
  • Occupation
    Computer Programmer
  • Interests
    Programming, gaming, studying languages

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Abbas_gamer100's Achievements

Civilian

Civilian (7/54)

0

Reputation

  1. It didn't work either. I don't know what's wrong.
  2. function createLoginGui () wdwLogin = guiCreateWindow(529, 206, 488, "Login Panel", false) guiWindowSetMovable (wdwLogin, false) guiWindowSetSizable (wdwLogin, false) guiSetAlpha (wdwLogin, 1.00) guiSetProperty (wdwLogin, "CaptionColour", "FFFEFEFE") lblMainLogin = guiCreateLabel (7, 14, 293, 48, "Testing server", true, wdwLogin) guiSetFont (lblMainLogin, "clear-normal") guiLabelSetColor(lblMainLogin, "center", true) guiLabelSetHorizontalAlign (lblMainLogin, "center", true) guiLabelSetVerticalAlign (lblMainLogin, "center", true) guiLabelSetVerticalAlign (lblMainLogin, "center") lblUsernameLogin = guiCreateLabel (11, 77, 124, 24, "Username", true, wdwLogin) edtUsernameLogin = guiCreateEdit (11, 106, 279, 34, "", true, wdwLogin) lblPasswordLogin = guiCreateLabel (16, 147, 128, 24, "Password", true, wdwLogin) edtPasswordLogin = guicreateEdit (11, 171, 279, 34, "", true, wdwLogin) btnLogin = guiCreateButton (10, 308, 114, 34, "Register", true, wdwLogin) guiSetVisible (wdwLogin, false) end addEventHandler ("onClientResourceStart", getRootElement(), function () createLoginGui () outputChatbox ("Welcome to the testing server") if (wdwLogin == nil) then guiSetVisible (wdwLogin, true) else outputChatbox ("Failed to create login panel") end showCursor (true) guiSetInputEnabled (true) end ) I need help concerning my login panel. I scripted it right and according to the MTA website tutorial. But when I join the server it the login panel doesn't show up, and I am left with black screen. The code is up there, something wrong with it? Here's how it's defined in meta.xml: <meta> <info author="Someguy" type="gamemode" name="Testing server" description="A server for testing scripts" /> <script src="client/login_gui.lua" type="client" /> </meta>
  3. I placed the code in a clientside file. And identified it as client in meta.xml. But I still get the error message. Error: attempt to call local getAccount (a nil value)
  4. Проблема заключается в том: Я начинающий. Так, я следую за учебники на вики.
  5. Error message: Error: attempt to call getAccount(a nil value)
  6. It shows up my password and my account name. I will try the method you posted about logIn
  7. It worked. But the GUI isn't logging me on still. It shows the error message I've set when the GUI couldn't log me in(the original problem). What is the solution for this? Or should I use logIn? If yes tell me how and how to connect it to the GUI.
  8. I think we are almost there. After placing the code you've given me. I had this error message: Error: attempt to concatenate local 'password' (a nil value)
  9. Alright. Everyting is okay now. I know where exactly the error is. Exactly this time. It's in loginHandler. The GUI runs okay. But it is having a problem loggin me in. The original problem I posted this thread to solve. This is where the script has the error (where the debug strings showed me that it didn't work): loginHandler: function loginHandler(player, username, password) outputDebugString("loginHandler has been called")--This string showed if username == "user" and password == "apple" then outputDebugString("Checking username and password is being executed!")--But this didn't if (isElement(player)) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server", client) outputDebugString("Player spawned after logging in!")--And this didn't also. end else outputChatBox("An unexpected error has occured!")--This showed in the server's chat box outputDebugString("Player didn't spawn after he logged in!")--And this showed up. Meaning the GUI runs just fine. But it has a problem logging me in!! end end addEvent("submitLogin", true) addEventHandler("submitLogin", resourceRoot, loginHandler)
  10. Done. I detected the problem. The GUI panel is working. But it's button functions are not. And they said after executing the working debug strings: attempt to call outputDebugString < a nil value> Here's the code: function clientSubmitLogin(button, state) outputDebugString("The clientSubmitLogin function has been called!") if button == "left" and state == "up" then outputDebugString("Player has called the button function!") local username = guiGetText(Edit1) local password = guiGetText(Edit2) if username and password then --All previous debug strings has been called. And the following debug strings didn't outputDebugscript("Player has logged in!") triggerServerEvent("submitLogin", getRootElement(), username, password) guiSetInputEnabled(false) guiSetVisible(LoginPanel, false) showCursor(false) else outputChatBox("Please enter a valid username and password.") outputDebugString("The function ran through an error while executing!") end end end loginHandler script : --The following debu strings didn't show up too. function loginHandler(player, username, password) outputDebugString("loginHandler has been called") if username == "user" and password == "apple" then outputDebugString("Checking username and password is being executed!") if (isElement(player)) then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server", client) outputDebugString("Player spawned after logging in!") end else outputChatBox("An unexpected error has occured!") outputDebugString("Player didn't spawn after he logged in!") end end addEvent("submitLogin", true) addEventHandler("submitLogin", resourceRoot, loginHandler)
  11. Update: I kept trying, and I noticed the Console says username and password do not match. But my account exists and the proof is that I used my admin account to restart the script.
  12. I didn't understand fully. The thing is. I am a beginner. And I try to make scripts following the MTA tutorials.. And I end up with many bugs and problems. Especially with GUIs I used your modified script. Now the error message doesn't show up but it doesn't log me in either.
  13. Sure. Here it is: addEventHandler("onClientResourceStart", getResourceRootElement(), function() LoginPanel = guiCreateWindow(299, 101, 362, 521, "Login Panel", false) guiWindowSetMovable(LoginPanel, false) guiWindowSetSizable(LoginPanel, false) Image = guiCreateStaticImage(13, 37, 339, 130, ":admin/client/images/flags/ru.png", false, LoginPanel) Label1 = guiCreateLabel(20, 233, 67, 39, "Username", false, LoginPanel) Edit1 = guiCreateEdit(77, 228, 200, 24, "", false, LoginPanel) Edit2 = guiCreateEdit(77, 267, 200, 24, "", false, LoginPanel) Label2 = guiCreateLabel(20, 267, 67, 39, "Password", false, LoginPanel) Button1 = guiCreateButton(20, 334, 104, 40, "Login", false, LoginPanel) addEventHandler("onClientGUIClick", Button1, clientSubmitLogin, false) outputChatBox("Welcome to my Server!") if (LoginPanel ~= nil) then guiSetVisible(LoginPanel, true) else outputChatBox("An unexpected error has occured! Please re-connect and try again.") end showCursor(true) guiSetInputEnabled(true) end ) function clientSubmitLogin(button, state) if button == "left" and state == "up" then local username = guiGetText(Edit1) local password = guiGetText(Edit2) if username and password then triggerServerEvent("submitLogin", resourceRoot, player, username, password) guiSetInputEnabled(false) guiSetVisible(LoginPanel, false) showCursor(false) else outputChatBox("Please enter a valid username and password.") end end end loginHandler: function loginHandler(player, username, password) outputDebugString("loginHandler has been called") if username == "user" and password == "apple" then outputDebugString("Username and password do not match.") if (not client and isElement(player)) or client == player then spawnPlayer(client, 1959.55, -1714.46, 10) fadeCamera(client, true) setCameraTarget(client, client) outputChatBox("Welcome to My Server", client) outputDebugString("I am an idiot!") end else outputChatBox("An unexpected error has occured!") end end addEvent("submitLogin", true) addEventHandler("submitLogin", resourceRoot, loginHandler)
×
×
  • Create New...