+Source|> Posted March 29, 2019 Share Posted March 29, 2019 سلام عليكم ابي اسوي كود تايمر يعني بعد ما ياخذ الراتب مثلا ينتظر 24 ساعه عشان الراتب اللي بعده وابيها تنحفظ لما يطلع او المود يتقفل محاولاتي addEventHandler( "onResourceStart", root, function() executeSQLQuery( "CREATE TABLE IF NOT EXISTS SQLWaitDaykff ( Timer, SerialP )" ) end ) TimeDaySet = {} addEvent("onGet", true) addEventHandler("onGet", root, function( Money ) if isTimer( TimeDaySet[source] ) then triggerClientEvent( source, "WaitDay", source ) return end givePlayerMoney( source, Money ) TimeDaySet[source] = setTimer( function() end, 86400000, 1 ) end ) function myEvents () if ( eventName == "onPlayerLogin" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLWaitDaykf WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ source ] ) ) then killTimer ( TimeDaySet [ source ] ) end TimeDaySet [ source ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end elseif ( eventName == "onPlayerQuit" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLWaitDaykf WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ source ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ source ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLWaitDaykf ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLWaitDaykf SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end TimeDaySet[ source ] = nil end end elseif ( eventName == "onResourceStop" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLWaitDaykf WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ v ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ v ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLWaitDaykf ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLWaitDaykf SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end end end end elseif ( eventName == "onResourceStart" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLWaitDaykf WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ v ] ) ) then killTimer ( TimeDaySet [ v ] ) end TimeDaySet [ v ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end end end addEventHandler("onPlayerLogin", root, myEvents) addEventHandler("onPlayerQuit", root, myEvents) addEventHandler("onResourceStop", root, myEvents) addEventHandler("onResourceStart", root, myEvents) Link to comment
nxFairlywell Posted March 29, 2019 Share Posted March 29, 2019 تقصد أنك تريد أن يحصل اللاعب على راتب محدد كل 24 ساعه ؟ وإذا خرج من السيرفر يتوقف التايمر إلى أن يدخل مرة أخرى ؟ Link to comment
+Source|> Posted March 29, 2019 Author Share Posted March 29, 2019 19 minutes ago, NX_CI said: تقصد أنك تريد أن يحصل اللاعب على راتب محدد كل 24 ساعه ؟ وإذا خرج من السيرفر يتوقف التايمر إلى أن يدخل مرة أخرى ؟ لا ابيه لما يطلع التايمر ما يوقف يستمر Link to comment
nxFairlywell Posted March 29, 2019 Share Posted March 29, 2019 1 minute ago, +Source|> said: لا ابيه لما يطلع التايمر ما يوقف يستمر 3 minutes ago, +Source|> said: لا ابيه لما يطلع التايمر ما يوقف يستمر طيب اذا تبغى التايمر يستمر لا توقفه اذا طلع اللاعب لأنه بالسيرفر ما يوقف الا اذا وقفته انت على عكس الكلينت Link to comment
Mr.Mostafa Posted March 29, 2019 Share Posted March 29, 2019 سلام عليكم انت كنت سويت موضوع زي هذا بالظبط وساعدك فيه نكست وعبدالكريم .. ووصلوا معاك للكود دا TimeDaySet = { } addEvent("giveDailySalary", true) addEventHandler("giveDailySalary", root, function( ) if isTimer( TimeDaySet [ source ] ) then outputChatBox( "#dddddd ≈ [ Bank ]#ff0000 Please Try Again After 24 Hours", source, 0, 0, 0, true ) return end outputChatBox( "#00ffff Salary Was Successfully Taken ✔", source, 0, 0, 0, true ) givePlayerMoney( source, 9000 ) TimeDaySet [ source ] = setTimer( function() end, 86400000, 1 ) end ) function myEvents () if ( eventName == "onPlayerLogin" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ source ] ) ) then killTimer ( TimeDaySet [ source ] ) end TimeDaySet [ source ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end elseif ( eventName == "onPlayerQuit" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ source ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ source ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLTst ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLTst SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end TimeDaySet [ source ] = nil end end elseif ( eventName == "onResourceStop" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ v ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ v ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLTst ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLTst SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end end end end elseif ( eventName == "onResourceStart" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ v ] ) ) then killTimer ( TimeDaySet [ v ] ) end TimeDaySet [ v ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end end end addEventHandler("onPlayerLogin", root, myEvents) addEventHandler("onPlayerQuit", root, myEvents) addEventHandler("onResourceStop", root, myEvents) addEventHandler("onResourceStart", root, myEvents) Link to comment
+Source|> Posted March 29, 2019 Author Share Posted March 29, 2019 (edited) 20 minutes ago, Mr.Mostafa said: سلام عليكم انت كنت سويت موضوع زي هذا بالظبط وساعدك فيه نكست وعبدالكريم .. ووصلوا معاك للكود دا TimeDaySet = { } addEvent("giveDailySalary", true) addEventHandler("giveDailySalary", root, function( ) if isTimer( TimeDaySet [ source ] ) then outputChatBox( "#dddddd ≈ [ Bank ]#ff0000 Please Try Again After 24 Hours", source, 0, 0, 0, true ) return end outputChatBox( "#00ffff Salary Was Successfully Taken ✔", source, 0, 0, 0, true ) givePlayerMoney( source, 9000 ) TimeDaySet [ source ] = setTimer( function() end, 86400000, 1 ) end ) function myEvents () if ( eventName == "onPlayerLogin" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ source ] ) ) then killTimer ( TimeDaySet [ source ] ) end TimeDaySet [ source ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end elseif ( eventName == "onPlayerQuit" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ source ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ source ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLTst ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLTst SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end TimeDaySet [ source ] = nil end end elseif ( eventName == "onResourceStop" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeDaySet [ v ] ) ) then local myTimer = getTimerDetails ( TimeDaySet [ v ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO SQLTst ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE SQLTst SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end end end end elseif ( eventName == "onResourceStart" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM SQLTst WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeDaySet [ v ] ) ) then killTimer ( TimeDaySet [ v ] ) end TimeDaySet [ v ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end end end addEventHandler("onPlayerLogin", root, myEvents) addEventHandler("onPlayerQuit", root, myEvents) addEventHandler("onResourceStop", root, myEvents) addEventHandler("onResourceStart", root, myEvents) ادري جربت فيه بس المشكله ما ينحفظ Edited March 29, 2019 by +Source|> Link to comment
+Source|> Posted March 29, 2019 Author Share Posted March 29, 2019 function myEvents () if ( eventName == "onPlayerQuit" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeWaitSet [ source ] ) ) then local myTimer = getTimerDetails ( TimeWaitSet [ source ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO ghj ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE ghj SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end TimeWaitSet [ source ] = nil end end elseif ( eventName == "onResourceStop" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeWaitSet [ v ] ) ) then local myTimer = getTimerDetails ( TimeWaitSet [ v ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO ghj ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE ghj SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end end end end elseif ( eventName == "onResourceStart" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeWaitSet [ v ] ) ) then killTimer ( TimeWaitSet [ v ] ) end TimeWaitSet [ v ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end elseif ( eventName == "onPlayerLogin" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeWaitSet [ v ] ) ) then killTimer ( TimeWaitSet [ v ] ) end TimeWaitSet [ source ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end end addEventHandler("onPlayerLogin", root, myEvents) addEventHandler("onPlayerQuit", root, myEvents) addEventHandler("onResourceStop", root, myEvents) addEventHandler("onResourceStart", root, myEvents) التايمر كذا ينحفظ ولما ادخل يرجع يبدأ من المكان اللي انحفظ فيه انا ابغا لما الاعب يطلع التايمر يستمر وما يوقف الين ينتهي Link to comment
Mr.Mostafa Posted March 29, 2019 Share Posted March 29, 2019 2 hours ago, +Source|> said: ادري جربت فيه بس المشكله ما ينحفظ يب حتي انا جربته , الكود فيه مشكلة @Abdul KariM @N3xT 1 Link to comment
KillerX Posted March 29, 2019 Share Posted March 29, 2019 2 hours ago, +Source|> said: function myEvents () if ( eventName == "onPlayerQuit" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeWaitSet [ source ] ) ) then local myTimer = getTimerDetails ( TimeWaitSet [ source ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO ghj ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE ghj SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end TimeWaitSet [ source ] = nil end end elseif ( eventName == "onResourceStop" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( isTimer ( TimeWaitSet [ v ] ) ) then local myTimer = getTimerDetails ( TimeWaitSet [ v ] ) if ( myTimer ) then if ( #checkSQL == 0 ) then executeSQLQuery( "INSERT INTO ghj ( Timer, SerialP ) VALUES( ? , ? )", myTimer, playerSerial ) else executeSQLQuery("UPDATE ghj SET Timer=? WHERE SerialP=?", myTimer, playerSerial ) end end end end elseif ( eventName == "onResourceStart" ) then for k, v in ipairs ( getElementsByType ( "player" ) ) do local playerSerial = getPlayerSerial ( v ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeWaitSet [ v ] ) ) then killTimer ( TimeWaitSet [ v ] ) end TimeWaitSet [ v ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end elseif ( eventName == "onPlayerLogin" ) then local playerSerial = getPlayerSerial ( source ) local checkSQL = executeSQLQuery ( 'SELECT * FROM ghj WHERE SerialP=?' , playerSerial ) if ( #checkSQL ~= 0 ) then if ( isTimer ( TimeWaitSet [ v ] ) ) then killTimer ( TimeWaitSet [ v ] ) end TimeWaitSet [ source ] = setTimer( function() end, checkSQL[1].Timer, 1 ) end end endaddEventHandler("onPlayerLogin", root, myEvents) addEventHandler("onPlayerQuit", root, myEvents)addEventHandler("onResourceStop", root, myEvents) addEventHandler("onResourceStart", root, myEvents) التايمر كذا ينحفظ ولما ادخل يرجع يبدأ من المكان اللي انحفظ فيه انا ابغا لما الاعب يطلع التايمر يستمر وما يوقف الين ينتهي لو انتا تبيه ما ينحفظ ليه مسوي حدث خروج الاعب من الاساس وليه مسوي كوليمن للتايمر في السكل ؟ Link to comment
+Source|> Posted March 29, 2019 Author Share Posted March 29, 2019 46 minutes ago, KillerX said: لو انتا تبيه ما ينحفظ ليه مسوي حدث خروج الاعب من الاساس وليه مسوي كوليمن للتايمر في السكل ؟ عشان لما يطلع اللاعب واقفل المود واشغله ينعاد التايمر من جديد قولي كيف اسويه ؟ Link to comment
KillerX Posted March 29, 2019 Share Posted March 29, 2019 Just now, +Source|> said: عشان لما يطلع اللاعب واقفل المود واشغله ينعاد التايمر من جديد قولي كيف اسويه ؟ تبي التايمر ينعاد تاني ؟؟ لو كلامي صح استخدم كود resetTimer Link to comment
+Source|> Posted March 29, 2019 Author Share Posted March 29, 2019 1 minute ago, KillerX said: تبي التايمر ينعاد تاني ؟؟ لو كلامي صح استخدم كود resetTimer لاا ما ابيه ينعاد انا ققصدي الحين انا سحبت راتب المفروض انتظر 24 ساعه عشان اخذ الراتب اللي بعده بس ابي لما اللاعب ما يكون موجود في السيرفر التايمر ما يوقف لين يدخل بعدين يكم ابيه لما يطلع التايمر يستمر في العد لمدة 24 ساعه فاهمني ؟ 1 Link to comment
MR.M1 Posted March 29, 2019 Share Posted March 29, 2019 ماعتقد اني رايت تفكير غريب مثل كذا ياخي والله + كود حق @Mr.Mostafa اعتقد انه الصحيح والتمام + كود حق كلير اكس صحيح وانا عن نفسي ماقدر اعطيك افادات لهذا الموضوع ❤ Link to comment
nxFairlywell Posted March 29, 2019 Share Posted March 29, 2019 الراتب انت حافظه في داتا بيس ولالا ؟ إذا لا كيف تبغى اللاعب يستلم فلوسه وهو برا السيرفر لازم نعرف انت تستخدم اي طريقة عشان تعطي اللاعب الفلوس عن طريق givePlayerMoney ولا عن طريق داتا ولا ايش Link to comment
Abdul KariM Posted March 30, 2019 Share Posted March 30, 2019 TimeWaitSet [ getPlayerSerial ( source ) ] بـ TimeWaitSet [ source ] استبدل بس يطفي السكربت سوي لوب على قاعد البيانات جيب جميع السريالات وسوي تحقق اذا فيه تايمر على السريال تحدث القيمة وتوقف التايمر واذا اشتغل السكربت لوب على قاعد البيانات جيب جميع السريالات سوي تايمر على السريال ومدة التايمر بتكون مخزنة بالقاعدة تستخرجها onPlayerQuit + onPlayerLogin = delete 1 Link to comment
+Source|> Posted March 30, 2019 Author Share Posted March 30, 2019 7 hours ago, NX_CI said: الراتب انت حافظه في داتا بيس ولالا ؟ إذا لا كيف تبغى اللاعب يستلم فلوسه وهو برا السيرفر لازم نعرف انت تستخدم اي طريقة عشان تعطي اللاعب الفلوس عن طريق givePlayerMoney ولا عن طريق داتا ولا ايش عن طريق السكل انو لما اللاعب يضغط زر والتايمر باقي ما خلص يقوله حاول بعد 24 ساعه لو التايمر خلص يعطيه فلوسه ويبدأ تايمر جديد 1 hour ago, Abdul KariM said: TimeWaitSet [ getPlayerSerial ( source ) ] بـ TimeWaitSet [ source ] استبدل بس يطفي السكربت سوي لوب على قاعد البيانات جيب جميع السريالات وسوي تحقق اذا فيه تايمر على السريال تحدث القيمة وتوقف التايمر واذا اشتغل السكربت لوب على قاعد البيانات جيب جميع السريالات سوي تايمر على السريال ومدة التايمر بتكون مخزنة بالقاعدة تستخرجها onPlayerQuit + onPlayerLogin = delete واو 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