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. So, first of all greetings. These days, i was trying to make a script that would allow you to create custom blips and save them to a database. The creation and saving (in the DB) part went well, but i am having problems when trying to load them back into the game. Here's part of the code that handles that: function loadOneBlip( ) local result = mysql:query_fetch_assoc("SELECT x AS x1, y AS y1, z AS z1, icon AS icons, size AS sizes FROM `blip`") --loading the data from the DB if result then while true do local row = mysql:fetch_assoc(result) --make it so i can select the data from a string if not row then break end --if there is no result end the operation local blip = createBlip( row.x1 , row.y1 , row.z1 , row.icons , row.sizes, 255, 0, 0, 0, 0, visibleDistance) --creating the actual blip outputChatBox("loading one blip (#"..blips..")", thePlayer, 255,255,255) --count them ingame to see if it loads completely blips = blips + 1 end mysql:free_result(result) else outputDebugString("blip failed",1) --something went wrong end end addCommandHandler("loadblip",loadOneBlip,false,false) addEventHandler("onResourceStart",root, loadOneBlip) And for more thoughts, yes, the connection to the DB is running good. The script is made serverside. And i also think i did something very wrong here, that being in when i execute the command, neither the blip gets created nor the error message display.
  2. Hello! I'm creating a character selector using MySQL and I have some troubles. I use this to get the account players: local accData = singleQuery("SELECT * FROM players WHERE account=? LIMIT 3",string.lower(account)) for i=3,1,-1 do if(accData.username) then outputChatBox(accData.username,source,255,0,0, true) -- used to check results end end I'm using simple MySQL functions, these is the singleQuery function: function singleQuery(str,...) if (connection) then local query = dbQuery(connection,str,...) local result = dbPoll(query,-1) if (type(result == "table")) then return result[1] else return result end else return false end end It's normal that these function returns only one result. What I want is to list all of the results. If I have 4, i want to do a for loop with the 4 results. Anyone knows how I can modify this function to make another one called, for example, multipleQuery(str,..)? I don't know if it's possible to do something like "accData[1]" for character 1, "accData[2]" for character 2, etc.. Thanks!
  3. 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?
  4. 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
  5. 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)
  6. 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!
  7. 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.
  8. 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
  9. 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
  10. 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.--
  11. 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
  12. 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....
  13. 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.
  14. 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
  15. السلام عليكم ورحمة الله وبركاته شباب الحين ابي اعرف طريقة الاتصال بmysql عبر برنامج الفيجوال بيسيك مع العلم اني حملت المكتبه الخاصه بها ويجيلي ايرور
  16. 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 :
  17. 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.
  18. 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
  19. 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)
  20. ProSystemsHz.com - Calidad, Seguridad & Economia en tus Servidores Quienes somos? http://www.ProSystemsHz.com es una Empresa dedicada exclusivamente al alojamiento de servidores SA:MP, MTA, CS:GS, Minecraft y VPS Linux/Windows Contamos con personal experto, soporte tecnico amigable disponible la mayor parte del dia Proteccion DDoS, 99.9% de tiempo en linea garantizado, Panel de control profesional propio Ofrecemos un exelente servicio a un precio economico, puedes comprar los slots que necesites cada slot a tan solo 8 centavos Algunos de Nuestros Beneficios Proteccion DDoS Juega sin interrupciones con la mejor proteccion DDoS, así tu servidor estara protegido contra envidiosos Espacio ilimitado No te preocupes por el tamaño de tus archivos, te brindamos espacio ilimitado en cualquier plan de Game Hosting Activacion instantanea No esperes para tener tu servidor activado, pides y en segundos tienes los datos necesarios para montar tu servidor y no te cobramos gastos de instalacion Backups Gratis Los Problemas pueden pasar en cualquier rato, ProSystemsHz esta preparado para cualquier problema con su archivos respaldados con Amazon. Soporte tecnico Si tienes problemas con tu servidor te ayudaremos con gusto, somo expertos y nos apaciona lo que hacemos, puedes contactarnos via sms/email/tickets Servidores Potentes Contamos con servidores capacitados y potentes para ofrecerte un buen servicio al cliente y dar una experiencia muy buena METODOS DE PAGO: Mensajes de texto (SMS), PayPal, Western Union, Y muy Pronto MercadoPago. Pagina web: http://www.ProSystemsHz.com Pagina en facebook: https://www.facebook.com/ProSystemsHz Email: [email protected] Tambien ofrecemos chat en vivo desde la pagina web
  21. DarkxD

    SaveAccount

    Hallo, please help me!
  22. 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
  23. 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.
  24. День добрый,столкнулся с такой проблемкой: Выполняю запрос на получение данных из БД 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) Дело в том,что ответ приходит несколько раз,и количество повторов зависит от количества записей в БД. Подскажите пожалуйста где я накосячил)
  25. 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
×
×
  • Create New...