Bee Posted July 20, 2013 Share Posted July 20, 2013 السلام عليكم ي شباب ابغى احفظ اشياء في السيرفر يعني مثلا واحد طلع من السيرفر ومعه فلوس حتى لو طفيت السيرفر وشغلته تنحفظ .. ياليت تعطوني الاكواد اللي ابدأ فيها Link to comment
hassan.k.s.a Posted July 20, 2013 Share Posted July 20, 2013 السلام عليكم ي شباب ابغى احفظ اشياء في السيرفر يعني مثلا واحد طلع من السيرفر ومعه فلوس حتى لو طفيت السيرفر وشغلته تنحفظ .. ياليت تعطوني الاكواد اللي ابدأ فيها setAccountData getAccountData isGuestAccount getPlayerAccount Event : https://wiki.multitheftauto.com/wiki/OnPlayerLogin https://wiki.multitheftauto.com/wiki/OnPlayerLogout https://wiki.multitheftauto.com/wiki/OnPlayerQuit or [url=https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery]https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery[/url] or [url=https://wiki.multitheftauto.com/wiki/Server_Scripting_Functions#XML_functions]https://wiki.multitheftauto.com/wiki/Se ... _functions[/url] Link to comment
فاّرس Posted July 20, 2013 Share Posted July 20, 2013 شوف موضوعي هذا شرحت في عده اشياء للححفظ, viewtopic.php?f=164&t=62247 Link to comment
Bee Posted July 20, 2013 Author Share Posted July 20, 2013 طيب شرحك لو طفيت السسيرفر وشغلته ما تروح المعلومات ؟ Link to comment
فاّرس Posted July 20, 2013 Share Posted July 20, 2013 لا تروح, اذا تبيها ما تروح استخدم , executeSQLQuery Link to comment
Bee Posted July 20, 2013 Author Share Posted July 20, 2013 لا تروح,اذا تبيها ما تروح استخدم , executeSQLQuery ما في اسهل من ذا ؟ Link to comment
hassan.k.s.a Posted July 20, 2013 Share Posted July 20, 2013 تقدر تستخدم xml لاكن هذا مثال على sql حفظ الفلوس بـ addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()),function() executeSQLQuery("CREATE TABLE IF NOT EXISTS Save_Money_Hassan (Account,Money)") end) addEventHandler("onPlayerQuit",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then executeSQLQuery("UPDATE Save_Money_Hassan SET Money=? WHERE Account=?",tostring(Money),tostring(Account)) else executeSQLQuery("INSERT INTO Save_Money_Hassan(Account,Money) VALUES(?,?)",tostring(Account),tostring(Money)) end end) addEventHandler("onPlayerLogout",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then executeSQLQuery("UPDATE Save_Money_Hassan SET Money=? WHERE Account=?",tostring(Money),tostring(Account)) else executeSQLQuery("INSERT INTO Save_Money_Hassan(Account,Money) VALUES(?,?)",tostring(Account),tostring(Money)) end setPlayerMoney(source,0) end) addEventHandler("onPlayerLogin",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then local RowAccount = RowAccount[1]["Money"] setPlayerMoney(source,tonumber(RowAccount)) end end) Link to comment
Bee Posted July 20, 2013 Author Share Posted July 20, 2013 تقدر تستخدم xmlلاكن هذا مثال على sql حفظ الفلوس بـ addEventHandler ("onResourceStart", getResourceRootElement(getThisResource()),function() executeSQLQuery("CREATE TABLE IF NOT EXISTS Save_Money_Hassan (Account,Money)") end) addEventHandler("onPlayerQuit",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then executeSQLQuery("UPDATE Save_Money_Hassan SET Money=? WHERE Account=?",tostring(Money),tostring(Account)) else executeSQLQuery("INSERT INTO Save_Money_Hassan(Account,Money) VALUES(?,?)",tostring(Account),tostring(Money)) end end) addEventHandler("onPlayerLogout",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local Money = getPlayerMoney(source) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then executeSQLQuery("UPDATE Save_Money_Hassan SET Money=? WHERE Account=?",tostring(Money),tostring(Account)) else executeSQLQuery("INSERT INTO Save_Money_Hassan(Account,Money) VALUES(?,?)",tostring(Account),tostring(Money)) end setPlayerMoney(source,0) end) addEventHandler("onPlayerLogin",getRootElement(),function() local Account = getAccountName(getPlayerAccount(source)) local RowAccount = executeSQLQuery("SELECT * FROM Save_Money_Hassan WHERE Account = '"..tostring(Account).."'") if not ( #RowAccount == 0 ) then local RowAccount = RowAccount[1]["Money"] setPlayerMoney(source,tonumber(RowAccount)) end end) المشكلة اني ما اعرف وش متطلبات الكود قرات الويكي ولا فهمت Link to comment
TAPL Posted July 20, 2013 Share Posted July 20, 2013 متطلبات ايش الكود كله موجود في مثال الويكي https://wiki.multitheftauto.com/wiki/GetAccountData Link to comment
Bee Posted July 20, 2013 Author Share Posted July 20, 2013 متطلبات ايشالكود كله موجود في مثال الويكي https://wiki.multitheftauto.com/wiki/GetAccountData انا اقصد ذا الكود executeSQLQuery Link to comment
hassan.k.s.a Posted July 20, 2013 Share Posted July 20, 2013 عندك مثل الكود حقي لحفظ المال بالحساب + هنا فيه شرح : viewtopic.php?f=164&t=56729 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