Advertisement
Guest User

Untitled

a guest
Jan 24th, 2012
872
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.41 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new TextToSpeech[MAX_PLAYERS];
  4.  
  5. public OnFilterScriptInit()
  6. {
  7.     print("\n--------------------------------------");
  8.     print(" Text-To-Speech by King_Hual");
  9.     print("--------------------------------------\n");
  10.     return 1;
  11. }
  12.  
  13. public OnFilterScriptExit()
  14. {
  15.     return 1;
  16. }
  17.  
  18. public OnPlayerText(playerid, text[])
  19. {
  20.         if (TextToSpeech[playerid] == 1)
  21.         {
  22.             new str[256];
  23.             StopAudioStreamForPlayer(playerid);
  24.             format(str,sizeof(str), "http://translate.google.com/translate_tts?q=%s", text);
  25.             PlayAudioStreamForPlayer(playerid, str);
  26.         }
  27.         return 1;
  28. }
  29.  
  30. public OnPlayerCommandText(playerid, cmdtext[])
  31. {
  32.     if (strcmp("/ttsstart", cmdtext, true, 10) == 0)
  33.     {
  34.         if (!TextToSpeech[playerid])
  35.         {
  36.             TextToSpeech[playerid] = 1;
  37.             SendClientMessage(playerid, 0xffff00ff, "Text-To-Speech activated. Type something.");
  38.         }
  39.         else
  40.         {
  41.             SendClientMessage(playerid, 0xff0000ff, "Text-To-Speech is already activated. Type /ttsstop to stop it.");
  42.         }
  43.         return 1;
  44.     }
  45.     if (strcmp("/ttsstop", cmdtext, true, 10) == 0)
  46.     {
  47.         if (TextToSpeech[playerid] == 1)
  48.         {
  49.             TextToSpeech[playerid] = 0;
  50.             SendClientMessage(playerid, 0xffff00ff, "Text-To-Speech stopped. Type /ttsstart to activate it again.");
  51.         }
  52.         else
  53.         {
  54.             SendClientMessage(playerid, 0xff0000ff, "Text-To-Speech is already stopped. Type /ttsstart to activate it.");
  55.         }
  56.         return 1;
  57.     }
  58.     return 0;
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement