.Doctor Posted February 2, 2019 Share Posted February 2, 2019 (edited) Hello friends can you help me? this save data script "Mysql" is working ... but it is using the module mta_mysql.dll and this module does not work in 64bit could someone solve and instead of "MysqlModule" change the commands to "dbConnect" ?? thank you database = mysql_connect( "127.0.0.1", "root", "", "db_just" ) if database then outputDebugString ('Connect') else outputDebugString ("Trouble") end function saveAccounts () -- Save in the database local serial = getPlayerSerial ( source ) local x,y,z = getElementPosition( source ) local i = getElementInterior( source ) local d = getElementDimension( source ) local skin = getPedSkin ( source ) local money = getPlayerMoney ( source ) local health = getElementHealth ( source ) local armor = getPedArmor ( source ) local wanted = getPlayerWantedLevel ( source ) local q = mysql_query(database,"SELECT * FROM `accounts` WHERE `serial` = '".. serial .."'") if(mysql_num_rows(q) == 0) then mysql_query( database, "INSERT INTO accounts ( `serial` , x, y, z, intterior, demension, skin, money, health, armor, wanted ) VALUES ( '" .. serial .. "', " .. x .. ", " .. y .. ", " .. z .. "," .. i .. ", " .. d .. "," .. skin .. "," .. money .. ", ".. health ..", ".. armor ..", " .. wanted .. " )" ) else res = mysql_query ( database, "UPDATE `accounts` SET x = ".. x ..", y = ".. y ..", z = ".. z ..", intterior = ".. i ..", demension = ".. d ..", skin = ".. skin ..", money = ".. money ..", health = ".. health ..", armor = ".. armor ..", wanted = ".. wanted .." WHERE `serial` = '"..serial.."'") end end function loadAccounts () local serial = getPlayerSerial ( source ) local result = mysql_query ( database ,"SELECT * FROM `accounts` WHERE `serial` = '"..serial.."'") if result then while true do local row = mysql_fetch_assoc(result) if not row then break end setElementPosition ( source, row.x, row.y, row.z) setElementInterior ( source, row.intterior ) setElementDimension ( source, row.demension ) setPedSkin ( source, row.skin ) setPlayerMoney ( source, row.money ) setElementHealth ( source, row.health) setPedArmor ( source, row.armor ) setPlayerWantedLevel ( source, row.wanted ) break end end end addEventHandler ( "onPlayerJoin", getRootElement(), loadAccounts ) addEventHandler ( "onPlayerQuit", getRootElement(), saveAccounts ) Edited February 2, 2019 by xDoctor Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now