Mr.Mostafa Posted August 17, 2018 Share Posted August 17, 2018 سلام عليكم ابي لو كتبت الكوماند ما اقدر مرة ثانية الا بعد 5 دقايق ابي اعرف كيف اعدل اليوزفل فنكشن اخليه يجيب الدقايق والثواني مب ثواني بس timerr = {} function convertMilliseconds( i ) if ( i ) then sec = math.fmod( math.floor( i / 1000 ), 60 ) return string.format( '%2d', sec ) end end addCommandHandler ("the", function ( ) local timer2 = convertMilliseconds( getTimerDetails( timerr[source] ) ) if isTimer(timerr[source]) then outputChatBox( "# You Have To Wait [ ".. timer2 .." ] !", player, 255, 0, 0 ) return end outputChatBox("done",root,255,0,0) timerr[source] = setTimer( function () end, 300000, 1 ) end ) Link to comment
Rakan# Posted August 17, 2018 Share Posted August 17, 2018 بدال كل ذا التعب سوي getTimerDetails واقسم على 1000*60 يعني 60000 وتجيب الدقايق والثواني اقسم على 1000 Link to comment
Doffy Posted August 17, 2018 Share Posted August 17, 2018 3 minutes ago, Rakan# said: بدال كل ذا التعب سوي getTimerDetails واقسم على 1000*60 يعني 60000 وتجيب الدقايق والثواني اقسم على 1000 2 Link to comment
Rakan# Posted August 17, 2018 Share Posted August 17, 2018 Just now, #DesTroeyR said: خلاص مقست مره حطيتها ضحكنا تعيدها ليه Link to comment
Doffy Posted August 17, 2018 Share Posted August 17, 2018 Just now, Rakan# said: خلاص مقست مره حطيتها ضحكنا تعيدها ليه خلاص نسوي وحدا جديدة لعيونك 1 Link to comment
Rakan# Posted August 17, 2018 Share Posted August 17, 2018 Just now, #DesTroeyR said: خلاص نسوي وحدا جديدة لعيونك لآ , اعتذر لأني لا احب ان يتم وضع صورتي في مواقف ليست لي . 1 Link to comment
Mr.Mostafa Posted August 17, 2018 Author Share Posted August 17, 2018 22 minutes ago, Rakan# said: بدال كل ذا التعب سوي getTimerDetails واقسم على 1000*60 يعني 60000 وتجيب الدقايق والثواني اقسم على 1000 بيجيب الثواني بس انا ابيه يجيب كدا 4:59 مثلا Link to comment
Rakan# Posted August 17, 2018 Share Posted August 17, 2018 function getTimeLeft(Timer) ms = getTimerDetails(Timer) local m = math.floor(ms/60000) local s = math.floor((ms-m*60000)/1000) if m < 10 then m = "0"..m end if s < 10 then s = "0"..s end return ""..m..":"..s.."" end Link to comment
Mr.Mostafa Posted August 18, 2018 Author Share Posted August 18, 2018 16 hours ago, Rakan# said: function getTimeLeft(Timer) ms = getTimerDetails(Timer) local m = math.floor(ms/60000) local s = math.floor((ms-m*60000)/1000) if m < 10 then m = "0"..m end if s < 10 then s = "0"..s end return ""..m..":"..s.."" end مآ آشتغل 14 : attempt to perrfotm atithmetic on global 'ms' ( a boolean value ) local m = math.floor(ms/60000) سطر 14 هآدآ Link to comment
N3xT Posted August 18, 2018 Share Posted August 18, 2018 (edited) local timerr = {} function convertMilliseconds ( timeMs ) local minutes = math.floor( timeMs / 60000 ) local timeMs = timeMs - minutes * 60000; local seconds = math.floor( timeMs / 1000 ) return string.format( '%02d:%02d', minutes, seconds ); end addCommandHandler ("the", function ( player ) if isTimer ( timerr[player] ) then outputChatBox( "# You Have To Wait [ ".. convertMilliseconds ( getTimerDetails( timerr[player] ) ) .." ] !", player, 255, 0, 0 ) return end outputChatBox("done",player,255,0,0) timerr[player] = setTimer( function () end, 300000, 1 ) end ) Edited August 18, 2018 by N3xT 1 Link to comment
Mr.Mostafa Posted August 18, 2018 Author Share Posted August 18, 2018 3 minutes ago, N3xT said: if تسلم آشتغل .. بس لو آبي آفعل آلتآيمر للآعب آي سطر ؟ هآدآ ؟ 3 minutes ago, N3xT said: timerr[player] = setTimer( function () end, 300000, 1 ) Link to comment
N3xT Posted August 18, 2018 Share Posted August 18, 2018 Just now, Mr.Mostafa said: تسلم آشتغل .. بس لو آبي آفعل آلتآيمر للآعب آي سطر ؟ هآدآ ؟ الله يسلمك, يب Link to comment
Rockyz Posted August 18, 2018 Share Posted August 18, 2018 (edited) او تقدر بدون تايمر local delayTable = {}; local delay = 75 -- هنا الوقت بالثواني addCommandHandler('okee', function(player) local delay = delay*1000 local tick = getTickCount()-(delayTable[player] or 0) if tick >= delay or not delayTable[player] then outputChatBox('Done !', player, 0, 255, 0, true); delayTable[player] = getTickCount(); else local seconds = (delay-tick)/1000 outputChatBox('Please wait ['..('%02dM:%02dS'):format(seconds/60, seconds%60)..'] !', player, 0, 255, 0, true); end end) Edited August 18, 2018 by #,xiRocKyz Link to comment
Rockyz Posted August 18, 2018 Share Posted August 18, 2018 28 minutes ago, #,xiRocKyz said: او تقدر بدون تايمر local delayTable = {}; local delay = 75 -- هنا الوقت بالثواني addCommandHandler('okee', function(player) local delay = delay*1000 local tick = getTickCount()-(delayTable[player] or 0) if tick >= delay or not delayTable[player] then outputChatBox('Done !', player, 0, 255, 0, true); delayTable[player] = getTickCount(); else local seconds = (delay-tick)/1000 outputChatBox('Please wait ['..('%02dM:%02dS'):format(seconds/60, seconds%60)..'] !', player, 0, 255, 0, true); end end) اذا تبي تستخدم طريقتي عدل السطر ال7 if tick >= delay then Link to comment
Rakan# Posted August 18, 2018 Share Posted August 18, 2018 2 hours ago, Mr.Mostafa said: مآ آشتغل 14 : attempt to perrfotm atithmetic on global 'ms' ( a boolean value ) local m = math.floor(ms/60000) سطر 14 هآدآ استعمالك له خطا Link to comment
Mr.Mostafa Posted August 27, 2018 Author Share Posted August 27, 2018 آقدر آسوي لو آلتآيمر كآن دقيقتين مثلا وخلص صآر 50 ثآنية يكون كدآ ("..s..") يعني يجيب آلثوآني فقط مآ يجيب (0:"..s..") @N3xT @Rakan# Link to comment
Rakan# Posted August 27, 2018 Share Posted August 27, 2018 12 hours ago, Mr.Mostafa said: آقدر آسوي لو آلتآيمر كآن دقيقتين مثلا وخلص صآر 50 ثآنية يكون كدآ ("..s..") يعني يجيب آلثوآني فقط مآ يجيب (0:"..s..") @N3xT @Rakan# على اي كود؟ Link to comment
N3xT Posted August 27, 2018 Share Posted August 27, 2018 جرب كذا function convertMilliseconds ( timeMs ) local minutes = math.floor( timeMs / 60000 ) local timeMs = timeMs - minutes * 60000; local seconds = math.floor( timeMs / 1000 ) if ( minutes and minutes ~= 0 ) then return string.format( '%02d:%02d', minutes, seconds ); else return string.format( '%02d', seconds ); end end Link to comment
Mr.Mostafa Posted August 28, 2018 Author Share Posted August 28, 2018 On 8/18/2018 at 02:37, N3xT said: local timerr = {} function convertMilliseconds ( timeMs ) local minutes = math.floor( timeMs / 60000 ) local timeMs = timeMs - minutes * 60000; local seconds = math.floor( timeMs / 1000 ) return string.format( '%02d:%02d', minutes, seconds ); end addCommandHandler ("the", function ( player ) if isTimer ( timerr[player] ) then outputChatBox( "# You Have To Wait [ ".. convertMilliseconds ( getTimerDetails( timerr[player] ) ) .." ] !", player, 255, 0, 0 ) return end outputChatBox("done",player,255,0,0) timerr[player] = setTimer( function () end, 300000, 1 ) end ) يب ظبطت بس في مشكلة بعد ض1 لو كآن آلتآيمر دقيقة وثآنيتين تيجي كدآ 01:22 آبيهآ كدآ 1:22 Link to comment
Trefeor Posted August 30, 2018 Share Posted August 30, 2018 عدل الوظيفة كذا function convertMilliseconds ( timeMs ) local minutes = math.floor( timeMs / 60000 ) local timeMs = timeMs - minutes * 60000; local seconds = math.floor( timeMs / 1000 ) return tostring(minutes)..":"..tostring(seconds) 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