Jump to content

playSound3D مساعده في


Recommended Posts

حاب اضيف روابط تانيه يعني لما تخلص الأغنيه الأولى تشتغل الأغنيه التانيه ولما يخلص يرجع من الأول 

كود 

function onResourceStart()
    sound = playSound3D('https://g.top4top.io/m_1598i8jrg1.mp3', 144.89999, -1939.3, 3.5) 
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

وشكرا

 

Link to comment
local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
}

local song_N = 1

function isSoundFinished(theSound)
    return ( getSoundPosition(theSound) == getSoundLength(theSound) )
end

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5) 
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound)
	if isSoundFinished(sound) and isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5) 
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
		end
	end
end
setTimer(next_s,3000,0,song_N,sound)

جرب و قولي لاني ما جربت

Link to comment
5 minutes ago, xBeSoOo_ said:

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
}

local song_N = 1

function isSoundFinished(theSound)
    return ( getSoundPosition(theSound) == getSoundLength(theSound) )
end

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5) 
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound)
	if isSoundFinished(sound) and isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5) 
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
		end
	end
end
setTimer(next_s,3000,0,song_N,sound)

جرب و قولي لاني ما جربت

أفضل شي يكون التايمر بطول الصوت الي بيشغله

أحسن من أنه يتأكد من وجود صوت كل ٣ ثواني

Link to comment
11 minutes ago, Abdul KariM said:

أفضل شي يكون التايمر بطول الصوت الي بيشغله

أحسن من أنه يتأكد من وجود صوت كل ٣ ثواني

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
}

local song_N = 1

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5)
	timerLen = 1000*getSoundLength(sound)
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound,timerLen)
	if isElement(sound) then
		if song_N ~= #song then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		end
	end
end
setTimer(next_s,timerLen,0,song_N,sound,timerLen)

من عيوني ??❤️

Edited by xBeSoOo_
Link to comment
13 minutes ago, xBeSoOo_ said:

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
}

local song_N = 1

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5)
	timerLen = 1000*getSoundLength(sound)
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound,timerLen)
	if isElement(sound) then
		if song_N ~= #song then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		end
	end
end
setTimer(next_s,timerLen,0,song_N,sound,timerLen)

من عيوني ??❤️

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

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local song_N = 1

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5)
	timerLen = 1000*getSoundLength(sound)
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound,timerLen)
	if isElement(sound) then
		if song_N ~= #song then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		end
	end
end
setTimer(next_s,timerLen,0,song_N,sound,timerLen)

 

Link to comment

كان فيه شي انا كاتبه غلط , نأسف علي الحشيش

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local song_N = 1

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5)
	timerLen = 1000*getSoundLength(sound)
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound,timerLen)
	if isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		end
	end
end
setTimer(next_s,timerLen,0,song_N,sound,timerLen)

 

Edited by xBeSoOo_
Link to comment
10 minutes ago, xBeSoOo_ said:

طيب جرب الكود الاول و قولي عشان اعرف وين المشكلة

نفس المشكل سويته كذا و شتغلت الأغنيه الأولى فقط 

local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local song_N = 1

function isSoundFinished(theSound)
    return ( getSoundPosition(theSound) == getSoundLength(theSound) )
end

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5) 
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound)
	if isSoundFinished(sound) and isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5) 
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
		end
	end
end
setTimer(next_s,3000,0,song_N,sound)

 

Link to comment
2 minutes ago, MMZ said:

نفس المشكل سويته كذا و شتغلت الأغنيه الأولى فقط 


local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local song_N = 1

function isSoundFinished(theSound)
    return ( getSoundPosition(theSound) == getSoundLength(theSound) )
end

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5) 
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound)
	if isSoundFinished(sound) and isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5) 
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
		end
	end
end
setTimer(next_s,3000,0,song_N,sound)

 

لحظة بجرب انا

Link to comment
56 minutes ago, xBeSoOo_ said:

كان فيه شي انا كاتبه غلط , نأسف علي الحشيش


