Jump to content

p1kas

Members
  • Posts

    4
  • Joined

  • Last visited

p1kas's Achievements

Vic

Vic (3/54)

0

Reputation

  1. thank you. can you help me with this pls, i'll grateful for you
  2. there is a function to login to account: function login(username, password) local player = client if not (does_account_exist(username)) then create_error_message_dialog("Аккаунта с таким логином не существует!") return; else local handle = dbQuery(function (handle) --callback for the query selecting the user by username local results = dbPoll(handle, -1) if (#results == 0) then outputChatBox("Login Failed!") --triggerClientEvent(player, "loginFailed") return end passwordVerify(password, results[1].password, {}, function(matches) -- callback function for the password verify if (matches) then -- Do anything you wish with the database result to log the player in with the rest of your scripts outputChatBox("Login Success!") --triggerClientEvent(player, "loginSuccess") else outputChatBox("Login Failed!") --triggerClientEvent(player, "loginFailed") end if (rememberMe) then local token = generateRandomToken() dbExec(function() --triggerClientEvent(player, "loginSuccess", token) end,mysqlHandle, "INSERT INTO `access_tokens` (`user_id`, `token`) VALUES ('"..tostring(results[1].id).."', '"..tostring(token).."')") end end) end, mysqlHandle, "SELECT * FROM `users` WHERE username = '"..username.."'") end end but when you call passwordVerify(), the results table for the username returns the correct username, and for the password it returns nil, how to fix this (if necessary, the password is encoded in the database) I also wanted to ask, there is a button in the form of a rectangle: local buttonAuth_round = dgs:dgsCreateRoundRect(30,false,tocolor(62,153,247)) local buttonAuth = dgs:dgsCreateImage(182,0,164,56,buttonAuth_round,false,loginButtons,tocolor(62,153,247)) local buttonAuth_text = dgs:dgsCreateLabel(57,18,50,20,'Войти', false, buttonAuth) There is an event handler: addEventHandler("onDgsMouseClick", buttonAuth, function() local login, password = dgs:dgsGetText(inputLogin_edit), dgs:dgsGetText(inputPass_edit) if not string.find(login, "%S") then return end if not string.find(password, "%S") then return end triggerServerEvent("playerLogin", getLocalPlayer(), login, password) end, false) But when you click on a button or any other dgs element (which is being processed) - it is triggered two times (simultaneously), how can this be fixed?
  3. There is a button in the form of a rectangle: local buttonAuth_round = dgs:dgsCreateRoundRect(30,false,tocolor(62,153,247)) local buttonAuth = dgs:dgsCreateImage(182,0,164,56,buttonAuth_round,false,loginButtons,tocolor(62,153,247)) local buttonAuth_text = dgs:dgsCreateLabel(57,18,50,20,'Войти', false, buttonAuth) There is an event handler: addEventHandler("onDgsMouseClick", buttonAuth, function() local login, password = dgs:dgsGetText(inputLogin_edit), dgs:dgsGetText(inputPass_edit) if not string.find(login, "%S") then return end if not string.find(password, "%S") then return end triggerServerEvent("playerLogin", getLocalPlayer(), login, password) end, false) But when you click on a button or any other dgs element (which is being processed) - it is triggered two times (simultaneously), how can this be fixed?
  4. Есть кнопка в виде прямоугольника: local buttonAuth_round = dgs:dgsCreateRoundRect(30,false,tocolor(62,153,247)) local buttonAuth = dgs:dgsCreateImage(182,0,164,56,buttonAuth_round,false,loginButtons,tocolor(62,153,247)) local buttonAuth_text = dgs:dgsCreateLabel(57,18,50,20,'Войти', false, buttonAuth) Есть обработчик: addEventHandler("onDgsMouseClick", buttonAuth, function() local login, password = dgs:dgsGetText(inputLogin_edit), dgs:dgsGetText(inputPass_edit) if not string.find(login, "%S") then return end if not string.find(password, "%S") then return end triggerServerEvent("playerLogin", getLocalPlayer(), login, password) end, false) Но при нажатии на кнопку или любой другой dgs элемент (который обрабатывается) — срабатывает два раза (одновременно), как это можно исправить?
×
×
  • Create New...