Jump to content

استفسار


MA[S]RIY

Recommended Posts

Posted

السلام عليكم

getRealTime

 مثلا تكون الحين كيف لما اتحقق من الساعه 

7 مثلا

كيف تكون 7 صباحا مو مساءا

يعني كيف 

if hours == 7 then

كيف اخليه يسوي الشي صباحا فقط او مساءا فقط ؟

Posted
On ٩‏/٤‏/٢٠١٦ at 20:16, </Mr.Tn6eL> said:

وظيفة تقوم بارجاع الوقت الحقيقي وتحويله من 24 ساعة الى 12 ساعة

The function returns real time with convert 24h to 12h

Shared function

 


string getTime( ) 
 

 


function getTime( ) 
    local time = getRealTime( ) 
    local h, m = time.hour, time.minute 
    return (h % 12 and h % 12 or 12)..":"..(m < 10 and "0"..m or m).." "..(h >= 12 and "PM" or "AM") 
end 
 

 

 

Posted

مثال :

function getTime( )

    local time = getRealTime( )

    local h, m = time.hour, time.minute

    return (h % 12 and h % 12 or 12)..":"..(m < 10 and "0"..m or m).." "..(h >= 12 and "PM" or "AM")

end

addCommandHandler ( 'whatTimeIsIt', function ( )

    outputChatBox ( 'Its ( ' .. getTime ( ) .. ' )' )

end )

 

Posted
5 hours ago, #,+( _xiRoc[K]; > said:

اذا تبي تسوي كذا لازم تايمر

تمام عارف كل شي من ناحيه التايمر

بس ابي اعرف الكود 

ازاي اتحقق لما الساعه تيجي 7 صباحا 

يطلع نص بالشات 

؟

 

ارجو الرد سريع محتاج الكود

@Default#^

@#,+( _xiRoc[K]; >

Posted
local time = getRealTime()
local hours = time.hour
if ( hours == 7 ) then -- 7 AM

end 

مثال يشرحلك كيفية التحقق من ان الوقت 7 صباحا

  • Like 2

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