Jump to content

طلب تعديل تايمر


Recommended Posts

سلام عليكم

ابي لو كتبت الكوماند ما اقدر مرة ثانية الا بعد 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
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
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 by N3xT
  • Like 1
Link to comment

او تقدر بدون تايمر

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 by #,xiRocKyz
Link to comment
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
  • 2 weeks later...
12 hours ago, Mr.Mostafa said:

آقدر آسوي 

لو آلتآيمر كآن دقيقتين مثلا

وخلص صآر 50 ثآنية

يكون كدآ

("..s..")

يعني يجيب آلثوآني فقط مآ يجيب

(0:"..s..")

@N3xT

@Rakan#

على اي  كود؟

Link to comment

جرب كذا

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
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

عدل الوظيفة كذا

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...