Jump to content

فنكشن


Recommended Posts

Posted
ERROR: Couldn't find file music/ff.ttf for resource aa 
Loading of resource 'aa' failed 
  
 

خلاص انسى اخوي ممكن اخر سؤال

playSound 

stopSound 

اخوي انا لما اركب اغنيه ويضغط زر تشتغل لكن اذا رجع ضغط عليها تتكرر ما في طريقه ما تتكرر اكثر من مره

وبالنسبه لأيقاف الموسيقى

مو راضي يقفل الموسيقى المود مسحته بس تعرف ليه اخوي؟؟

playSFX 

وش وظيفتة ذا وفي له مثال من عندك مع شرح خخفيف

بالنسبة لأول سؤال ، مثلا يوم يشغل الصوت

بتحط متغير للصوت

sound = playSound......... وتكملة الكود

ويود مثلا يجي يضغط الزر لازم تتحقق من الصوت موجود ولالا بالتحقق ذا

if sound then return end

كذا بيوقف الوظيفة لو الصوت شغال

_________________________________

بالنسبة لأيقاف الصوت جرب استعمل destroyElement

اما بالنسبة ل

playSFX 

ذي تشغل اصوات من االاصوات الي متوفرة من العبة الاصلية نفسها

ما انصحك تستعملها عشان ثلاث ارباع الناس معهم العبة المتهكرة وناقصة ملفات الصوت فـ الوظيفة ما راح تشتغل معهم عشان مامعهم ملفات الصوت

" I HATE GRAVITY " تسمع صوته يقول CJ وش قصدي بأصوات من العبة نفسها؟ قصدي يوم مثلا يطيح الاعب

والكثير من الاصوات ذي

  • Replies 85
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted
طيب شكرا اخوي بس وش اسم الوظيفة الي اقدر اتحقق لو الاغنيه شغاله مشان يوقفها

بالنسبة لأول سؤال ، مثلا يوم يشغل الصوت

بتحط متغير للصوت

sound = playSound......... وتكملة الكود

ويود مثلا يجي يضغط الزر لازم تتحقق من الصوت موجود ولالا بالتحقق ذا

if sound then return end

كذا بيوقف الوظيفة لو الصوت شغال

Posted
isElement 
destroyElement 

حط متغير للصوت

واتحقق فيه بالفنكشن الاول

وسوي له ازاله بالفنكشن الثانب

هذا لو شغلت الصوت مره ثانيه بيحذفه ويرجع يشغله

لاكن حقت حسون

اذا كان الصوت شغال مابسوي تكرار

Posted
playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 

روجوا انا سويت صوت لكن لازم اكون قريب منه جدا ما ينفع اخلي المسافه ابعد شوية؟

Posted
دابل احداثيات وش الي احطها؟

اول شيء يا صديقي

اسمها ارقمنتات

وليست احدثيات

اول واحد طالب عنصر الصوت اللي هو بيرجعه الفنكشن

playSound3D 

كيف تجيب عنصر الصوت اللي يرجعه الفنكشن؟ سوي له متغير او انشأه داخل الفنكشن

مثال

Sound = playSound3D("MP3.mp3", X, Y, Z) 
setSoundMaxDistance(Sound, 500) 

كذا اللي علي بعد 500 بيقدر يسمعه

بلتوفيق

Posted
addEventHandler("onClientGUIClick", root, 
function () 
     if ( source == GUIEditor.button[1] ) then 
     playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 207.10000610352, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 197.89999389648, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 217.80000305176, 1851.1999511719, 14.300000190735 ) 
     
      
      
      
     elseif ( source == GUIEditor.button[2] ) then 
     stopSound ( 1 ) 
      
      

هريستي :]

Posted
addEventHandler("onClientGUIClick", root, 
function () 
     if ( source == GUIEditor.button[1] ) then 
     playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 207.10000610352, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 197.89999389648, 1923.5, 19.299999237061 ) 
     playSound3D ( "music/1.mp3", 217.80000305176, 1851.1999511719, 14.300000190735 ) 
     
      
      
      
     elseif ( source == GUIEditor.button[2] ) then 
        stopSound(1) 
      
      

هريستي :]

اهنيك هديك لقب مستر هريس فاخر

     elseif ( source == GUIEditor.button[2] ) then 
         for Key, Value in ipairs(getElementsByType("sound", resourceRoot)) do 
            stopSound(Value) 
        end 

Posted

لازم تسوي تحقق للصوت عشان مايكرر + تسوي متغير للصوت

  
addEventHandler("onClientGUIClick",root, function() 
if (source == GUIEditor.button[1]  )then 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
elseif (source == GUIEditor.button[2]  )then 
stopSound (sound) 
end 
end) 
Posted
لازم تسوي تحقق للصوت عشان مايكرر + تسوي متغير للصوت

  
addEventHandler("onClientGUIClick",root, function() 
if (source == GUIEditor.button[1]  )then 
if isElement(sound) then stopSound (sound) end 
sound = playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
elseif (source == GUIEditor.button[2]  )then 
stopSound (sound) 
end 
end) 

