AR/playSound: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} Creates a sound element and plays it immediately after creation for the local player.<br /> <br /> '''Note:''' The only supported audio formats...")
 
(22 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Client function}}
{{Client function}}
Creates a [[sound]] element and plays it immediately after creation for the local player.<br />
.هذه الوظيفة تصنع صوتاً وتشغله فوراً بعد الصنع
<br />
 
'''Note:''' The only supported audio formats are MP3, WAV, OGG, RIFF, MOD, XM, IT and S3M.
MP3 و WAV و OGG و RIFF و MOD و XM و IT و S3M :الصيغات المدعومة هي التالي :t'''ملاحظة'''


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">element playSound ( string soundPath, [ bool looped = false ] )</syntaxhighlight>  
<syntaxhighlight lang="lua">element playSound ( string soundPath, [ bool looped = false ] )</syntaxhighlight>  


===Required Arguments===  
===العناصر المطلوبة===  
*'''soundPath:''' The [[filepath]] to the sound file you want to play. (Sound file has to be predefined in the [[meta.xml]] file with <file /> tag.)
*'''soundPath:''' ايضاً يمكنك وضع رابط صوت بدلاً من مسار الملف .<file /> بشعار [[meta.xml]] ملف الصوت يجب ان يكون معرف في ملف) t.مسار ملف الصوت الذي تريد تشغيله


===Optional Arguments===  
===Optional Arguments===  
{{OptionalArg}}  
{{OptionalArg}}  
*'''looped:''' A [[boolean]] representing whether the sound will be looped. To loop the sound, use ''true''. Loop is not available for streaming sounds, only for sound files.
*'''looped:''' ([[Boolean]]) false او true هذه الخاصية تتمثل في سواء اكان الصوت متكرر او لا باستخدام


===Returns===
===Returns===
Returns a [[sound]] element if the sound was successfully created, ''false'' otherwise.
اذا لم يتم صنع الصوت بنجاح false تنتج صوتاً اذا تم صنع الصوت بنجاح, أو تنتج


==Example==  
=='''مثــال'''==  
<section name="Client" class="client" show="true">
<section name="Client" class="client" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function wasted (killer, weapon, bodypart)  
function wasted (killer, weapon, bodypart)  
local sound = playSound("sounds/wasted.mp3") --Play wasted.mp3 from the sounds folder
local sound = playSound("sounds/wasted.mp3") -- wasted.mp3 نشغل الصوت - sounds من مجلد اسمه
setSoundVolume(sound, 0.5) -- set the sound volume to 50%
        setSoundVolume(sound, 0.5) -- 50% نجعل حجم الصوت
end
end


addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted) --add the event handler
addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted) -- نضع الايفنت الى هذه الوظيفه عند موت الاعب
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>
Line 32: Line 32:
==أنظر أيضاً==
==أنظر أيضاً==
{{AR/Audio_functions}}
{{AR/Audio_functions}}
==See Also==
{{Client_audio_functions}}
[[EN:playSound]]
[[DE:playSound]]

Revision as of 01:45, 6 November 2013

.هذه الوظيفة تصنع صوتاً وتشغله فوراً بعد الصنع

MP3 و WAV و OGG و RIFF و MOD و XM و IT و S3M :الصيغات المدعومة هي التالي :tملاحظة

Syntax

element playSound ( string soundPath, [ bool looped = false ] )

العناصر المطلوبة

  • soundPath: ايضاً يمكنك وضع رابط صوت بدلاً من مسار الملف .<file /> بشعار meta.xml ملف الصوت يجب ان يكون معرف في ملف) t.مسار ملف الصوت الذي تريد تشغيله

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • looped: (Boolean) false او true هذه الخاصية تتمثل في سواء اكان الصوت متكرر او لا باستخدام

Returns

اذا لم يتم صنع الصوت بنجاح false تنتج صوتاً اذا تم صنع الصوت بنجاح, أو تنتج

مثــال

Click to collapse [-]
Client
function wasted (killer, weapon, bodypart) 
	local sound = playSound("sounds/wasted.mp3") -- wasted.mp3 نشغل الصوت - sounds من مجلد اسمه	
        setSoundVolume(sound, 0.5) -- 50% نجعل حجم الصوت
end

addEventHandler("onClientPlayerWasted", getLocalPlayer(), wasted) -- نضع الايفنت الى هذه الوظيفه عند موت الاعب

أنظر أيضاً


See Also