Jump to content

مشكلة وابغى حل


Recommended Posts

addEventHandler ("onClientGUIClick", getRootElement(), 
function(button, state, absoluteX, absoluteY) 
    if ( source ==  c ) then 
            setTimer ( function ( player ) 
setElementHealth ( localPlayer, 0 ) 
end, 60000, guiGetText(b1) ) 
             end 
            end 
) 
  

المشكلة مدري اش هي الحين كتبت في التكست 5 يعني 5 دقايق

مااحس الوقت يجي دقيق + تتكرر الوظيفة

Link to comment

-- Client Side # 
addEventHandler ('onClientGUIClick', root,function() 
    if ( source ==  c ) then 
        if isTimer ( timer ) then killTimer ( timer ) timer = nil end 
            timer = setTimer ( function ( ) 
                setElementHealth ( localPlayer, 0 ) 
                    end,tonumber(guiGetText(b1)) * 60 * 1000, 1 
            ) 
        end 
    end 
) 
Link to comment

-- Client Side # 
addEventHandler ('onClientGUIClick', root,function -- gui حدث اذا تم الضغط على الـ 
    if ( source ==  c ) then -- سواء كان صوره او زر الخ c نتحقق ان الي انضغط هو المتغير 
        if isTimer ( timer ) then killTimer ( timer ) timer = nil end -- نتحقق اذا كان التايمر موجود نقتله عشان نسوي واحد جديد 
            timer = setTimer ( function ( ) -- نسوي التايمر 
                setElementHealth ( localPlayer, 0 ) -- نخلي الدم 0 
                    end,tonumber(guiGetText(b1)) * 60 * 1000, 1 -- نقفل التايمر 
            ) 
        end 
    end 
) 
  
--[[  
  
tonumber = استخدمتها عشان احول من سترنق الى رقم , لأنه كما هو معروف ان الاديت او الميمو سترنق وليست رقم  
  
بعد ما تم التحويل الى رقم ضربناها فيه 60 ثم في 1000 لكي تصبح بالدقائق 
  
بمعنى لو كتبت في الاديت 10 راح يصير 10 دقائق . 
]] 
Link to comment

لازم تضرب في 60 الي هو عدد الدقائق , ثم تضربها في عدد الثواني بالمليسيكوند عشان تصير بالدقيقه .

الرقم الثاني الي هو 1 هذا عدد تكرار التايمر ... يعني كم مره تبيه يتكرر التايمر .. بمعنى لو حطيته 0 ما راح يوقف التكرار.

1 = يعني مره واحده ثم يتوقف التايمر .

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