Jump to content

nil و kill timer ممكن شرح


Recommended Posts

السلام عليكم عندي استفسار شفت في مود صاحب المود كاتب kill timer

بعدين شفت شيء مكتوب thetimer = nil

وش يعني نيل ووش الفرق بين كل تايمر ونيل ممكن شرح شباب ؟ :mrgreen:

Link to comment

شف بعطيك مثآل ع الكيل تايمر ذذذ

يتحقق ان اللاعب عنده تحميل كل 10 ثواني و اذا عنده تحميل نسوي ترايقر ونحطه ع احداثيات معينة

طبعاً بعد ما نسوي الترايقر نسوي كيل تايمر عشان لا يعيد الوظيفة

addEventHandler("onClientResourceStart",resourceRoot, 
function () 
Timer = setTimer( function(   ) 
    if isTransferBoxActive() then 
    else 
    triggerServerEvent("SendTrigger",localPlayer) 
        killTimer(Timer) 
          end, 10000, 0 ) 
     end 
end 
) 

addEvent( "SendTrigger", true ) 
addEventHandler( "SendTrigger", root, 
function(player) 
    spawnPlayer(player,x , y , z) 
end) 
  

و الـ nil مثل الكيل تايمر

مداكك تسويها كذا

addEventHandler("onClientResourceStart",resourceRoot, 
function () 
Timer = setTimer( function(   ) 
    if isTransferBoxActive() then 
    else 
    triggerServerEvent("SendTrigger",localPlayer) 
        Timer = nil 
          end, 10000, 0 ) 
     end 
end 
) 
Link to comment

setTimer -- تحط الوظيفة بوقت محدد 
killTimer -- يوقف التايمر او يدمره 
nil -- لا شيء تقدر تحطها بدل الكيل تايمر مثل المثال الي حطيته فوق وتقدر تسوي به أي شيء غير التايمر وتقدر تستخدمها للتحقق 
Link to comment

^ شرحكم خاطئ

الكيل تايمر ماله علاقة بالنيل

الـ killTimer يوقف التايمر او يحذفه

أما الـ nil

فتستخدمه مثلا لمتغير التايمر

مثال

theTimer = setTimer(...) 
theTimer = nil 

غيرنا قيمة متغير التايمر لـ nil

ويعني لاشيء

فأصبح متغير theTimer لايعبر عن التايمر

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