SaedAmer Posted July 31, 2017 Share Posted July 31, 2017 (edited) السلام عليكم الاول انا مسوي مود تاج بس ابيه لما اختار الاعب من الجريد لست و اكتب التاج و الون و اضغط البوطن يتفعل عند العب مب عندي انا ------------------ ايه الخطأ هنا ما يبي يحفظ executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,tag ) " ) Edited July 31, 2017 by SaedAmer Link to comment
Adham Posted July 31, 2017 Share Posted July 31, 2017 26 minutes ago, SaedAmer said: السلام عليكم الاول انا مسوي مود تاج بس ابيه لما اختار الاعب من الجريد لست و اكتب التاج و الون و اضغط البوطن يتفعل عند العب مب عندي انا ------------------ ايه الخطأ هنا ما يبي يحفظ executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,tag ) " ) الكود ذا انشاء قاعده مب حفظ Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 37 minutes ago, Deativated said: الكود ذا انشاء قاعده مب حفظ عطني فكشانات الحفظ Link to comment
' A F . Posted August 1, 2017 Share Posted August 1, 2017 executeSQLQuery -- INSERT خش على صفحة الويكي وتعرف Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 20 minutes ago, Default said: executeSQLQuery -- INSERT خش على صفحة الويكي وتعرف مظبوط؟ addEventHandler("onPlayerChat",root,function (msg,Colour) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, r, g, b, true) return cancelEvent() end) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) Link to comment
Rockyz Posted August 1, 2017 Share Posted August 1, 2017 3 hours ago, SaedAmer said: مظبوط؟ addEventHandler("onPlayerChat",root,function (msg,Colour) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, r, g, b, true) return cancelEvent() end) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) عطنا لما تضيف واحد للقاعدة انت هنا بس عطيتنا جزء Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 7 hours ago, #,+( _xiRoc[K]; > said: عطنا لما تضيف واحد للقاعدة انت هنا بس عطيتنا جزء مش فاهمك والله Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 (edited) addEventHandler("onPlayerChat",root,function (msg) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) return cancelEvent() end) Edited August 1, 2017 by Mhmd.z Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 46 minutes ago, Mhmd.z said: addEventHandler("onPlayerChat",root,function (msg) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) return cancelEvent() end) نفس الكلام مفيش حاجة بتتحفظ Link to comment
` Allawi Posted August 1, 2017 Share Posted August 1, 2017 وعليكم السلام ورحمة الله وبركاته اولا تقوم بإنشاء القاعدة عند تشغيل السكربت ثانيا تقوم بالحفظ في القاعدة عند الضغط على الزر ثالثا تقوم بإستخراج القيم عند الكتابة في الشات وعن طريق -- executeSQLQuery -- SELECT Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 48 minutes ago, ` Allawi said: وعليكم السلام ورحمة الله وبركاته اولا تقوم بإنشاء القاعدة عند تشغيل السكربت ثانيا تقوم بالحفظ في القاعدة عند الضغط على الزر ثالثا تقوم بإستخراج القيم عند الكتابة في الشات وعن طريق -- executeSQLQuery -- SELECT ناقص ايه ؟ executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour ) " ) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) executeSQLQuery("DELETE FROM `DataPlayers` WHERE name=?", Player,Serial,tag,colour) Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 (edited) executeSQLQuery("SELECT tag FROM DataPlayers WHERE Serial=?", getPlayerSerial(source) ) ذا مثال لاستخراج تاج الاعب من سيرياله Edited August 1, 2017 by Mhmd.z Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 19 minutes ago, Mhmd.z said: executeSQLQuery("SELECT tag FROM DataPlayers WHERE Serial=?", getPlayerSerial(source) ) ذا مثال لاستخراج تاج الاعب من سيرياله و بعد ايه ناقص ؟ كيف بيكون تريتيب اكواد الحفظ ؟ Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 Just now, SaedAmer said: و بعد ايه ناقص ؟ كيف بيكون تريتيب اكواد الحفظ ؟ كذه تكون حفظته للقاعدة INSERT انت اول ما تسوي SELECT الحين مشان تجيب الشي يلي حفظته لازم تستخدم مثلا: addCommandHandler("get", function (player) local tag = executeSQLQuery("SELECT tag FROM DataPlayers WHERE Serial=?", getPlayerSerial(player) ) if tag ~= 0 then outputChatBox("Your tag is: "..tag, player) else outputChatBox("You havn't a tag", player) end end ) Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 (edited) تمام كده؟ ذا الانشاء و الحفظ و الاسترجاء و الحذف كلنت ----- addEventHandler("onClientGUIClick",root,function() if(source == GUIEditor.button[2]) then if guiGetText (GUIEditor.edit[1]) ~= '' then setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1])) setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2])) end elseif(source == GUIEditor.button[1]) then setElementData (localPlayer,'tag',false) setElementData (localPlayer,'colour',false) end end) -------- سيرفر executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour ) " ) addEventHandler("onPlayerChat",root,function (msg) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) return cancelEvent() end) addCommandHandler("get", function (player) local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(player) ) if tag ~= 0 then outputChatBox("Your tag is: "..tag, player) else outputChatBox("You havn't a tag", player) end end ) Edited August 1, 2017 by SaedAmer Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 3 minutes ago, SaedAmer said: تمام كده؟ ذا الانشاء و الحفظ و الاسترجاء و الحذف كلنت ----- addEventHandler("onClientGUIClick",root,function() if(source == GUIEditor.button[2]) then if guiGetText (GUIEditor.edit[1]) ~= '' then setElementData (localPlayer,'tag',guiGetText (GUIEditor.edit[1])) setElementData (localPlayer,'colour',guiGetText (GUIEditor.edit[2])) end elseif(source == GUIEditor.button[1]) then setElementData (localPlayer,'tag',false) setElementData (localPlayer,'colour',false) end end) -------- سيرفر executeSQLQuery( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour ) " ) addEventHandler("onPlayerChat",root,function (msg) local tag = getElementData(source,"tag") or 'player' local colour = getElementData(source,"colour") or '#FFFFFF' outputChatBox("#FF0000 # #FFFFFF[ #CD0000"..tag .."#FFFFFF ]x #A5A5A5".. getPlayerName(source) .. ""..colour.." : ".. msg.."",root, 255, 255, 255, true) executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) return cancelEvent() end) addCommandHandler("get", function (player) local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(player) ) if tag ~= 0 then outputChatBox("Your tag is: "..tag, player) else outputChatBox("You havn't a tag", player) end end ) اتوقع انه مافي اخطاء جربه ... Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 2 minutes ago, Mhmd.z said: اتوقع انه مافي اخطاء جربه ... نفس الكلام احط تاج اجي اخرج و ادخل تاني يروح Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 addEventHandler("onPlayerLogin", root, function () local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) if tag ~= 0 then outputChatBox("Your tag is: "..tag, player) setElementData(source, "tag", tag) setElementData(source, "colour", colour) end end ) ضيف ذا الحدث تحت اكوادك Link to comment
` Allawi Posted August 1, 2017 Share Posted August 1, 2017 شوف ردي في هذا الموضوع ممكن تستفيد منه Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 (edited) 11 minutes ago, Mhmd.z said: addEventHandler("onPlayerLogin", root, function () local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) if tag ~= 0 then outputChatBox("Your tag is: "..tag, player) setElementData(source, "tag", tag) setElementData(source, "colour", colour) end end ) ضيف ذا الحدث تحت اكوادك Edited August 1, 2017 by SaedAmer Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 (edited) 28 minutes ago, ` Allawi said: شوف ردي في هذا الموضوع ممكن تستفيد منه بالنسبة لك الكود هيك يعني تقصد ؟ addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS `DataPlayers` ( Player,Serial,tag,colour )" ) end ) addEventHandler("onPlayerLogin", root, function ( _, PlayerSeria ) local tag = executeSQLQuery("SELECT tag FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) local colour = executeSQLQuery("SELECT colour FROM `DataPlayers` WHERE Serial=?", getPlayerSerial(source) ) if ( tag ~= 0 ) then setElementData(source, "tag", tag) setElementData(source, "colour", colour) end end ) addEventHandler ( "onPlayerQuit", root, function ( ) local PlayerSerial = getPlayerSerial(source) if ( PlayerSeria ) and not isGuestAccount ( PlayerSeria ) then local PlayerSeria = getPlayerSerial(source) local tag = executeSQLQuery ( "SELECT tag FROM `DataPlayers` WHERE Serial =?", getPlayerSerial(source) ) local colour = executeSQLQuery ( "SELECT tag FROM `DataPlayers` WHERE Serial =?", getPlayerSerial(source) ) if ( tag == 0 ) then executeSQLQuery( ' INSERT INTO `DataPlayers` (Player,Serial,tag,colour) VALUES(?,?,?,?) ', getPlayerName(source), getPlayerSerial(source), tag, colour) else executeSQLQuery ( "UPDATE `DataPlayers` SET tag=? WHERE Serial=?", getPlayerName(source), getPlayerSerial(source), tag, colour ) end end end ) 9 minutes ago, #,+( _xiRoc[K]; > said: غير اسم الجدول سويت مثل ما قلت رجعنا من الاول ولا بيحفظ ولا بيسترجع ولا شئ executeSQLQuery( "CREATE TABLE IF NOT EXISTS TagPlayer ( Player,Serial,tag,colour ) " ) Edited August 1, 2017 by SaedAmer Link to comment
SaedAmer Posted August 1, 2017 Author Share Posted August 1, 2017 1 minute ago, #,+( _xiRoc[K]; > said: انا مافهمت وش تبي تسوي دلوقتي مسوي مود اعطاء تاج ابي احدد علي الاعب و اعطيه التاج ...ء نحن شغالين الان في الحفظ اني اسوي قاعدة بينات و جداول و احفظ و لما يخرج من السيرفر و يرجع التاج يكون موجود لين احذفه من المود Link to comment
Mhmd.z Posted August 1, 2017 Share Posted August 1, 2017 executeSQLQuery("CREATE TABLE IF NOT EXISTS PlayersTag (player, serial, tag, colour)") addEventHandler("onPlayerQuit", root, function () local tag = getElementData(source, "tag") local colour = getElementData(source, "colour") local playerName = getPlayerName(source) local serial = getPlayerSerial(source) local sqlTag = executeSQLQuery("SELECT tag FROM PlayersTag WHERE serial=?", serial) if isGuestAccount(getPlayerAccount(source)) then return end if not tag or not colour then return end if sqlTag == 0 then executeSQLQuery("INSERT INTO PlayersTag(player, serial, tag, colour) VALUES(?,?,?,?)", playerName, serial, tag, colour) else executeSQLQuery("UPDATE PlayersTag SET player=?,serial=?,tag=?,colour=? WHERE serial=?", playerName, serial, tag, colour) end end ) addEventHandler("onPlayerLogin", root, function () local serial = getPlayerSerial(source) local sqlTag = executeSQLQuery("SELECT tag FROM PlayersTag WHERE serial=?", serial) local sqlColour = executeSQLQuery("SELECT colour FROM PlayersTag WHERE serial=?", serial) if sqlTag ~= 0 then setElementData(source, "tag", sqlTag) setElementData(source, "colour", sqlColour) outputChatBox("Your tag is: "..sqlTag, source) else outputChatBox("You havn't a tag", source) 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