Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- new TextToSpeech[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Text-To-Speech by King_Hual");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if (TextToSpeech[playerid] == 1)
- {
- new str[256];
- StopAudioStreamForPlayer(playerid);
- format(str,sizeof(str), "http://translate.google.com/translate_tts?q=%s", text);
- PlayAudioStreamForPlayer(playerid, str);
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/ttsstart", cmdtext, true, 10) == 0)
- {
- if (!TextToSpeech[playerid])
- {
- TextToSpeech[playerid] = 1;
- SendClientMessage(playerid, 0xffff00ff, "Text-To-Speech activated. Type something.");
- }
- else
- {
- SendClientMessage(playerid, 0xff0000ff, "Text-To-Speech is already activated. Type /ttsstop to stop it.");
- }
- return 1;
- }
- if (strcmp("/ttsstop", cmdtext, true, 10) == 0)
- {
- if (TextToSpeech[playerid] == 1)
- {
- TextToSpeech[playerid] = 0;
- SendClientMessage(playerid, 0xffff00ff, "Text-To-Speech stopped. Type /ttsstart to activate it again.");
- }
- else
- {
- SendClientMessage(playerid, 0xff0000ff, "Text-To-Speech is already stopped. Type /ttsstart to activate it.");
- }
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement