ConvertTextToSpeech: Difference between revisions
Jump to navigation
Jump to search
Hassan saad (talk | contribs) (this function is convert any word to sound) |
Hassan saad (talk | contribs) m (Hassan saad moved page Useful Functions/convertWordsToSound to Multi Theft Auto: Wiki:Useful Functions/convertWordsToSound) |
Revision as of 21:52, 24 August 2014
* convertWordsToSound
- only Server Side
- Author: Has[S]oN
Syntax:
convertWordsToSound(string text)
Required Arguments:
- text: the Text you want to convert it from word to sound
Code:
--Server Side function convertWordsToSound(str) local str2 = "" str2 = "http://translate.google.com/translate_tts?tl=en&q="..str.."" triggerClientEvent(source,"VoiceClient",source,str2) end --Client Side function sayVoice(str) currentVoice = playSound(str) end addEvent("VoiceClient",true) addEventHandler("VoiceClient",localPlayer,sayVoice)
Example:
Server Side:
function convertWordsToSound(str) local str2 = "" str2 = "http://translate.google.com/translate_tts?tl=en&q="..str.."" triggerClientEvent(source,"VoiceClient",source,str2) end addEventHandler("onPlayerChat",root, function (messag) convertWordsToSound(messag) end)
Client Side:
function sayVoice(str) currentVoice = playSound(str) end addEvent("VoiceClient",true) addEventHandler("VoiceClient",localPlayer,sayVoice)
Of course the function Very clear from his name convert any word to sound
For do the function work with arabic please replace
str2 = "http://translate.google.com/translate_tts?tl=en&q="..str..""
to
str2 = "http://translate.google.com/translate_tts?tl=ar&q="..str..""
thx and sorry for bad english :)