Jump to content

Firespider

Members
  • Posts

    215
  • Joined

  • Last visited

Everything posted by Firespider

  1. And if i set the pics download false then also save pics in the memory?
  2. @FileEX And if i set the Chache false then the player can use the script?
  3. Can I also use this cache in server scripts?
  4. Hello, I'm currently working on an RP mod and I've started testing it with several people, the only problem is that when they log in, it downloads the MTA mod for them, but they can easily publish it because they can access client.lua, etc. see the script files
  5. I wrote a small code that can be connected to chat, the problem is that if I start the resource there will be a double chat, how can I solve this so that there is only one chat local radius = 10 addEventHandler("onPlayerChat", root, function (message, messageType) if (messageType == 0) then local x, y, z = getElementPosition(source) for i, player in ipairs(getElementsByType("player")) do local x1, y1, z1 = getElementPosition(player) local name = getPlayerName(source) if getDistanceBetweenPoints3D(x, y, z, x1, y1, z1) <= radius then outputChatBox("#cccccc" .. name .. " #ffffff mondja: #cccccc"..message , root, 0, 0, 0, true) end end end end )
  6. Hello, I want to write a system with which the player can fly, the only problem is that I have never written a fly system in my life. Can you recommend a few functions that can help in making it?
  7. This problem is that one encrypted text is shorter than the other and so it is not the same what to do with it
  8. That's the problem, I'll send the whole server page to see if it helps addEvent("register", true) addEventHandler("register", root, function (user, pass, repass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq, 250) local HashPass = sha256(pass) if (#result > 0) then print("NODUPLACITEACC") else dbExec(db, "INSERT INTO accounts (username, password, serial) VALUES (?, ?, ?)", user, HashPass, serial) end end ) addEvent("login", true) addEventHandler("login", root, function (user, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq,250) if (#result > 0) then if user == result[1]["username"] then if (passwordVerify(pass,result[1]["password"])) then print("Sikeres bejelentkezés!") else print("Hibás jelszó!") end else print("Felhasználónév nem található!") end else print("Sikertelen bejelentkezés!") end end)
  9. Doesn't Working i have a same problem
  10. So I encrypted the password local Pass = hash("sha512", pass) Should I replace it with this one now? sha256(pass)
  11. So should I use this function to encrypt the password? Sorry to ask so many questions, but I'm new to this. @WWW
  12. Thanks, does this still work, is the player's password encoded in sha512?
  13. Hello, I have a problem when logging in. I try to see if the hashed password in the database is the same as the one entered by the player for the password, so I check if the password is correct. But even if you enter a good password and the two passwords are the same, the system always says that the password is incorrect. Can you help? addEvent("login", true) addEventHandler("login", root, function (user, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq, 250) if (#result > 0) then outputChatBox(pass) local Pass = hash("sha512", pass) outputChatBox(Pass) if user == result[1]["username"] then if Pass == result[1]["password"] then print("Sikeres bejelentkezés!") else print("Hibás jelszó!") end else print("Felhasználónév nem található!") end else print("Sikertelen bejelentkezés!") end end )
  14. Hello, I am writing the login part of the login panel and the problem is that I have to verify the enter addEvent("login", true) addEventHandler("login", root, function (user, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq, 250) if (#result > 0) then outputChatBox(pass) local Pass = hash("sha512", pass) outputChatBox(Pass) if user == result[1]["username"] then if Pass == result[1]["password"] then print("Sikeres bejelentkezés!") else print("Hibás jelszó!") end else print("Felhasználónév nem található!") end else print("Sikertelen bejelentkezés!") end end ) ed password so that it matches the registered password, the two texts match, but the system detects that they do not match, is there anything I can do?
  15. @Balázs1 köszi a tippet, bár már nagyon régem írtam a postot.
  16. Thanks! but passwordVerify still gives false
  17. -- Szerveroldali kód local db = dbConnect("mysql", "dbname=happy life roleplay;host=127.0.0.1;charset=utf8", "root", "", "share=0") addEvent("attemptLogin", true) addEventHandler("attemptLogin", resourceRoot, function(username, pass) local dq = dbQuery(db, "SELECT * FROM accounts WHERE username=?", username) local result = dbPoll(dq, 250) if result then if #result > 0 then local hash1 = passwordHash(pass, "bcrypt", {}) -- pretend this one is saved on the database some time ago local hash2 = passwordHash(pass, "bcrypt", {}) -- pretend this one was just hashed now print(hash1) print(hash2) local passVerified = passwordVerify(pass, hash1) if passVerified and hash1 == result[1]["password"] then print("Sikerült") else print("Nem Sikerült") end else outputChatBox("Nincs ilyen fiók") end else outputChatBox("Nem csatlakozott az adatbázishoz") end end) addEvent("attemptReg", true) addEventHandler("attemptReg", resourceRoot, function(username, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE serial=?", serial) local result = dbPoll(dq, 250) if result and #result > 0 then outputChatBox("Felhasználó már létezik.") else dbExec(db, "INSERT INTO accounts (username, password, serial) VALUES (?, ?, ?)", username, hash2, serial) outputChatBox("Sikerült") end end)
  18. I tried to solve it so that it only succeeds if it is equal, but that's not good either, because the hash will always be different when I press the button and so it doesn't match the database.
  19. Should I also change it during registration? @Addlibs Now it always says that I'm typing correctly, but not XD
  20. Here is a larger part of the code, everything that handles registration or login is here. function Login() if Data[1][1] ~= "" and Data[1][2] ~= "" then local hashedPass = passwordHash(Data[1][2], "bcrypt",{}) triggerServerEvent("attemptLogin", resourceRoot, Data[1][1], hashedPass) else LogAlert("EmptyRectangle") end end function Reg() local Empty = false if Data[2][1] == "" or Data[2][2] == "" then Empty = true LogAlert("EmptyRectangle") end if not Empty then if string.len(Data[2][1]) > 3 then if string.len(Data[2][2]) > 3 then if Data[2][2] == Data[2][3] then local hashedPass = passwordHash(Data[2][2], "bcrypt",{}) triggerServerEvent("attemptReg", resourceRoot, Data[2][1], hashedPass) else LogAlert("NotMatch") end else LogAlert("ToShortPass") end else LogAlert("ToShortUS") end end end addEvent("Alert", true) function LogAlert(response) if (isTimer(ErorrTimer)) then killTimer(ErorrTimer) end if response == "EmptyRectangle" then Problem[1] = "Töltsd ki az összes kis rublikát" elseif response == "NoMatch" then Problem[1] = "Nem egyeznek a jelszavak" elseif response == "ToShortUS" then Problem[1] = "Túl rövid a felhasználó neved" elseif response == "ToShortPass" then Problem[1] = "Túl rövid a jelszavad" end ErorrTimer = setTimer(function() Problem[1] = "" end, 3000, 0) end
  21. It's not good, unfortunately. It also says that I am entering the wrong password, but it is exactly the same.
  22. Yes, I store them using the hash principle. And of course I hash the password with passwordHash. I don't know how understandable this is. XD
  23. My system says "nem sikerült", so it didn't solve the problem, I'm sending the new code Client local hashedPass = passwordHash(Data[1][2], "bcrypt",{}) triggerServerEvent("attemptLogin", resourceRoot, Data[1][1], hashedPass) Server addEvent("attemptLogin", true) addEventHandler("attemptLogin", resourceRoot, function(username, pass) local serial = getPlayerSerial(client) local dq = dbQuery(db, "SELECT * FROM accounts WHERE username=?", username) local result = dbPoll(dq, 250) if result then if #result > 0 then local passHashFromDB = result[1]["password"] local passVerified = passwordVerify(passHashFromDB, pass) if passVerified then outputChatBox("Sikerült") else outputChatBox("Nem Sikerült") end else outputChatBox("Nincs ilyen fiók") end else outputChatBox("Nem csatlakozott az adatbázishoz") end end)
×
×
  • Create New...