Jump to content

Spider Pork

Members
  • Posts

    60
  • Joined

  • Last visited

Everything posted by Spider Pork

  1. I've already tried that. It always returns false. [...] if(logIn(player, user, pass) == true) then [...]
  2. San Andreas. The map is huge and a great mix of countryside, city and desert. Vice City is also quite great but GTA IV is just a failure for me. Of course it's got great graphics, but the map is horrible.
  3. Fixed the "Access denied" warning. Now my problem is the "Bad argument" warning when I use logIn. Here's the onRegister event: function onRegister(player, user, pass) local account = getAccount(user, pass) if(account ~= false) then if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end else account = addAccount(user, pass) if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully registered and logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end end end and onLogin: function onLogin(player, user, pass) local account = getAccount(user, pass) if(account ~= false) then if(logIn(player, account, pass) == true) then triggerClientEvent("hideLoginWindow", getRootElement()) outputChatBox("You have been successfully logged in.", player) else outputChatBox("Error: Invalid password, username or already logged in.", player) end else outputChatBox("Error: Invalid username or password.", player) end end
  4. Hey there! Recently the console outputs these warnings to me when I attempt to register: [09:15:25] WARNING: script.lua: Access denied @ 'addAccount' - Line: 77 [09:15:25] WARNING: script.lua: Bad argument @ 'logIn' - Line: 78 The lines are these two (server-side script): [...] account = addAccount(user, pass) if(logIn(player, account, pass) == true) then [...] Has anyone got any clue of what's wrong here? If anything's missing, please let me know. Thanks.
  5. Sorry for double post, but I've got another question. Is it possible to disable the native /register and /login?
  6. Thanks for all your help. I got it fixed.
  7. According to the wiki, it returns false if the specified account can't be found in the database: --------------------------- I found this: Though I can't find anything else about showing it on join in the tutorial. Or am I missing something?
  8. Wow, you've got to be kidding me. This is one of the best maps I have ever seen. Your mapping skill is just amazing. Keep up!
  9. Hello there! I guess I've done something wrong, since I'm not familiar with server-side and client-side stuff. The GUIs that should show when a player connects, don't show. I've mostly done what the tutorial about GUIs said, only edited a bit. Also, /debugscript doesn't come up with any errors or warnings, not even info messages. Here is the code: (server-side) function joinHandler() fadeCamera(source, true) outputChatBox("Welcome to the Wasteland Warzone Roleplay server.", source) if(getAccount(getPlayerName(source)) == false) then outputChatBox("Please proceed with registering.", source) triggerClientEvent("Register", source) else outputChatBox("Please proceed with logging in.", source) triggerClientEvent("Login", source) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) (client-side) -- Register -- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createLogin() createRegister() end ) function createRegister() guiRegister = guiCreateWindow(0.375, 0.375, 0.25, 0.25, "Please register to continue.", true) guiCreateLabel(0.0825, 0.2, 0.25, 0.25, "Username: " ... getPlayerName() ... "", true, guiRegister) guiCreateLabel(0.0825, 0.5, 0.25, 0.25, "Password:", true, guiRegister) edtPass = guiCreateEdit(0.415, 0.5, 0.5, 0.15, "Enter a password", true, guiRegister) guiEditSetMaxLength(edtPass, 50) btnRegister = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Register", true, guiRegister) addEventHandler("onClientGUIClick", btnRegister, guiSubmitRegister, false) btnDisconnect = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Disconnect", true, guiRegister) addEventHandler("onClientGUIClick", btnDisconnect, guiSubmitDisconnect, false) requestRegister() end function requestRegister() guiSetVisible(guiRegister, true) guiSetInputEnabled(true) showCursor(true, true) end function guiSubmitRegister(button, state) if button == "left" and state == "up" then local password = guiGetText(edtPass) if password then triggerServerEvent("registerPlayer", getRootElement(), password) guiSetInputEnabled(false) guiSetVisible(guiRegister, false) showCursor(false) else outputChatBox("Error: No password entered.") end end end function guiSubmitDisconnect(button, state) if button == "left" and state == "up" then outputChatBox("You have been disconnected.") kickPlayer() end end -- Login -- function createLogin() guiLogin = guiCreateWindow(0.375, 0.375, 0.25, 0.25, "Please register to continue.", true) guiCreateLabel(0.0825, 0.2, 0.25, 0.25, "Username: " ... getPlayerName() ... "", true, guiLogin) guiCreateLabel(0.0825, 0.5, 0.25, 0.25, "Password:", true, guiLogin) edtPass = guiCreateEdit(0.415, 0.5, 0.5, 0.15, "Enter a password", true, guiLogin) guiEditSetMaxLength(edtPass, 50) btnLogin = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Register", true, guiLogin) addEventHandler("onClientGUIClick", btnLogin, guiSubmitLogin, false) btnDisconnect = guiCreateButton(0.415, 0.7, 0.25, 0.2, "Disconnect", true, guiLogin) addEventHandler("onClientGUIClick", btnDisconnect, guiSubmitDisconnect, false) requestLogin() end function requestLogin() guiSetVisible(guiLogin, true) guiSetInputEnabled(true) showCursor(true, true) end function guiSubmitLogin(button, state) if button == "left" and state == "up" then local password = guiGetText(edtPass) if password if(logIn(getPlayerUserName(), password) else outputChatBox("Error: Invalid password.", thePlayer, 255, 255, 0) end triggerServerEvent("loginPlayer", getRootElement(), password) guiSetInputEnabled(false) guiSetVisible(guiLogin, false) showCursor(false) else outputChatBox("Error: No password entered.") end end end function guiSubmitDisconnect(button, state) if button == "left" and state == "up" then outputChatBox("You have been disconnected.") kickPlayer() end end -- Events -- addEvent("Login", true) addEventHandler("Login", getRootElement(), createLogin) addEvent("Register", true) addEventHandler("Register", getRootElement(), createRegister) I'll also accept critism about my identation, optimisation etc. Everything is helpful to a beginner, I guess ...
×
×
  • Create New...