Jump to content

Search the Community

Showing results for tags 'dbquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Multi Theft Auto: San Andreas 1.x
    • Support for MTA:SA 1.x
    • User Guides
    • Open Source Contributors
    • Suggestions
    • Ban appeals
  • General MTA
    • News
    • Media
    • Site/Forum/Discord/Mantis/Wiki related
    • MTA Chat
    • Other languages
  • MTA Community
    • Scripting
    • Maps
    • Resources
    • Other Creations & GTA modding
    • Competitive gameplay
    • Servers
  • Other
    • General
    • Multi Theft Auto 0.5r2
    • Third party GTA mods
  • Archive
    • Archived Items
    • Trash

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Gang


Location


Occupation


Interests

Found 5 results

  1. it's working the way I hope there is no error, but I noticed that when checkingpedingQuery[1][status] == 2 it returns only 1 value from a row of the status column I can't make it read more columns with status 2 is only giving 1 line with status 2 function saqueBankMoney(thePlayer, money) local checkpedingQuery = dbPoll(dbQuery(sql, "SELECT * FROM dbt_withdraw WHERE user_id = ? AND status <> "..tonumber(5).." ORDER BY status DESC ", getElementData(thePlayer, "char:userid")), -1) local amount = string.format("%09.8f",checkpedingQuery[1]["amount"] or 0) local amount = tonumber(amount) local vip = getElementData(thePlayer, "char:vip") or 0 local Moedas = string.format("%09.8f", getElementData(thePlayer, "char:vip") or 0) local balance = Moedas - 0.00010000 local man = 10000 if checkpedingQuery[1]["status"] == 2 then if money == getElementData(thePlayer, "char:vip") or money <= getElementData(thePlayer, "char:vip") then if balance > amount then dbExec(sql, "UPDATE dbt_balance SET balance = ? WHERE user_id = ?",balance, getElementData(thePlayer, "char:userid")) setElementData(thePlayer, "char:bankexchange", string.format("%09d", getElementData(thePlayer, "char:bankexchange")) + man) exports.logs:logMessage("[SAQUE]: "..getPlayerName(thePlayer).." ID: "..getElementData(thePlayer, "acc:id").." sacou R$: "..money.." no banco Total: "..getElementData(thePlayer, "char:vip").."", 1) else exports.FR_DxMessages:addBox(thePlayer,"blocked funds", "error") exports.FR_DxMessages:addBox(thePlayer,"peding withdraw", "info") end else outputChatBox('#0071fe[TRANSFERIDOR] #FFFFFFVocê está sem dinheiro', thePlayer,255,255,255,true) end end if checkpedingQuery[1]["status"] == 1 then if money == getElementData(thePlayer, "char:vip") or money <= getElementData(thePlayer, "char:vip") then dbExec(sql, "UPDATE dbt_balance SET balance = ? WHERE user_id = ?",balance, getElementData(thePlayer, "char:userid")) setElementData(thePlayer, "char:bankexchange",string.format("%09d", getElementData(thePlayer, "char:bankexchange")) + man) exports.FR_DxMessages:addBox(thePlayer,"Você retirou "..money.." do banco da exchange! ", "sucess") else outputChatBox('#0071fe[TRANSFERIDOR] #FFFFFFVocê está sem dinheiro', thePlayer,255,255,255,true) end end end
  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. The connection is okay but dbQuery and dbPoll first argument got nil. ( sorry for my bad english ) ERROR: MYSQL CONNECTION CODE: "felhasznalo" SCRIPT:
  4. Hello guys!How can i use the variables bannedBy, and accountID outside of this code block? local bannedBy local accountID for _, row in ipairs(query) local bannedBy = row["bannedBy"] local accountID = row["accountID"] end
  5. I have the following, which just gets "skin", "cash" and "wasWanted" from the DB function spawnOnLogin () playerName = getPlayerName(source) local findPlayer = dbQuery(db, "SELECT `skin`, `cash`, `wasWanted` FROM player_stuff WHERE name=?", playerName ) local dataresult = dbPoll ( findPlayer, -1 ) if dataresult[1] then local skin = dataresult["skin"] local cash = dataresult["cash"] local wasWanted = dataresult["wasWanted"] end end addEventHandler("onPlayerJoin", getRootElement(), spawnOnLogin) the variables "skin", "cash" and "wasWanted" all come back nil, since I can't work out the right way to get the result. Been looking for ages but can't find the right way to do it, can someone explain to me how I retrieve these values from the query result properly? Thanks
×
×
  • Create New...