MR.GRAND Posted May 11, 2016 Posted May 11, 2016 (edited) local mainConnection = dbConnect( 'sqlite', 'SQL.db' ) dbQuery( mainConnection, 'CREATE TABLE IF NOT EXISTS savePOStest4 (playerSerial, xPos, yPos, zPos)' ) outputChatBox( 'seccessfully Connect and Make table') addCommandHandler( 'setPOS', function(source) -- لما اسوي الكوماند ويتحقق يجي update table في كل مرة حتى لو ماكان في result1 local x, y, z = getElementPosition(source) local checkResult = dbQuery( mainConnection,' SELECT * FROM savePOStest4 WHERE playerSerial=?', getPlayerSerial(source) ) local result1 = dbPoll(checkResult, -1) if (result1 == nil) then dbExec( mainConnection, "INSERT INTO savePOStest4 VALUES(?, ?, ?, ?)", getPlayerSerial(source), x, y, z ) outputChatBox( 'seccessfully add Info') else dbExec( mainConnection, "UPDATE savePOStest4 SET playerSerial=?, xPos=?, yPos=?, zPos=?", getPlayerSerial(source), x, y, z ) outputChatBox( 'seccessfully update Info') end end ) addEventHandler( 'onPlayerSpawn', root, function() local x = dbQuery(mainConnection, "SELECT xPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local y = dbQuery(mainConnection, "SELECT yPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local z = dbQuery(mainConnection, "SELECT zPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local result1 = dbPoll(x, -1) local result2 = dbPoll(y, -1) local result3 = dbPoll(z, -1) local x_ = result1[1]["xPos"] local y_ = result2[1]["yPos"] local z_ = result3[1]["zPos"] setElementPosition( source, x_, y_, z_ ) outputChatBox( x_ ..', ' ..y_ .. ', ' ..z_ ) end ) Edited May 11, 2016 by Guest
MR.GRAND Posted May 11, 2016 Author Posted May 11, 2016 # خلاص حليت المشكلة بنفسي # رجاءا اغلاق من الأدمن وشكرا ^.^
MR.GRAND Posted May 11, 2016 Author Posted May 11, 2016 local mainConnection = dbConnect( 'sqlite', 'SQL.db' ) dbQuery( mainConnection, 'CREATE TABLE IF NOT EXISTS savePOStest4 (playerSerial, xPos, yPos, zPos)' ) outputChatBox( 'seccessfully Connect and Make table') addCommandHandler( 'setPOS', function(source) local x, y, z = getElementPosition(source) local checkResult = dbQuery( mainConnection,' SELECT * FROM savePOStest4 WHERE playerSerial=?', getPlayerSerial(source) ) local result1 = dbPoll(checkResult, -1) if (type(result1) == "table" and #result1~= 0) then dbExec( mainConnection, "UPDATE savePOStest4 SET playerSerial=?, xPos=?, yPos=?, zPos=?", getPlayerSerial(source), x, y, z ) outputChatBox( 'seccessfully update Info') else dbExec( mainConnection, "INSERT INTO savePOStest4 VALUES(?, ?, ?, ?)", getPlayerSerial(source), x, y, z ) outputChatBox( 'seccessfully add Info') end end ) addEventHandler( 'onPlayerJoin', root, function() local x = dbQuery(mainConnection, "SELECT xPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local y = dbQuery(mainConnection, "SELECT yPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local z = dbQuery(mainConnection, "SELECT zPos FROM savePOStest4 WHERE playerSerial = ?", getPlayerSerial(source)) local result1 = dbPoll(x, -1) local result2 = dbPoll(y, -1) local result3 = dbPoll(z, -1) local x_ = result1[1]["xPos"] local y_ = result2[1]["yPos"] local z_ = result3[1]["zPos"] setElementPosition( source, x_, y_, z_ ) outputChatBox( x_ ..', ' ..y_ .. ', ' ..z_ ) end ) لما اسوي ريستارت للسكربت ما الاقي الجدول والقيم تنحذف أحد عنده خبرة بهذي المسئلة .!؟
MR.GRAND Posted May 11, 2016 Author Posted May 11, 2016 وكالعادة عرفت احل المشكلة المشكلة الكبرى اني اكتب رد هنا واروح اجرب واضبط الوضع
MR.GRAND Posted May 11, 2016 Author Posted May 11, 2016 local RentDataBase = dbConnect("mysql", "dbname=" .. 'sql6119060' .. ";host=" .. 'sql6.freemysqlhosting.net', 'sql6119060', 'd9ScRNHhPA') dbQuery( RentDataBase, ' CREATE TABLE IF NOT EXISTS `sql6119060` (userSerial,userName,expiredIN) ' ) هذا الكود بالسيرفر المحلي 100 % على سيرفر استضافة يجي بالديبوق ~~ dbConnect failed ... could not connect مع العلم إني حاط المود بالأدمن وله صلاحية الأتصال وكل شيء .!
ععيونككء اخخر امممأليء ^ Posted May 11, 2016 Posted May 11, 2016 ههههههههههههههههه جراند تسئل حالك وتجاوب حالكك ض2
MR.GRAND Posted May 11, 2016 Author Posted May 11, 2016 ههههههههههههههههه جراند تسئل حالك وتجاوب حالكك ض2 بس أخر كود ذذ وقف في وجهي موراضي يتصلح عجييب مع انه بالسيرفر المحلي جربت امه شغال مليون بالميهةء
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