Guest Posted December 15, 2018 Share Posted December 15, 2018 السلام عليكم ورحمة الله تعآلى وبركاتهه .. كيفكم عساكم بخير الحين انا سويت شيء تمام ابي الصوت يظهر للكل , كل الي لقيتها من playSound playSound3D كلها كلنت , ياريت الي يعرف لا يبخل . Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 (edited) triggerClientEvent -- استخدم ترايقر عشان تحول كل اللاعبين لكلنت وتشغلهم الصوت triggerClientEvent( players, eventName, players, [optional]soundPath ) -- بهذي الصيغة ----- سيرفر ------- function playSound ( player, soundPath, loop ) if isElement(player) and getElementType(player) == "player" then if type(soundPath) == "string" then triggerClientEvent(player, "onPlaySound", player, soundPath, loop) else return false end else return false end end function playSoundForPlayers(soundPath, loop) local players = getElementsByType("player") for _, player in ipairs ( players ) do playSound( player, soundPath, loop ) end end ----- كلنت ----- addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(source, soundPath, loop) else playSound(source, soundPath) end end ) Edited December 15, 2018 by NX_CI Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 32 minutes ago, NX_CI said: triggerClientEvent -- استخدم ترايقر عشان تحول كل اللاعبين لكلنت وتشغلهم الصوت triggerClientEvent( players, eventName, players, [optional]soundPath ) -- بهذي الصيغة ----- سيرفر ------- function playSound ( player, soundPath, loop ) if isElement(player) and getElementType(player) == "player" then if type(soundPath) == "string" then triggerClientEvent(player, "onPlaySound", player, soundPath, loop) else return false end else return false end end function playSoundForPlayers(soundPath, loop) local players = getElementsByType("player") for _, player in ipairs ( players ) do playSound( player, soundPath, loop ) end end ----- كلنت ----- addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(source, soundPath, loop) else playSound(source, soundPath) end end ) الحين أبي لو اضغط زر ع طول , !_!. تجي اغنية. Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 فهمت يعني تبي تضغط زر وتشغل لكل اللاعبين sounds={} function playSound ( player, soundPath, loop ) if isElement(player) and getElementType(player) == "player" then if type(soundPath) == "string" then triggerClientEvent(player, "onPlaySound", player, soundPath, loop) else return false end else return false end end function playSoundForPlayers(soundPath) local players = getElementsByType("player") for _, player in ipairs ( players ) do playSound( player, soundPath ) end end addEvent("triggerServer",true) addEventHandler("triggerServer", root, function(soundPath) playSoundForPlayers(soundPath) end ) ----- كلنت ----- addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(source, soundPath, loop) else playSound(source, soundPath) end end ) function onClickButton() if source == GUIEditor.button[1] then -- بدل اسم الزر للزر اللي عندك soundPath = "example.mp3" -- مسار الصوت يوم تضغط على الزر triggerServerEvent("triggerServer", localPlayer, soundPath) end ) addEventHandler("onClientGUIClick", root, onClickButton) Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 1 hour ago, NX_CI said: فهمت يعني تبي تضغط زر وتشغل لكل اللاعبين sounds={} function playSound ( player, soundPath, loop ) if isElement(player) and getElementType(player) == "player" then if type(soundPath) == "string" then triggerClientEvent(player, "onPlaySound", player, soundPath, loop) else return false end else return false end end function playSoundForPlayers(soundPath) local players = getElementsByType("player") for _, player in ipairs ( players ) do playSound( player, soundPath ) end end addEvent("triggerServer",true) addEventHandler("triggerServer", root, function(soundPath) playSoundForPlayers(soundPath) end ) ----- كلنت ----- addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(source, soundPath, loop) else playSound(source, soundPath) end end ) function onClickButton() if source == GUIEditor.button[1] then -- بدل اسم الزر للزر اللي عندك soundPath = "example.mp3" -- مسار الصوت يوم تضغط على الزر triggerServerEvent("triggerServer", localPlayer, soundPath) end ) addEventHandler("onClientGUIClick", root, onClickButton) سلمت يمناك يا بطل , ! Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 10 minutes ago, *AnGeL said: سلمت يمناك يا بطل , ! الله يسلمك , كويس انه اشتغل انا ماجربته Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 1 minute ago, NX_CI said: الله يسلمك , كويس انه اشتغل انا ماجربته لسه ما جربته ههه : ) Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 Just now, *AnGeL said: لسه ما جربته ههه : ) جربه و اذا فيه خطأ قلي Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 1 minute ago, NX_CI said: الله يسلمك , كويس انه اشتغل انا ماجربته addEventHandler("onPlayerChat", root , function () if type == 0 then cancelEvent() end) صحيح ؟ Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 3 minutes ago, *AnGeL said: addEventHandler("onPlayerChat", root , function () if type == 0 then cancelEvent() end) صحيح ؟ type == 0 Wrong ! type مش معرفة الـ addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end) 1 Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 Just now, NX_CI said: type == 0 Wrong ! type مش معرفة الـ addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end) , تسلم + WARNING: Test\Client.lua:44: Bad argument @ 'playSound' [Expected string at argument 1, got player] ذا جاني بعد ما سويت كودك وسويت كلشيء . 2 minutes ago, NX_CI said: type == 0 Wrong ! type مش معرفة الـ addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end) addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end) --- ما ضبط , يجيني أكتب عادي !! Link to comment
SycroX Posted December 15, 2018 Share Posted December 15, 2018 3 minutes ago, *AnGeL said: WARNING: Test\Client.lua:44: Bad argument @ 'playSound' [Expected string at argument 1, got player] ورينا السطر Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 1 minute ago, #x1AhMeD-09 said: ورينا السطر playSound(source, soundPath) Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 الخطأ في الكلنت تحديدا هنا استبدل ذي بالسابقة addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(soundPath, loop) else playSound(soundPath) end end ) 8 minutes ago, *AnGeL said: , تسلم + WARNING: Test\Client.lua:44: Bad argument @ 'playSound' [Expected string at argument 1, got player] ذا جاني بعد ما سويت كودك وسويت كلشيء . addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end) --- ما ضبط , يجيني أكتب عادي !! انت حاط كود الشات في السيرفر ولا كلنت ؟ و عندك خطأ فيه اند ناقصه Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 2 minutes ago, NX_CI said: الخطأ في الكلنت تحديدا هنا استبدل ذي بالسابقة addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(soundPath, loop) else playSound(soundPath) end end ) تمام إشتغلت يعطيك العافية أسوي كذا لو ابي اطفي الصوت ؟ addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then stopSound(soundPath, loop) else stopSound(soundPath) end end ) 2 minutes ago, NX_CI said: الخطأ في الكلنت تحديدا هنا استبدل ذي بالسابقة addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(soundPath, loop) else playSound(soundPath) end end ) ++ حقت الشات ما زبطت : ( addEventHandler("onPlayerChat", root , function (_, type) if type == 0 then cancelEvent() end end ) Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 اذا تبي تطفي الصوت قلك stopSound( sound ) لازم تحط بدال sound الصوت نفسه اللي تبي تطفيه يعني استخدم المتغيرات playSound حط متغير للـ Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 3 minutes ago, NX_CI said: الخطأ في الكلنت تحديدا هنا استبدل ذي بالسابقة addEvent("onPlaySound", true) addEventHandler("onPlaySound", root, function(soundPath, loop) if loop ~= nil and type(loop) ~= "string" then playSound(soundPath, loop) else playSound(soundPath) end end ) انت حاط كود الشات في السيرفر ولا كلنت ؟ و عندك خطأ فيه اند ناقصه ضايفهم ومسوي الكود في السيرفر ..... وجربته في الكلنت برضو ما ضبط Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 الحدث للسيرفر حبيبي مو للكلنت تأكد من ملف الميتا انك حاطه سيرفر جرب كذا function cancelNormalChat( _, messageType ) if type ( messageType ) == 0 then cancelEvent(true) end end addEventHandler("onPlayerChat", root, cancelNormalChat) Link to comment
Guest Posted December 15, 2018 Share Posted December 15, 2018 2 minutes ago, NX_CI said: اذا تبي تطفي الصوت قلك stopSound( sound ) لازم تحط بدال sound الصوت نفسه اللي تبي تطفيه يعني استخدم المتغيرات playSound حط متغير للـ function stopSound ( player, soundPath, loop ) if isElement(player) and getElementType(player) == "player" then if type(sound) == "string" then triggerClientEvent(player, "onStopSound", player, sound, loop) else return false end else return false end end -- تجي كذآ ؟ , -- تعال خاص أحسن .. Link to comment
nxFairlywell Posted December 15, 2018 Share Posted December 15, 2018 انت جبت العيد لول تعال خاص 16 minutes ago, NX_CI said: الحدث للسيرفر حبيبي مو للكلنت تأكد من ملف الميتا انك حاطه سيرفر جرب كذا function cancelNormalChat( _, messageType ) if type ( messageType ) == 0 then cancelEvent(true) end end addEventHandler("onPlayerChat", root, cancelNormalChat) الخطأ هنا ان if type (messageType) == 0 then لازم تتعدل لـ if messageType == 0 then Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now