Jump to content

Search the Community

Showing results for tags 'mysql'.

  • 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

  1. connection = dbConnect( "mysql", "dbname="..mySQLDetails["db"]..";host="..mySQLDetails["host"].."", ""..mySQLDetails["acc"].."", ""..mySQLDetails["pass"].."", "share=1" ) function dbQuery(query, values) qh = dbQuery(connection, query, values) end Hi! I am making a mysql script, and i would not like to do the dbConnect stuff and things like this everytime. But after the query, there might be values, not only just one. So for example in the query, i want to insert 2 things, and it would look like this: -------------------------------------------------string query------------------------------------------- ---------------------values------------- dbQuery(connection, "INSERT INTO users (username, password) VALUES (?, ?)", Username, md5(Password)) But the password would not be inserted! I know that i'll have to use table. but how?
  2. Hi guys, i was trying to load some korean strings from mariadb like "소말리아", "중국" and when it's loaded with dbPoll and look at it with outputChatBox its characters are replaced with question marks ( "소말리아" -> "????", "중국" -> "??" ) and when it's saved to mariadb, it also displays it as question marks i tried changing collation and connection collation of mariadb to both utf-8 and euckr(korean charset) but it didn't work i would be really gratefull if someone can solve this for me here's the code i used function loadNations() local qh = dbQuery(dbc,"select * from nations") local result = dbPoll(qh,-1) for i=1,#result do nations[i] = {} for k,v in pairs(result[i]) do nations[i][k] = v end end end function saveNations() local qh for i=1,#nations do for k,v in pairs(nations[i]) do dbExec(dbc,"update nations set `??`=? where nid=?",k,v,nations[i]["nid"]) end end end edit: solved, i had to provide charset when using dbConnect
  3. Hello I have, going to do a ranking of players where considered to be, and their quantity. The entry points I made to the MySQL database, there is written the number of points, the player and continuously updated. 3D GUI also I have done, I give the code below. I would like to make in this GUI was displayed ranking 10 or 5 players with the most points. I have no idea how I make such a ranking. This is beyond my skills. Here is the code for 3D GUI: local renderTarget = dxCreateRenderTarget(1000, 1000, true) local X, Y, Z = -345.5341796875, -1031.6298828125, 59.296432495117 local title_font = dxCreateFont(":server_fonts/main_font.ttf", 63) local ranking_font = dxCreateFont(":server_fonts/main_font.ttf", 50) addEventHandler("onClientRender", root, function() dxSetRenderTarget(renderTarget, true) dxDrawRectangle( 0, 0, 1000, 700, tocolor(72, 71, 81, 190)) -- Background dxDrawText("Job Ranking", 0, 0, 1000, 100, tocolor(255, 255, 255, 255), 1, title_font, "center", "center") -- Text dxDrawText("1. ", -830, 300, 1000, 50, tocolor(255, 255, 255, 255), 1, ranking_font, "center", "center") -- Text dxSetRenderTarget() dxDrawMaterialLine3D( X, Y, Z + 5, X, Y, Z, renderTarget, 5, tocolor(255, 255, 255, 255), -2000, 0, 0) end)
  4. Dear users, I created a test resource called "prova". When I try to start it, I get this error: [12:50:25] start: Requested by Console [12:50:25] Resource 'prova' changed, reloading and starting [12:50:25] Starting prova [12:50:25] WARNING: [mie]/prova/mysql.lua:4: Bad usage @ 'dbConnect' [Can't connect to local MySQL s erver through socket '' (111)] [12:50:25] start: Resource 'prova' started As it appears, the problem is in the mysql.lua file, executed serverside, this is the code: db = nil function conn() db = dbConnect('mysql', 'dbname=mtasa;host=localhost;port=3306;', 'mtasa', '', "share=1") end function disc() destroyElement(db) end function segnalo(msg, tipo) dbExec(db, 'INSERT INTO provatab(testo, soldi, spotf) VALUES(?, ?, ?)', 'Msg-'..tostring(tipo)..': '..msg, 2500, 1) end function giraarma(prima, mo) dbExec(db, 'INSERT INTO provatab(testo, soldi, spotf) VALUES(?, ?, ?)', 'Arma da '..tostring(prima)..' a '..tostring(mo)..' - Chi: '..getPlayerName(source), 2500, 1) end addEventHandler('onResourceStart', getResourceRootElement(), conn) addEventHandler('onResourceStop', getResourceRootElement(), disc) addEventHandler("onPlayerChat", getRootElement(), segnalo) addEventHandler("onPedWeaponSwitch", getRootElement(), giraarma) I thought it could be a mysql problem, but when I try to access to my database via phpmyadmin on localhost server, I can access without problems. What can it be? Please help!
  5. بسم الله الرحمن الرحيم سلام عليكم ورحمة الله وبركاته ,, حبيت اطرح شرح executeSQLQuery مفصل وكامل ان شاء الله . لكثرة الاعضاء الغير فاهمين له او الجاهلين له بسم الله نبدأ .. executeSQLQuery = عبارة عن قاعدة في سيرفرك dbConnect = عبارة عن قاعدة متصلة بالخادم او بالملف اولاً بننشئ كود الاتصال لو كنت بتستعمل dbFunctions test_db = dbConnect( "sqlite", "file.db" ) -- عبر ملف test_db = dbConnect( "mysql", "dbname=frank;host=1.2.3.4", "username", "password", "share=1" ) -- عن طريق الاتصال بالخادم .: ) فالنفترض انه عندنا القاعدة بهذا الشكل : { } فاضي صحيح ؟ طيب عشان ننشئ تيبل وندرج فيه المعلومات , بنحتاج نكتب هالكود : local result1 = executeSQLQuery ( "CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT)" ) local qh = dbQuery( test_db, "CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT)" ) -- نسوي الأمر local result2 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result1 and result2 ) then print ( "Success to create tables" ) -- نكتب في الديبق نجاح في انشاء الجداول end -- CREATE TABLE IF NOT EXISTS players (name TEXT, money TEXT, health TEXT) -- الترجمة : -- players اصنع جدول اذا ماكان فيه جدول بأسم -- والأعمدة هي : -- name, money, health بيطلع الناتج في القاعدة ~> { players = { } } ^ الجدول حق players فاضي نبي نضيف عليه قيمة مثلا .. local result31 = executeSQLQuery ( "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'wifi','1000','100' ) local qh2 = dbQuery( test_db, "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'wifi','1000','100' ) -- نسوي الأمر local result41 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result31 and result41 ) then print ( "Success to insert values" ) -- نكتب في الديبق نجاح في ادخال القيم end -- INSERT INTO players(name,money,health) VALUES(?,?,?) -- الترجمة : -- أدخال الى player -- والأعمدة هي : -- name, money, health -- والقيم : -- ?,?,? == 'wifi', '1000', '100' ملاحظة مهمة جداً : عند وضع سهم داخل الأمر او اي عملية SQL استبداله بالارقمنت خارج العملية كمثال : ("?,?",'wifi','1000') -- الاستفهام الاول بيستبدل بوايفاي -- والاستفاهم الثاني بيستبدل برقم ألف ("?,'1000'",'wifi') -- الاستفهام الاول بيستبدل بوايفاي ^ أتمنى تكون وضحت : بيطلع الناتج في القاعدة ~> { players = { { name='wifi', money='1000', health='100' } } } لو نبي نضيف قيمة ثانية بأسم نصور مثلاً وجا بروس قال انا الي ابي اصير القيمة وتضاربو وبعدين صار بروس القيمة ونصور راح .. كذا نسوي : local result3 = executeSQLQuery ( "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'BrosS','-1000','10' ) local qh3 = dbQuery( test_db, "INSERT INTO players(name,money,health) VALUES(?,?,?)", 'BrosS','-1000','10' ) -- نسوي الأمر local result4 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result3 and result4 ) then print ( "Success to insert values" ) -- نكتب في الديبق نجاح في ادخال القيم end -- INSERT INTO players(name,money,health) VALUES(?,?,?) -- الترجمة : -- أدخال الى player -- والأعمدة هي : -- name, money, health -- والقيم : -- ?,?,? == 'BrosS', '-1000', '10' بيطلع الناتج في القاعدة ~> { players = { { name='wifi', money='1000', health='100' }, { name='BrosS', money='-1000', health='10' }, } } طيب لو نبي نجيب فلوس واي فاي كيف ؟ بهذي الطريقة : local result5 = executeSQLQuery ( "SELECT money FROM players WHERE name=?", 'wifi' ) local qh4 = dbQuery( test_db, "SELECT money FROM players WHERE name=?", 'wifi' ) -- نسوي الأمر local result6 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result5 and result6 ) then print ( "Success to select values" ) -- نكتب في الديبق نجاح في تحديد القيم print ( result5, result6 ) -- راح يطبع لنا فلوس واي فاي -- Result : -- 1000 end -- SELECT money FROM players WHERE name=? -- الترجمة : -- تحديد عامود money -- من جدول players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'wifi' شكل التحديد في القاعدة ~> -- > = التحديد -- ? = أين -- == = يطابق { >players = { { ?name=='wifi', >money='1000', health='100' }, { name='BrosS', money='-1000', health='10' }, } } -- توضيح اكثر { >players = { -- نحدد التيبل الي نريده { ?name='wifi', >money='1000', health='100' }, -- ? نحدد القيمة الي نريدها< + الي نبحث عنها { name='BrosS', money='-1000', health='10' }, } } مثال اخر لو نبي نجيب هيلث بروس : local result7 = executeSQLQuery ( "SELECT health FROM players WHERE name=?", 'BrosS' ) local qh5 = dbQuery( test_db, "SELECT health FROM players WHERE name=?", 'BrosS' ) -- نسوي الأمر local result8 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result7 and result8 ) then print ( "Success to select values" ) -- نكتب في الديبق نجاح في تحديد القيم print ( result5, result6 ) -- راح يطبع لنا دم بروس -- Result : -- 10 end -- SELECT money FROM players WHERE name=? -- الترجمة : -- تحديد عامود money -- من جدول players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' الآن لو نبي نعدل على فلوس واي فاي او هلث بروس شلون ؟ بهذه الطريقة . : local result9 = executeSQLQuery ( "UPDATE players SET health='5' WHERE name=?", 'BrosS' ) local qh6 = dbQuery( test_db, "UPDATE players SET health='5' WHERE name=?", 'BrosS' ) -- نسوي الأمر local result10 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result9 and result10 ) then print ( "Success to edit values" ) -- نكتب نجاح في تعديل القيم end -- UPDATE players SET health='5' WHERE name=? -- الترجمة : -- تحديث جدول player -- تحديد عامود health='القيمة الجديدة' -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' النتيجة او الطريقة في القاعدة ~> -- > = التحديد -- ? = أين -- ! = تعديل -- == = يطابق { >players = { { name='wifi', money='1000', health='100' }, { ?name=='BrosS', money='-1000', !health='10' }, } } -- Result : { players = { { name='wifi', money='1000', health='100' }, { name='BrosS', money='-1000', health='5' }, } } ثم بروس صار دمه مره قليل وراح بروس المستشفى وعالجه نصور لكن للأسف مات ونبي نحذفه من الجدول شلون ؟ local result11 = executeSQLQuery ( "DELETE FROM players WHERE name=?", 'BrosS' ) local qh7 = dbQuery( test_db, "DELETE FROM players WHERE name=?", 'BrosS' ) -- نسوي الأمر local result12 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result11 and result12 ) then print ( "Success to delete values" ) -- نكتب نجاح في حذف قيمة end -- DELETE FROM players WHERE name=? -- الترجمة : -- حذف من players -- اين القيمة المطابقة في عامود name -- والقيم : -- ? = 'BrosS' النتيجة او الطريقة في القاعدة ~> -- > = التحديد -- ? = أين -- ! = حذف -- == = يطابق { >players = { { name='wifi', money='1000', health='100' }, !{ ?name=='BrosS', money='-1000', health='5' }, } } -- Result : { players = { { name='wifi', money='1000', health='100' }, } } ثم فجأه واي فاي حزن لأن بروس مات وقال بيستقيل , وصار مافي اي قيمة باقية شلون نحذف الجدول ؟ local result7 = executeSQLQuery ( "DROP TABLE players" ) local qh8 = dbQuery( test_db, "DROP TABLE players" ) -- نسوي الأمر local result8 = dbPoll( qh, -1 ) -- ونطلع النتيجة if ( result7 and result8 ) then print ( "Success to drop table" ) -- نكتب نجاح في حذف الجدول end -- DROP TABLE players -- الترجمة : -- حذف جدول players تنبيه مهم : الترجمة ليست حرفية انما بالمعنى فقط او للتوضيح بنسبة لغة البرمجة المشاركون في المسرحية : @!#NssoR_) @#BrosS @iMr.WiFi..! من فضلكم تصفيق حار من اجلهم .. اعتذر اذا اشركت احدكم وماكان وده يشارك .. او العكس " الشرح مقدم على يد : واي فاي الحكمة من القصة لا تسلب حق غيرك لو كان في ابسط او اصغر الاشياء لأن بيجي شخص بيسلب حقك في اسوء او اكبر الاشياء وفي الختام اتمنى الشرح افادكم ولو قليل وتفهمون ان شاء الله وتقولون الله يرحمك ي بروس ?
  6. So, friend of mine got this error: Picture He was like: dbConnection was in use, this is why it happened, but i was like: thats impossible, so this is why i ask you guys. btw: This is just a question, and i dont need a script-fix for is, just an answer about it.Thx in advance.
  7. Hello, I've downloaded Paradise Roleplay server, and it works, kind of, the server instantly quits because the MySQL module is missing, but it exists under the /mods/deathmatch/modules directory, please help
  8. Hello i have problem with mysql it always says Unable to connect with database. Please contact Developer. well my website works well with the same mysql database it shows many tables but mta something isn't right local connection = nil addEventHandler("onResourceStart",resourceRoot,function(resource) connection = dbConnect("mysql","dbname=s397;host=s1.justhost.lt;port=36517;","s397","j1BUEwHKZ") if connection then outputDebugString(getResourceName(resource) .. " : connected to database.") return true else outputDebugString(getResourceName(resource) .. " : Unable to connect with database. Please contact Developer.") return false end end ) i tried many things changing password going to forums or mta wiki and i couldn't find anything everything would make same thing
  9. Hello, I have spent a couple days learning the ins and outs of installing MySQL, I can tell you where to get the needed files, how to avoid errors, how to set it all up and basically get you started, I do NOT know how to create a database right now, but watched a tutorial or two and it seems easy, if you need links/help then either leave a comment or message me. I am here to help! --I have posted this here as MySQL is a great resource for creating databases and is easy to set up once you know how to do it.--
  10. Hello everyone! I am beginner in all of this. I am a hobby scripter, because I have interest in scripting. BUT I have problem. I want to make a skill system(like you shoot a leg you get 1points for that), and I found a free resource that varies your skill up to 999 in server side and I found another one that do this client side.(also I won't use it like my scripts in a server) OK I have problems with client AND server side too. I can't connect and update the variable. I created a table for the UZI skill (uzi_skill) to try it, but I can't get working. Original source: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11129 This is just the Uzi skill section. The skill is tied to the character-system. (db: character-system -> table: uzi_skill [tinyint(4)] ) function uzi ( attacker, attackerweapon, bodypart, loss ) local statz = getPedStat(attacker, 75) local healthh = getElementHealth(source) local setstat = statz + (100.0 - healthh) * 0.05 local cteam = getPlayerTeam(attacker) local pteam = getPlayerTeam(source) --exports['skill']:changeProtectedElementDataEx(source, "uzi_skill", tonumber(setstat)) <--- I tried with this. Complete FAIL(I know why) if getTeamName(cteam) == getTeamName(pteam) then return false elseif attacker and getElementType(attacker) == "player" and (attackerweapon == 28 or attackerweapon == 32) and (statz < 999) then setPedStat(attacker, 75, setstat) end if (statz > 980) then setPedStat(attacker, 75, 999) end end addEventHandler("onPlayerDamage", getRootElement(), uzi) I want a bit help, just one example how to do this with this. (Please don't ask in fragments. Also I don't know where to put that script fragment). I'd be happy if someone could help me
  11. Hey guys, I get the following error: "payphone\main.lua:23: dbPoll failed; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version and for the right syntax to use near 'WHERE Number = 906366 at line 1" This is the code: local checkNr = dbQuery(handler, "SELECT * FROM PayPhoneOW LIMIT 1 WHERE Number = ".. phonenumber) local result, num_affected_rows, last_insert_id = dbPoll ( checkNr, -1 ) outputChatBox(tostring(num_affected_rows)) Fixed... LIMIT 1 was infront of WHERE... sorry....
  12. Hello! If i remember right i could send more then one sql command. Am i remember right? Can i do it now too? Because as far as i remember i had to set an option in dbQuery and now there is now such an option.
  13. Hello fellows how are you ? Today i want to use database connections Into a simple script that im gonna make about user settings The script is simple a gui opens up and the user selects if he wants to enable disable some graphical settings (car reflection, water, detail, contrast, show fps counter etc blah blah) Script is made and works perfect but i want to save each user settings to database(sqlite for now since i don't want to have remote control of database for now so mysql is not needed) so when he logs on to server the settings he set before will be applied, and also if hes new user server will make a new list in database for that user with default settings (1(enable) for each setting)) anyway i don't need you to tell me how exaclty im gonna code that cause you will get through much work but i want to give me the idea how the hell am i gonna do this because the wiki is helpless in these things if you want some example how bad i am in scripting sql see below: playerSettings = {} function playerJoin() local settingsQuery = dbQuerry(connectionDb,"select * from settings") local settingsQueryResult = dbPoll(settingsQuery, -1) for i, user in pairs(settingsQueryResult) do local playerName = getAccountName(source) table.insert(playerSettings,playerName) end end addEventHandler("onPlayerJoin", resourceRoot, playerJoin) thanks in advance
  14. when i try this code it's never insert datas into database pls help me... ) -- root = getElementRoot() addEventHandler("onPlayerLogin", root, function(_, account) outputChatBox(getPlayerName(source).." Giriş yapti.", root) local oyuncu = getPlayerName(source) local ip = getPlayerIP(source) local serial = getPlayerSerial(source) local username = getAccountName(account) local result = dbPoll( dbQuery( userdata_db, "SELECT * FROM masterdata WHERE username = ?", username ), -1 ) if type(result) ~= 0 then outputChatBox("#afafaf[#f9a52fSA:MP#afafaf] #f9a52fVeritabanina bir veri eklenmedi.",root, 255, 255, 255, true ) else dbQuery( userdata_db, "INSERT INTO masterdata VALUES (?,?,?,?,?)",username,serial,ip, '',oyuncu) end end) Console Log : Username = Asokanta WARNING: mysql/serverside.lua:22: Bad argument @ 'dbQuery' [Expected db-connection at argument 1, got nil] WARNING: mysql/serverside.lua:22: Bad argument @ 'dbPoll' [Expected dbquery at argument 1, got boolean] Username = deneme WARNING: mysql/serverside.lua:22: Bad argument @ 'dbQuery' [Expected db-connection at argument 1, got nil] WARNING: mysql/serverside.lua:22: Bad argument @ 'dbPoll' [Expected dbquery at argument 1, got boolean] I Fixed Here* It's giving only login logs but it still don't insert data in database when result isn't 0 New Console Log : LOGIN: (Everyone, Console) Asokanta successfully logged in as 'Asokanta' LOGIN: (Everyone) Asokanta successfully logged in as 'deneme' Database Screenshot :
  15. addEventHandler("onPlayerLogin", root, function() outputChatBox(getPlayerName(source).." Giriş yapti.", root) local oyuncu = getPlayerName(source) local ip = getPlayerIP(source) local serial = getPlayerSerial(source) local account = getPlayerAccount(source) local username = getAccountName(account) local qh = dbQuery( usedata_db, "SELECT * FROM masterdata WHERE username =?",username ) local result = dbPoll( qh, -1 ) if result == nil then local sorgu = dbQuery( userdata_db, "INSERT INTO `masterdata`(`username`, `serial`, `ip` ,`puan` , `name`) VALUES (?,?,?,'',?)",username,serial,ip,oyuncu) dbFree( sorgu ) else outputChatBox("#afafaf[#f9a52fSA:MP#afafaf] #f9a52fVeritabanina bir veri eklenmedi.",getRootElement(), 255, 255, 255, true ) end end) in here,i'm saying this : if this username don't exist in database insert data else do nothing. But when i try the script it gives nothing everytime like exist or don't exist usernames help pls.
  16. Hello guys, Yesterday I didn't have anything to do so I decided to convert MTA Paradise to SQLite, ( just the sql resource needs to be changed ). The resource has not all the capabilities of the original one like editing already existing columns, but the other features are working OK. Now you won't need any mySQL host or module http://www72.zippyshare.com/v/CeQ6O7FB/file.html
  17. السلام عليكم ورحمة الله وبركاته شباب الحين ابي اعرف طريقة الاتصال بmysql عبر برنامج الفيجوال بيسيك مع العلم اني حملت المكتبه الخاصه بها ويجيلي ايرور
  18. Hello guys,i'm making own login-register system using MySQL but i when i can't check username and password ; local sorgu = dbQuery( userdata_db, "SELECT * FROM `database` WHERE `USERNAME`=? AND `PASSWORD`=?",username,password ) local result = dbPoll ( sorgu, -1 ) if result == 1 then I'm using this code for select data it but i can't get result for check (there is no console logs it's failing when i try the command)
  19. Hi clients, ProSystemsHz comes with a big surprise, starting today we already have databases with phpmyadmin for your servers, if you want to database you just have to contact us through our customer area in the section "support". This also brings a downside, today prices rise from 7 cents per slot to 10 cents per slot, so do continue to maintain and offer them better quality in their services. ProSystemsHz, Your hosting solution. www.ProSystemsHz.com
  20. DarkxD

    SaveAccount

    Hallo, please help me!
  21. Alright, I've got the following JSON saved in my mysql: [ [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ], [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] , [ { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 }, { "lastPlayed": 0, "experience": 0, "money": 20 } ] ] It are 6 elements inside 3 elements. Each of these 3 elements holds 6x the { "lastPlayed": 0, "experience": 0, "money": 20 }. Whenever I'm using fromJSON, it's returning the wrong information when I'm trying to access the first element out of the second collection. The code I'm using is as following: local saveData = fromJSON ( data [ 1 ].saves ); outputChatBox ( #saveData ); -- returns 6 elements (incorrect) outputChatBox ( #saveData [ 2 ] ); -- returns 3 properties (correct) outputChatBox ( tostring ( saveData [ 2 ] [ 1 ] ) ); -- returns nil The JSON is valid, I can use it in different languages too and every parser says it's correct. I'm starting to think that fromJSON is returning just the first collection instead of all 3. Has anyone encountered this problem? I'm not really a fan of putting it all into 1 collection, it's preventing me from adding more and more data later on.
  22. День добрый,столкнулся с такой проблемкой: Выполняю запрос на получение данных из БД function authUserDB(userName, userPassword, thePlayer) dbExec( bd,"SELECT `password` FROM Players WHERE nick='??'",userName) local Players = dbPoll(dbQuery(bd, "SELECT * FROM `Players`"), -1) for Index, PlayerData in ipairs(Players) do if userName == userName and userPassword == PlayerData.password then if (client) then spawnPlayer(client, 1721.7834, -1927.0063, 13.5672) setPlayerSkin(client,0) fadeCamera(client, true) setCameraTarget(client, client) triggerClientEvent(getRootElement(),"hideLogin",client) dbExec( bd,"SELECT `id` FROM Players WHERE nick='??'",client) local Players = dbPoll(dbQuery(bd, "SELECT * FROM `Players`"), -1) for Index, PlayerData in ipairs(Players) do setElementData ( source, "ID", PlayerData.id ) outputChatBox("С возвращением на на ****** RP, "..userName.."! Ваш ID "..PlayerData.id..".", client) end end else outputChatBox("Неправильные логин и пароль. Пожалуйста, переподсоединитесь и попробуйте еще раз.",client) end end end addEvent("submitLogin",true) addEventHandler("submitLogin",root,authUserDB) Дело в том,что ответ приходит несколько раз,и количество повторов зависит от количества записей в БД. Подскажите пожалуйста где я накосячил)
  23. Hey everyone, I'm wondering about the best way to store toptimes in a database. The toptimes resource that comes with MTA creates a new table for each map, containing the toptimes. This seems to be an easy solution but it doesnt feel right to dynamically create a table like that. Does anyone have a alternative design how to do it? My concern is that looking up toptimes might take too long when they are all stored in one table. I have about 8000 maps. When each has 100 toptimes average at some point, you end up with 800.000 entries. Bonsai
  24. Hola, no sé si ésto irá acá pero lo pondré puesto a que no encontré otra sección para el mismo. Bueno, les cuento. Recién me enteré del Paradise R.P. por lo que traté hacerlo (ya que era con MySQL). Lo descargué, configuré y empezó todo bien pero el problema estuvo al momento de entrar ya que se quedó todo en negro y me banneó automáticamente por supuesto hack (cuyo mismo no tengo) de gravedad. Estuve leyendo y encontré que a un usuario de ésta misma comunidad le pasó una cosa parecida cuya misma solventó entrando a su base de datos, yendo a la tabla "wcf1_user", buscando su usuario y poniendo ceros. Entonces yo traté de solventarlo de la misma forma pero, para mi sorpresa, no está la dichosa tabla "wcf1_user". No sé qué hacer ya que es ban de serial y no me puedo desbannear. Ayuda, por favor. Así es como me aparece: No sé si les servirá de algo o no, pero éste es el link del post del usuario que tuvo el problema similar: Saludos y gracias de antemano.
  25. Hey there, I'm working on a roleplay project to update some older scripts, however, I can not get the mysql to work. The mysql resource is connect to the database, but doesn't work with it. It gives no error messages besides this one, when trying to login: *ERROR: account-system/s_login.lua:44: attempt to concatenate local 's afepassword' (a nil value)* The resources has worked before with the database, just to confirm that. I'm running a 32bit linux server with the modules from https://linux.multitheftauto.com/
×
×
  • Create New...