local sounds = {
--[["sound download link"]]
'https://g.top4top.io/m_1598i8jrg1.mp3',
'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local song_N = 1

function onResourceStart()
    sound = playSound3D(sounds[1], 144.89999, -1939.3, 3.5)
	timerLen = 1000*getSoundLength(sound)
  	setElementDimension(sound,0)
  	setSoundMaxDistance(sound, 100)
end
addEventHandler("onClientResourceStart", resourceRoot, onResourceStart)

addCommandHandler("sound", function ()
    if isElement(sound) then
        destroyElement(sound)
		outputChatBox("تم اقاف الأغاني")
    end
end)

function next_s(song_N,sound,timerLen)
	if isElement(sound) then
		if song_N ~= #sounds then
			song_N = song_N +1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		else
			song_N = 1
			sound = playSound3D(sounds[song_N], 144.89999, -1939.3, 3.5)
			timerLen = 1000*getSoundLength(sound)
		end
	end
end
setTimer(next_s,timerLen,0,song_N,sound,timerLen)

 

الخطأ غالبا بسبب انك مررت الأرقمنتات في التايمر اخر سطر

Edited by RocKyz
Link to comment
59 minutes ago, RocKyz said:

الخطأ غالبا بسبب انك مررت الأرقمنتات في التايمر اخر سطر

حرفيا سويت كل شئ شلت الارقمنتات من التايمر ورجعت خليت التايمر بوقت وشيلت التايمر

ودايم يجيب ذا الخطئ  في الدي بج

client.Lua:10:Bad 'sound/player' pointer @ 'getSoundLenth'(1)
client.Lua:10:Bad 'sound/player' pointer @ 'getSoundPosition'(1)

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

  • Thanks 1
Link to comment
2 hours ago, xBeSoOo_ said:

حرفيا سويت كل شئ شلت الارقمنتات من التايمر ورجعت خليت التايمر بوقت وشيلت التايمر

ودايم يجيب ذا الخطئ  في الدي بج


client.Lua:10:Bad 'sound/player' pointer @ 'getSoundLenth'(1)
client.Lua:10:Bad 'sound/player' pointer @ 'getSoundPosition'(1)

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

مدري والله

Link to comment

تأكد انك موجود بنفس الاحداثيات

sound_position x

sound_position y

sound_position z

local links = {
	'https://g.top4top.io/m_1598i8jrg1.mp3',
	'https://a.top4top.io/m_1592i0ypt1.mp3',
}

local Sound_Element;
local Link_Counter = 1;
local sound_position = {
	x=144.89999,
	y=-1939.3,
	z=3.5
};

function HandleEventResourceStart()
	Sound_Element = playSound3D(links[Link_Counter], sound_position.x,sound_position.y,sound_position.z);
	setSoundMaxDistance(Sound_Element,100);
	outputChatBox("تم تشغيل الرابط : "..links[Link_Counter]);
end

function HandleEventSoundStopped(why)
	if (source == Sound_Element) then
		if (why == "finished") then
			Link_Counter = Link_Counter + 1;
			if (Link_Counter > #sound_position) then
				Link_Counter = 1;
			end
			Sound_Element = playSound3D(links[Link_Counter],sound_position.x,sound_position.y,sound_position.z);
			setSoundMaxDistance(Sound_Element,100);
			outputChatBox("تم تشغيل الرابط : "..links[Link_Counter]);
		end
	end
end

addEventHandler("onClientResourceStart",resourceRoot,HandleEventResourceStart);
addEventHandler("onClientSoundStopped",root,HandleEventSoundStopped);

 

Edited by VenomNX
Link to comment
local Urls,Pos,Count = { 
[1] = "https://a.top4top.io/m_533qy3r01.mp3",
[2] = "https://e.top4top.io/m_5316airh4.mp3",
},{144.89999, -1939.3, 3.5},0 

refreshSound = function ( State )
if ( eventName == "onClientSoundStopped" and source == Sound and State ~= "finished" ) then return end 
if ( Count >= #Urls ) then Count = 0 end 
Count = Count + 1 
Sound = playSound3D ( Urls[Count] , Vector3(unpack(Pos)) ) ; 
setSoundMaxDistance (Sound,100)
outputChatBox("now playing: "..Count)
end
addEventHandler("onClientResourceStart",resourceRoot,refreshSound)
addEventHandler("onClientSoundStopped",resourceRoot,refreshSound)

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

 

Link to comment
12 hours ago, -Ilker. said:

استخدم حدث onClientSoundStopped

بدل التايمر

 

7 hours ago, #\_oskar_/# said:

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

ويجيب لك طول مدة الاغنيه يعني ممكن يفيدك 

 

مشكورين شباب ما دريت عن الايڤنتات ذي 

والله الواحد يستفيد حتي وهو يحاول يساعد ?❤️

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