Jump to content

[Help] PlaySound


Recommended Posts

Posted (edited)

السلام عليكم

ممكن مساعده ي شباب

انا ابي اسوي

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

اتمنى تساعدوني وشكرا ?

الي اعرف اني لازم اسوي

sounds = {
	{"song.mp3"},
	{"song2.mp3"},
	{"song3.mp3"},
},

-- الكود الي هنا وش اكتب

 

Edited by salh
Posted
9 minutes ago, salh said:

السلام عليكم

ممكن مساعده ي شباب

انا ابي اسوي

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

اتمنى تساعدوني وشكرا ?

الي اعرف اني لازم اسوي


sounds = {
	{"song.mp3"},
	{"song2.mp3"},
	{"song3.mp3"},
},

-- الكود الي هنا وش اكتب

 

function start()
		local x,y,z = -- حط الاحداثيات الي تبي يكون فيها الصوت
		local soundName = sounds[math.random(1, #sounds)][1]
		sound = playSound3D(soundName, x, y, z, true) 
		setSoundMaxDistance(sound, 25)
		setSoundVolume(sound, 20.0)
		outputChatBox(""..soundName.." : تم تشغيل",0,255,0,true)
end

setTimer(function()
	if ( isElement ( sound ) ) then return end
		start()
end,1000,0)

 

جرب وقولي اذا اشتغل او لا

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted (edited)

لا ابي الصوت يجي للكل

10 minutes ago, Mr.Mostafa said:

function start()
		local x,y,z = -- حط الاحداثيات الي تبي يكون فيها الصوت
		local soundName = sounds[math.random(1, #sounds)][1]
		sound = playSound3D(soundName, x, y, z, true) 
		setSoundMaxDistance(sound, 25)
		setSoundVolume(sound, 20.0)
		outputChatBox(""..soundName.." : تم تشغيل",0,255,0,true)
end

setTimer(function()
	if ( isElement ( sound ) ) then return end
		start()
end,1000,0)

 

جرب وقولي اذا اشتغل او لا

ابي الصوت يجي للكل

debug say : ERROR": Loading script feiled "(" expected neer "start"

حليت الخطاء

 

sounds = {
	{"song.mp3"},
},

setTimer(function()
	if ( isElement ( sound ) ) then return end
		local x,y,z = -707.91315, 960.46075, 12.47598
		local soundName = sounds[math.random(1, #sounds)][1]
		sound = playSound3D(soundName, x, y, z, true) 
		setSoundMaxDistance(sound, 25)
		setSoundVolume(sound, 20.0)
		outputChatBox(""..soundName.." : تم تشغيل",0,255,0,true)
end,1000,0)

 

Edited by salh
Posted
1 hour ago, salh said:

لا ابي الصوت يجي للكل

ابي الصوت يجي للكل

debug say : ERROR": Loading script feiled "(" expected neer "start"

حليت الخطاء

 


sounds = {
	{"song.mp3"},
},

setTimer(function()
	if ( isElement ( sound ) ) then return end
		local x,y,z = -707.91315, 960.46075, 12.47598
		local soundName = sounds[math.random(1, #sounds)][1]
		sound = playSound3D(soundName, x, y, z, true) 
		setSoundMaxDistance(sound, 25)
		setSoundVolume(sound, 20.0)
		outputChatBox(""..soundName.." : تم تشغيل",0,255,0,true)
end,1000,0)

 

استخدم الترايقر

Posted
triggerServerEvent
triggerClientEvent
35 minutes ago, salh said:

حق وش؟

 

1 hour ago, salh said:

},

عندكـ , زايدة .

Posted
--server side
sounds = {
	{"song.mp3"},
	{"song2.mp3"},
	{"song3.mp3"}
}

addEvent("playrandom",true)
addEventHandler("playrandom",root,function()
    	ra=math.random(#sounds)
    	file=sounds[ra]
    	filename=split(file,".")[1]
    	outputChatBox("the file will played is "..filename,root,255,255,255,true)
    	triggerClientEvent(root,"playthesound",root,file)
    end)
--client
addEvent("playthesound",true)
addEventHandler("playthesound",root,function(file)
    if(sound and isElement(sound)) then destroyElement(sound) end
    sound=playSound(file)
   	length_s=getSoundLength(sound)
    setTimer(function()
        triggerServerEvent("playrandom",localPlayer)
      end,((length_s*1000 > 50 and length_s*1000) or 50),1)
    end)

بالتوفيق
@salh

  • Like 1

________________

My new Script Log Admin :

حصريا : لوق او حفظ سجيلات السيرفر : الموضوع

Be optimistic and you will succeed
______________________________________

 

Posted
Just now, N3xT said:

sound=playSound(file)

أها م شفتها,

مأثر علي الصيام للحين ذذ .

 

Posted
1 hour ago, TOUNSI |, السعأدة said:

--server side
sounds = {
	{"song.mp3"},
	{"song2.mp3"},
	{"song3.mp3"}
}

addEvent("playrandom",true)
addEventHandler("playrandom",root,function()
    	ra=math.random(#sounds)
    	file=sounds[ra]
    	filename=split(file,".")[1]
    	outputChatBox("the file will played is "..filename,root,255,255,255,true)
    	triggerClientEvent(root,"playthesound",root,file)
    end)
--client
addEvent("playthesound",true)
addEventHandler("playthesound",root,function(file)
    if(sound and isElement(sound)) then destroyElement(sound) end
    sound=playSound(file)
   	length_s=getSoundLength(sound)
    setTimer(function()
        triggerServerEvent("playrandom",localPlayer)
      end,((length_s*1000 > 50 and length_s*1000) or 50),1)
    end)

بالتوفيق
@salh

X ماتحس ان فيه مشكلة ؟ X

الكود كيف يشتغل !؟ ومتى 

Discord ID : nxFairlywell#6895

 

Posted

--server side

addEventHandler ( "onResourceStart" , resourceRoot , function ( ) 
		triggerEvent("playrandom",root)
	end
) 

sounds = {
	{"song.mp3"},
	{"song2.mp3"},
	{"song3.mp3"}
}

addEvent("playrandom",true)
addEventHandler("playrandom",root,function()
    	ra=math.random(#sounds)
    	file=sounds[ra]
    	filename=split(file,".")[1]
    	outputChatBox("the file will played is "..filename,root,255,255,255,true)
    	triggerClientEvent(root,"playthesound",root,file)
    end)
--client
addEvent("playthesound",true)
addEventHandler("playthesound",root,function(file)
    if(sound and isElement(sound)) then destroyElement(sound) end
    sound=playSound(file)
   	length_s=getSoundLength(sound)
    setTimer(function()
        triggerServerEvent("playrandom",localPlayer)
      end,((length_s*1000 > 50 and length_s*1000) or 50),1)
    end)

 

330xum0.jpg

p_862d3zvf1.png

* تم آلآفتتآح مرة اخري , حياكم الله *

ip : * mtasa://145.239.212.62:22003 *

330xum0.jpg

Posted

خطأ ماراح تضبط , كثير مرات حطيت روت بالترايقر وماضبط

getElementsByType("player") لازم تسوي لوب لـ

Discord ID : nxFairlywell#6895

 

Posted

ما فهمتو موضوع الرجال انتم هو قال يبي اول مرة يجي صوت عشوائي

بعدين يشتغل اللي بعده

والي بعده

يعني الي ما اشتغلو يشتغلو غير الي اشتغل اول شي

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

Posted
11 minutes ago, NX_CI said:

يب لكن جربها : ) ما اتوقع تقدر تسوي ترايقر للروت , انا جربتها عدة مرات ماضبطت معي

تقدر، يمكن انت مسوي شي غلط

و اقرأ الرابط الي عطيتك اياه عشان تفهم

Posted
2 hours ago, NX_CI said:

يب لكن جربها : ) ما اتوقع تقدر تسوي ترايقر للروت , انا جربتها عدة مرات ماضبطت معي

تقدر

 

 

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