#Rmad~> Posted May 15, 2014 Share Posted May 15, 2014 (edited) السلام عليكم عندي كود فيه خطأ وماعرفت اصلحه وبنفس الوقت ابغا اضيف عليه شي ماعرفت له الكود الي سويته يعطي الاعب فلوس اول مايسجل دخول ويحفظ الاعب بالسيريال حقه انا الي ابغا اسويه انه كل مايخش يجيه فلوس بس يكون يومي يعني اليوم مثلا الاربعاء خشيت وجاتني الفلوس الخميس اليوم الي بعده اخش حسابي يجيني فلوس وابيه يتاكد من السيريال بحيث انه حسابين لكل سريال addEventHandler('onResourceStart',resourceRoot, function ( ) local Sql = executeSQLQuery ('CREATE TABLE IF NOT EXISTS `Money` ( PlayerSerial) ') if ( Sql ) then outputDebugString('*Create [ Money ] Table done*') end end ) addEventHandler('onPlayerLogin',root, function ( ) local Result = executeSQLQuery("SELECT * FROM `Money` WHERE PlayerSerial =?",getPlayerSerial(source) ) if( Result )and( type( Result ) == 'table' )and( #Result > 0 )then return end oney = math.random(100000,1000000) givePlayerMoney(source, oney) executeSQLQuery ("INSERT INTO `Money`(PlayerSerial)VALUES(?)",getPlayerSerial(source)) outputChatBox("#808080 *Congratulations You Have A Good Luke You took today "..oney.."*",source,255, 255, 255,true) end ) addEventHandler('onPlayerQuit',root, function ( ) local Results = executeSQLQuery("SELECT * FROM `Money` WHERE PlayerSerial=?",getPlayerSerial(source)) if ( type ( Results ) == "table" and #Results == 0 or not Results ) then executeSQLQuery ( "INSERT INTO `Money` ( PlayerSerial) VALUES(?)",getPlayerSerial(source)) else executeSQLQuery("UPDATE `Money` SET PlayerSerial = ?,WHERE name=?",getPlayerSerial(source)) end end ) الاخطأ الي واجهتني Database query failed:table Money hs ni column named PlayerSerial Database query failed:no such column PlayerSerial Edited May 15, 2014 by Guest Link to comment
3NAD Posted May 16, 2014 Share Posted May 16, 2014 executeSQLQuery ( "CREATE TABLE IF NOT EXISTS `GiveMoneyEveryDay` ( `PlayerSerial` TEXT, `Account` TEXT, `Date` TEXT ) ") addEventHandler ( "onPlayerLogin", root, function ( _, acc ) local serial = getPlayerSerial ( source ) local Result = executeSQLQuery ( "SELECT * FROM `GiveMoneyEveryDay` WHERE `PlayerSerial` =?", serial ) local day = getRealTime().monthday local oney = math.random ( 100000, 1000000 ) local accName = getAccountName ( acc ) if #Result > 0 then if #Result == 2 then for i, v in ipairs ( Result ) do if v.Account == accName then if v.Date ~= tostring ( day ) then givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "UPDATE `GiveMoneyEveryDay` SET `Date`=? WHERE `PlayerSerial`=? AND `Account`=?", tostring(day), serial, accName ) return end end end else if Result[1].Account == accName then if Result[1].Date ~= tostring ( day ) then givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "UPDATE `GiveMoneyEveryDay` SET `Date`=? WHERE `PlayerSerial`=? AND `Account`=?", tostring(day), serial, accName ) end else givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "INSERT INTO `GiveMoneyEveryDay` ( `PlayerSerial`, `Account`, `Date` ) VALUES(?,?,?)", serial, accName, tostring(day) ) end end else givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "INSERT INTO `GiveMoneyEveryDay` ( `PlayerSerial`, `Account`, `Date` ) VALUES(?,?,?)", serial, accName, tostring(day) ) end end ) Link to comment
#Rmad~> Posted May 16, 2014 Author Share Posted May 16, 2014 executeSQLQuery ( "CREATE TABLE IF NOT EXISTS `GiveMoneyEveryDay` ( `PlayerSerial` TEXT, `Account` TEXT, `Date` TEXT ) ") addEventHandler ( "onPlayerLogin", root, function ( _, acc ) local serial = getPlayerSerial ( source ) local Result = executeSQLQuery ( "SELECT * FROM `GiveMoneyEveryDay` WHERE `PlayerSerial` =?", serial ) local day = getRealTime().monthday local oney = math.random ( 100000, 1000000 ) local accName = getAccountName ( acc ) if #Result > 0 then if #Result == 2 then for i, v in ipairs ( Result ) do if v.Account == accName then if v.Date ~= tostring ( day ) then givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "UPDATE `GiveMoneyEveryDay` SET `Date`=? WHERE `PlayerSerial`=? AND `Account`=?", tostring(day), serial, accName ) return end end end else if Result[1].Account == accName then if Result[1].Date ~= tostring ( day ) then givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "UPDATE `GiveMoneyEveryDay` SET `Date`=? WHERE `PlayerSerial`=? AND `Account`=?", tostring(day), serial, accName ) end else givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "INSERT INTO `GiveMoneyEveryDay` ( `PlayerSerial`, `Account`, `Date` ) VALUES(?,?,?)", serial, accName, tostring(day) ) end end else givePlayerMoney ( source, oney ) outputChatBox ( "#808080 *Congratulations You Have A Good Luke You took today "..oney.."*", source, 255, 255, 255, true ) executeSQLQuery ( "INSERT INTO `GiveMoneyEveryDay` ( `PlayerSerial`, `Account`, `Date` ) VALUES(?,?,?)", serial, accName, tostring(day) ) end end ) يعطيك العافية سويتها بالدااتا وظبطت وهاذي كمان ظبطت يغلق , Link to comment
Recommended Posts