Jump to content

طلب فنكشنين


Recommended Posts

انا مسوى كول شيب اللى يخبطو يسمعو صوت معين

بس فى مشكلة ان الصوت يسمعو الكل يعنى السيرفر كلو

ابيه انا بس اللى اسمعو

وابى الصوت مايتكرر لو خبط الكول شيب مرتين

مثلا انا دخلت منطقة ولمست الكول شيب وخرجت ودخلتها تانى الصوت يكون صوتين فوق بعض

يرجى المساعدة وشكرا

Link to comment
انا مسوى كول شيب اللى يخبطو يسمعو صوت معين

بس فى مشكلة ان الصوت يسمعو الكل يعنى السيرفر كلو

ابيه انا بس اللى اسمعو

وابى الصوت مايتكرر لو خبط الكول شيب مرتين

مثلا انا دخلت منطقة ولمست الكول شيب وخرجت ودخلتها تانى الصوت يكون صوتين فوق بعض

يرجى المساعدة وشكرا

انت مسوي ترقير من سيرفر ل كلنت؟

https://wiki.multitheftauto.com/wiki/TriggerClientEvent

اقرا : sendTo

Link to comment

server

addCommandHandler("رقص", 
function (thePlayer) 
if getElementType ( thePlayer ) == 'player' then 
setPedAnimation ( thePlayer, "DANCING", "dnce_m_b") 
    end 
end 
) 
  
  

client

local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
  
  
addEventHandler("onClientColShapeHit", hillArea, 
function () 
    local sound = playSound("sound.mp3") 
    setSoundVolume(sound, 0.9)  
end 
) 
  

انا حذفت الترقر ممكن تقلى كيف احطو هنا ؟

انا كنت مسوى الكول شيب فى السرفر بس كنت كاتب

onColShapeHit

Link to comment

جرب

local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
   
addEventHandler("onClientColShapeHit", hillArea, 
 function (hitPlayer) 
   if hitPlayer == localPlayer then 
     local sound = playSound("sound.mp3") 
      setSoundVolume(sound, 0.9) 
     end 
 end 
) 
Link to comment
-- Client Side # 
local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
  
shape_ = function(hitPlayer) 
    if hitPlayer == localPlayer then 
        if eventName == 'onClientColShapeHit' then 
            sound = playSound("sound.mp3") 
                setSoundVolume(sound, 0.9) 
        else 
                if isElement(sound) then destroyElement(sound) sound = nil end 
            end 
        end 
    end 
addEventHandler("onClientColShapeHit", hillArea,shape_) 
addEventHandler('onClientColShapeLeave',hillArea,shape_) 

Link to comment
جرب

local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
   
addEventHandler("onClientColShapeHit", hillArea, 
 function (hitPlayer) 
   if hitPlayer == localPlayer then 
     local sound = playSound("sound.mp3") 
      setSoundVolume(sound, 0.9) 
     end 
 end 
) 

يجب انت تتحق من وجود الصوت .. وتسوي يوم يخرججـ ازالة للصوت > كودكـ يصير كذا

local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
   
addEventHandler( "onClientColShapeHit", hillArea, function ( element ) 
   if ( element == getLocalPlayer(  ) ) then 
      if ( isElement( sound ) ) then destroyElement( sound ) end 
           sound = playSound( "sound.mp3" ) 
           setSoundVolume( sound, 0.9 ) 
       end 
end ) 
   
addEventHandler( "onClientColShapeLeave", hillArea, function ( element ) 
   if ( element == getLocalPlayer(  ) ) then 
      if ( isElement( sound ) ) then  
               destroyElement( sound )  
           end 
      end 
end ) 
Link to comment

شكرا زاحف وشكرا للكل على المساعدة بس عندى استفسار يازاحف

     if ( isElement( sound ) ) then destroyElement( sound ) end 

بالكود الاول

      if ( isElement( sound ) ) then 
               destroyElement( sound ) ) 

بالكود التانى

اقصد فى الكول شيب

وعند مغادرته

ممكن شرح للكودين دولا احس انهم نفس بعض

Link to comment

فعلأ هم نفس بعض لانه بـ الكود الاول تحققت من وجود الصوت يوم يدخل اللاعب نفترض انه خرج من الماركر ودخل مرة اخرى .. والصوت موجود

( destroyElement ) ولو كان موجود حذفته ( isElement ) فـ تحققت من وجود الصوت

وبـ الكود الثاني .. يوم يخرج اللاعب تحققت برضو من وجود الصوت وحذفته > لانه نفترض دخل وخرج وما عاد دخل مرة ثانية فـ الصوت يبقى موجود

اتمنى فهمت .. اي شي ما فهمته تفضل قول #

Link to comment

احس اني ارد ع الفاضي,

-- Client Side # 
local hillArea = createColRectangle ( -1381.53, -533.78, 100, 100 ) 
  
shape_ = function(hitPlayer) 
    if hitPlayer == localPlayer then 
        if eventName == 'onClientColShapeHit' then 
            sound = playSound("sound.mp3") 
                setSoundVolume(sound, 0.9) 
        else 
                if isElement(sound) then destroyElement(sound) sound = nil end 
            end 
        end 
    end 
addEventHandler("onClientColShapeHit", hillArea,shape_) 
addEventHandler('onClientColShapeLeave',hillArea,shape_) 

كود زاحف مطول السالفه وذا مختصر

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