Jump to content

طلب فنكشنات


Recommended Posts

Client Side

addEventHandler( "onClientResourceStart", resourceRoot, function(  ) 
  TimerDownload = setTimer( function(   ) 
   if ( isTransferBoxActive (    ) ~= true ) then 
         setElementData( localPlayer, "download", false ) 
         killTimer( TimerDownload ) 
      end 
   end, 10000, 0 ) 
end ) 

Server Side

addEventHandler( "onPlayerJoin", root, function(  ) 
     setElementData( source, "download", "Download" ) 
end ) 
Link to comment
Client Side

addEventHandler( "onClientResourceStart", resourceRoot, function(  ) 
  TimerDownload = setTimer( function(   ) 
   if ( isTransferBoxActive (    ) ~= true ) then 
         setElementData( localPlayer, "download", false ) 
         killTimer( TimerDownload ) 
      end 
   end, 10000, 0 ) 
end ) 

Server Side

addEventHandler( "onPlayerJoin", root, function(  ) 
     setElementData( source, "download", "Download" ) 
end ) 

هلا زاحف

ممكن تشرحلي هذا الكود ؟

لاني بحاول اضيف عليه ايفنت الشات

وشكرا

Link to comment
Client Side

addEventHandler( "onClientResourceStart", resourceRoot, function(  ) 
  TimerDownload = setTimer( function(   ) 
   if ( isTransferBoxActive (    ) ~= true ) then 
         setElementData( localPlayer, "download", false ) 
         killTimer( TimerDownload ) 
      end 
   end, 10000, 0 ) 
end ) 

Server Side

addEventHandler( "onPlayerJoin", root, function(  ) 
     setElementData( source, "download", "Download" ) 
end ) 

هلا زاحف

ممكن تشرحلي هذا الكود ؟

لاني بحاول اضيف عليه ايفنت الشات

وشكرا

الكود اللي بجانب كلنت تايمر كل 10 ثواني يتحقق لو ما في تحميل يحط قيمة الداتا حق الداون لود فلس ويشيل التايمر

وبجانب سيرفر يوم يخش اللاعب يحط له داتا داون لود

Link to comment

زاحف انت عاكس ,

if ( isTransferBoxActive (    ) ~= true ) then 

كذا اذا في تحميل يشيل منه قيمة الداونلود ,

المفروض

if ( isTransferBoxActive (    ) ~= false ) then 

او ,

if not ( isTransferBoxActive (    ) ~= true ) then 

+

فتح القوس يمكن يسبب مشكلة

لان الامر حقه يكون القوس كذا

()

Link to comment
زاحف انت عاكس ,

if ( isTransferBoxActive (    ) ~= true ) then 

كذا اذا في تحميل يشيل منه قيمة الداونلود ,

المفروض

if ( isTransferBoxActive (    ) ~= false ) then 

او ,

if not ( isTransferBoxActive (    ) ~= true ) then 

+

فتح القوس يمكن يسبب مشكلة

لان الامر حقه يكون القوس كذا

()

~= true = false

بالنسبة للقوس وش دخله لول .. ما ياثر

Link to comment

والله مدري قلت يمكن يسبب مشكلة ,

بس شوف ,

Returns true if the file transfer box is visible, false if not.

يعني اذا تبي تتاكد هو شغال التحميل تستخدم

true

fasle اذا مخفي ,

انت مستخدم

setElementData ( source, 'download', false )

كذا يشيل الداونلود ,

والتحقق شغال ,

Link to comment
والله مدري قلت يمكن يسبب مشكلة ,

بس شوف ,

Returns true if the file transfer box is visible, false if not.

يعني اذا تبي تتاكد هو شغال التحميل تستخدم

true

fasle اذا مخفي ,

انت مستخدم

setElementData ( source, 'download', false )

كذا يشيل الداونلود ,

والتحقق شغال ,

شوف الشرط

~=

تعني عكسس القيمة

~= true = false 

Link to comment

* Server Side:

addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        setElementData ( source, "Download", true ) 
    end 
) 

* Client Side:

