Simple. Posted July 12, 2015 Share Posted July 12, 2015 آلسلآم عليكم ورح الله وبركاته كيف آلحال عسآكم بخير انا عندي مشكلة في حفظ لشات انا مسوي لوحه فيها لوق وزي كذا لكن لما يكتب مضبوط لكن ماتنحفظ بالجدول مادري ليه وهذي اكوادي addEventHandler ("onResourceStart", resourceRoot, function () local CreateNewTable = executeSQLQuery ("CREATE TABLE IF NOT EXISTS chatlog (chat)") if ( CreateNewTable ) then --outputDebugString ("Create [ Black List Table ] Table done .") local Results = executeSQLQuery("SELECT * FROM chatlog WHERE chat=?",tostring (timeT) ) triggerClientEvent ( source, "setLogText", source, unpack(Results) ) end end ) addEventHandler('onPlayerChat',root, function ( message, messageType ) if messageType == 0 then local time = getRealTime() local hours = time.hour local minutes = time.minute local days = time.monthday local months = time.month local years = time.year local isdsts = time.timestamp local timeT = " [ "..days.." / "..months.." / "..years.." "..hours..":"..minutes.." ] "..getPlayerName ( source).." : " .. message local Results = executeSQLQuery("SELECT * FROM chatlog WHERE chat=?",tostring (timeT) ) executeSQLQuery( "INSERT INTO chatlog (chat) VALUES (?)", tostring (timeT)) triggerClientEvent ( source, "setLogText", source, timeT ) end end ) وبآلديبوق مآيطلع لي شيء ! لما اكتب بالشات يجي لكن لو اسوي ريستارت للمود او اطلع وادخل مايجي شيء كاني ماسويت قاعدة ولآ شيء Link to comment
3NAD Posted July 12, 2015 Share Posted July 12, 2015 -- Client Side addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ( "onGetChatLog", localPlayer ) end ) -- Server Side executeSQLQuery ("CREATE TABLE IF NOT EXISTS chatlog (chat)") addEventHandler('onPlayerChat',root, function ( message, messageType ) if messageType == 0 then local time = getRealTime() local hours = time.hour local minutes = time.minute local days = time.monthday local months = time.month local years = time.year local isdsts = time.timestamp local timeT = " [ "..days.." / "..months.." / "..years.." "..hours..":"..minutes.." ] "..getPlayerName ( source).." : " .. message executeSQLQuery( "INSERT INTO chatlog (chat) VALUES (?)", tostring (timeT)) triggerClientEvent ( source, "setLogText", resourceRoot, timeT ) end end ) addEvent ( "onGetChatLog", true ) addEventHandler ( "onGetChatLog", root, function ( ) local Results = executeSQLQuery ( "SELECT * FROM chatlog" ) for i, v in ipairs ( Results ) do triggerClientEvent ( source, "setLogText", resourceRoot, tostring(v.chat) ) end end ) فـ ما ادري صح ولا لا executeSQLQuery ملاحظة من زمان عن Link to comment
Simple. Posted July 12, 2015 Author Share Posted July 12, 2015 يععطيك آلعافيه مآقصرت , بسس ممكن تقول لي وين كانت المشكله ؟ + كيف لو آبي آفضي آلجدول كله وش آسوي ؟ Link to comment
#DRAGON!FIRE Posted July 12, 2015 Share Posted July 12, 2015 (edited) -- Edited July 12, 2015 by Guest Link to comment
Simple. Posted July 12, 2015 Author Share Posted July 12, 2015 انا جربته شغال بخصوص المسج الجديد والقديم مسويه بالكلنت addEvent ( "setLogText", true ) addEventHandler ( "setLogText", getRootElement (), function ( msg ) local log = guiGetText ( cMemo ) guiSetText ( cMemo,log..""..msg ) end) مادري فيه مشكله او لا مع إنه شغال تمام ! Link to comment
Simple. Posted July 12, 2015 Author Share Posted July 12, 2015 يعطيكم آلعافيه بس ممكن تقولون لي كيف آفضي آلجدول ؟ يعني بسوي تايمر كل اسبوع يفضي الجدول ويمسح الكلام بس ابي كيف امسح الي بالجدول آلبآقي كله سهل ! Link to comment
3NAD Posted July 12, 2015 Share Posted July 12, 2015 يععطيك آلعافيه مآقصرت ,بسس ممكن تقول لي وين كانت المشكله ؟ + كيف لو آبي آفضي آلجدول كله وش آسوي ؟ في ايفنت تشغيل المود source مقارنة ب كودك راح تلاحظ انك مستخدم addEventHandler ("onResourceStart", resourceRoot, function () local CreateNewTable = executeSQLQuery ("CREATE TABLE IF NOT EXISTS chatlog (chat)") if ( CreateNewTable ) then --outputDebugString ("Create [ Black List Table ] Table done .") local Results = executeSQLQuery("SELECT * FROM chatlog WHERE chat=?",tostring (timeT) ) triggerClientEvent ( source, "setLogText", source, unpack(Results) ) end end ) ولو شيكنا على صفحة الإيفنت في الويكي هو الروت حق المود وليس اللاعب نفسه اللي شغل المود source يقول ان الـ فـ أنا نقلت الإيفنت "عند تشغيل المود" إلى كلنت addEventHandler ( "onClientResourceStart", resourceRoot, function ( ) triggerServerEvent ( "onGetChatLog", localPlayer ) end ) ومن الكلنت ينقل للسيرفر عشان يجيب الرسايل -- طبعاً شلت هذا السطر من الإيفنت وحطيته برا executeSQLQuery ("CREATE TABLE IF NOT EXISTS chatlog (chat)") لأنه نفس الشيء سواءً بالإيفنت او بدونه . -- بخصوص سؤالك الثاني جرب كذا addCommandHandler ( "clearChatLog", function ( player ) if getPlayerSerial ( player ) == "Your Serial" then executeSQLQuery ( "DROP TABLE chatlog" ) setTimer ( executeSQLQuery, 100, 1, "CREATE TABLE IF NOT EXISTS chatlog (chat)" ) end end ) وحط سيريالك 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