زدت الهريسة هرس

:E

playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 )

playSound3D ( "music/1.mp3", 207.10000610352, 1923.5, 19.299999237061 )

playSound3D ( "music/1.mp3", 197.89999389648, 1923.5, 19.299999237061 )

playSound3D ( "music/1.mp3", 217.80000305176, 1851.1999511719, 14.300000190735 )

شوف هنا مغير احدثيات انت حطيت واحد بس ...

كلامك صحيح بلنسبة للتكرار بس ض1

Posted (edited)

ما تتوقف -_-

فزعه يا دبل دب ضض

ويا ريت ما تعطيني جاهز هات خليني اجرب لسه اتعلم انا

Edited by Guest
Posted
createObject ( 2232, 216.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 207.10000610352, 1923.5, 19.299999237061 ) 
createObject ( 2232, 197.89999389648, 1923.5, 19.299999237061 ) 
createObject ( 2232, 217.80000305176, 1851.1999511719, 14.300000190735 ) 
Marker = createMarker (209.08809,1921.75928,16.64063,"cylinder",1,235,155,26,55) 
  
  
GUIEditor = { 
    button = {}, 
    window = {} 
} 
  
        GUIEditor.window[1] = guiCreateWindow(496, 263, 236, 216, "الراديو", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
         guiSetVisible ( GUIEditor.window[1], false) 
  
        GUIEditor.button[1] = guiCreateButton(11, 37, 215, 45, "تشغيل الراديو", false, GUIEditor.window[1]) 
        GUIEditor.button[2] = guiCreateButton(10, 92, 215, 45, "ايقاف الراديو", false, GUIEditor.window[1]) 
        GUIEditor.button[3] = guiCreateButton(183, 175, 43, 31, "X", false, GUIEditor.window[1])     
   
addEventHandler("onClientMarkerHit", root, 
function (ss) 
if ( source == Marker ) and ( ss == localPlayer ) then 
guiSetVisible(GUIEditor.window[1],true) 
    showCursor(true) 
    end 
    end 
    ) 
     
addEventHandler("onClientGUIClick", root, 
function () 
     if ( source == GUIEditor.button[1] ) then 
    sa = playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
    da = playSound3D ( "music/1.mp3", 207.10000610352, 1923.5, 19.299999237061 ) 
    ra = playSound3D ( "music/1.mp3", 197.89999389648, 1923.5, 19.299999237061 ) 
    ka = playSound3D ( "music/1.mp3", 217.80000305176, 1851.1999511719, 14.300000190735 ) 
     setSoundMaxDistance(sa, 150) 
     setSoundMaxDistance(da, 150) 
     setSoundMaxDistance(ra, 150) 
     setSoundMaxDistance(ka, 150) 
      
         for Key, Value in ipairs(getElementsByType("1", resourceRoot)) do 
        stopSound(Value) 
    end 
     
      
      
      
     
      
      
     
      
     
     
      
      
      
  
      
      
      
     elseif ( source == GUIEditor.button[3] ) then 
    showCursor(false) 
    guiSetVisible(GUIEditor.window[1],false) 
    end 
    end 
    ) 
  

سوي لي لما يكبس الزر ما تتكرر الاغنيه لكن تعيد من الصفر ويا ريت ما تعقد الاكواد مشان افهمها

يلا بالله سريع بروح انام

Posted
addEventHandler("onClientGUIClick", root, 
function () 
    if ( source == GUIEditor.button[1] ) then 
        playSound3D ( "music/1.mp3", 216.10000610352, 1923.5, 19.299999237061 ) 
        playSound3D ( "music/1.mp3", 207.10000610352, 1923.5, 19.299999237061 ) 
        playSound3D ( "music/1.mp3", 197.89999389648, 1923.5, 19.299999237061 ) 
        playSound3D ( "music/1.mp3", 217.80000305176, 1851.1999511719, 14.300000190735 ) 
        for Key, Value in ipairs(getElementsByType("sound", resourceRoot)) do 
            setSoundMaxDistance(Value, 150) 
        end 
    elseif source == GUIEditor.button[2] then 
        for Key, Value in ipairs(getElementsByType("sound", resourceRoot)) do 
            stopSound(Value) 
        end 
    elseif ( source == GUIEditor.button[3] ) then 
        showCursor(false) 
        guiSetVisible(GUIEditor.window[1],false) 
    end 
end 
) 

جرب

Posted

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

ويا ريت تقول وش وظيفة

for+do انا لسه اتعلم

سلام نوم بكرة بشوف ردك وصلح لي انه لسه الصوت يتكرر وشكرا لك دب

Posted
صار يتوقف الصوت لكن الاغنيه تتكرر ابيه لما يضغط نفس الزر تعيد الاغنيه دون ما ينشىء اغنيه جديدة

ويا ريت تقول وش وظيفة

fod+do انا لسه اتعلم

سلام نوم بكرة بشوف ردك وصلح لي انه لسه الصوت يتكرر وشكرا لك دب

شوف رد اوسكار بتفهم الوضع

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