function checkDownload ( ) 
    if not ( isTransferBoxActive ( ) ) then 
        setElementData ( localPlayer, "Download", false ) 
    else 
        setTimer ( checkDownload, 4000, 1 ) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, checkDownload ) 

للتحقق من أن اللاعب انتهى من تحميل المودات أم لا getElementData الآن الي باقي عليكـ إنكـ تستخدم وظيفة

: وهذا مثال عليها ^

* Server Side:

-- إنشاء وظيفة : إضافة أمر للقيام بوظيفة معينة 
addCommandHandler ( "kill", 
    -- إنشاء فنكشن 
    function ( player ) 
        -- إذا كان اللاعب مازال يحمل المودات 
        if ( getElementData ( player, "Download" ) ) then 
            -- إخراج نص 
            outputChatBox ( "لا يمكنك استخدام هذا الأمر حتى تنتهي من تحميل المودات", player, 255, 0, 0 ) 
        -- إذا كان اللاعب منتهي من تحميل المودات 
        else 
            -- إذا كان اللاعب على قيد الحياة 
            if not ( isPedDead ( player ) ) then 
                -- قتل اللاعب 
                killPed ( player ) 
            -- إنهاء الشرط الثاني 
            end 
        -- إنهاء الشرط الأول 
        end 
    -- إنهاء الفنكشن 
    end 
-- إغلاق الوظيفة 
) 

Link to comment
* Server Side:
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        setElementData ( source, "Download", true ) 
    end 
) 

* Client Side:

function checkDownload ( ) 
    if not ( isTransferBoxActive ( ) ) then 
        setElementData ( localPlayer, "Download", false ) 
    else 
        setTimer ( checkDownload, 4000, 1 ) 
    end 
end 
addEventHandler ( "onClientResourceStart", resourceRoot, checkDownload ) 

للتحقق من أن اللاعب انتهى من تحميل المودات أم لا getElementData الآن الي باقي عليكـ إنكـ تستخدم وظيفة

: وهذا مثال عليها ^

* Server Side:

-- إنشاء وظيفة : إضافة أمر للقيام بوظيفة معينة 
addCommandHandler ( "kill", 
    -- إنشاء فنكشن 
    function ( player ) 
        -- إذا كان اللاعب مازال يحمل المودات 
        if ( getElementData ( player, "Download" ) ) then 
            -- إخراج نص 
            outputChatBox ( "لا يمكنك استخدام هذا الأمر حتى تنتهي من تحميل المودات", player, 255, 0, 0 ) 
        -- إذا كان اللاعب منتهي من تحميل المودات 
        else 
            -- إذا كان اللاعب على قيد الحياة 
            if not ( isPedDead ( player ) ) then 
                -- قتل اللاعب 
                killPed ( player ) 
            -- إنهاء الشرط الثاني 
            end 
        -- إنهاء الشرط الأول 
        end 
    -- إنهاء الفنكشن 
    end 
-- إغلاق الوظيفة 
) 

بالضبط هاذا اللي كنت اقصده ماله داعي التيبلات . . .

Link to comment

بالضبط هاذا اللي كنت اقصده ماله داعي التيبلات . . .

ما شاء الله عليك ذكي

طيب الحين إذا انت تغير الداتا حقك باقي اللاعبين ليه ترسل لهم الداتا حقك؟

المفروض على الأقل تسوي الداتا ما تنرسل للكلينت و بالكلينت تسوي تريقر للسيرفر عشان تغير الداتا

Link to comment

بالضبط هاذا اللي كنت اقصده ماله داعي التيبلات . . .

ما شاء الله عليك ذكي

طيب الحين إذا انت تغير الداتا حقك باقي اللاعبين ليه ترسل لهم الداتا حقك؟

المفروض على الأقل تسوي الداتا ما تنرسل للكلينت و بالكلينت تسوي تريقر للسيرفر عشان تغير الداتا

يا تابل لحد الآن بس هذا اللي قدرت اجيبه من كلامك

local Players = { } 
addEventHandler("onPlayerJoin",root, 
function () 
table.insert(Players,source) 
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...