Advertisement
Pablo_Borsellino

[Filterscript] pBeatbox v1.0

Oct 6th, 2011
558
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.74 KB | None | 0 0
  1. /****************************************************************** pBeatbox ***
  2. *
  3. * Scriptname:
  4. * -» pBeatBox
  5. *
  6. * Author:
  7. * -» Pablo_Borsellino
  8. *
  9. * Release Date:
  10. * -» 6th October 2011
  11. *
  12. * Version:
  13. * -» 1.0
  14. *
  15. * Need to use:
  16. * -» Sa:Mp 0.3c or higher
  17. *
  18. * Language:
  19. * -» English
  20. *
  21. * Description:
  22. * -» With this script you can beat boxing in Sa:Mp. You can hear the beatbox, if
  23. * -» your GTA San Andreas Audio Options are on and your headphones/speaker are
  24. * -» on. You have a choice of nine beats and a pause.
  25. *
  26. * Functions:
  27. * -» n/a
  28. *
  29. * Public's:
  30. * -» n/a
  31. *
  32. * Credit's:
  33. * -» Michael_Tempenny for help with the SCM Definition in ICQ!
  34. *
  35. *                                           Copyright © 2011 by Pablo_Borsellino
  36. *******************************************************************************/
  37.  
  38. //_____________________________________________________________________Include's
  39. #include <a_samp>
  40.  
  41. //_____________________________________________________________________Setting's
  42. #define pBEAT_BOX_MLEN  400         //Max. lenght for the Beat's
  43. #define pBEAT_BOX_TEXT  "BEATBOX:"  //Text, to write in Chat for Beatbox
  44. #define pBEAT_BOX_CASE   false       //Ignore Case for pBEAT_BOX_TEXT in Chat
  45.  
  46. //__________________________________________________________________Definition's
  47. #define SCM(%1) SendClientMessage(playerid,-1,%1)
  48.  
  49. //______________________________________________________________________Public's
  50. public OnPlayerText(playerid,text[])
  51. {
  52.     if(!strfind(text,pBEAT_BOX_TEXT,pBEAT_BOX_CASE,0))
  53.     {
  54.         new pBeatBox_Text[pBEAT_BOX_MLEN],pBeatBox_Beat[pBEAT_BOX_MLEN],pBeatBox_Lenght;
  55.         format(pBeatBox_Text,sizeof pBeatBox_Text,"%s",text);
  56.         strdel(pBeatBox_Text,0,strlen(pBEAT_BOX_TEXT));
  57.         pBeatBox_Lenght=strlen(pBeatBox_Text);
  58.         for(new i=0;i<pBeatBox_Lenght;i++)
  59.         {
  60.             if(pBeatBox_Lenght==0||(pBeatBox_Text[i]<'0'||pBeatBox_Text[i]>'9')&&pBeatBox_Text[i]!='.'&&pBeatBox_Text[i]!=' ')return ShowValidBeats(playerid);
  61.             if(pBeatBox_Text[i]=='0')strins(pBeatBox_Beat,"zk%20",strlen(pBeatBox_Beat),6);
  62.             else if(pBeatBox_Text[i]=='1')strins(pBeatBox_Beat,"bschk%20",strlen(pBeatBox_Beat),9);
  63.             else if(pBeatBox_Text[i]=='2')strins(pBeatBox_Beat,"pv%20",strlen(pBeatBox_Beat),6);
  64.             else if(pBeatBox_Text[i]=='3')strins(pBeatBox_Beat,"bk%20",strlen(pBeatBox_Beat),6);
  65.             else if(pBeatBox_Text[i]=='4')strins(pBeatBox_Beat,"tk%20",strlen(pBeatBox_Beat),6);
  66.             else if(pBeatBox_Text[i]=='5')strins(pBeatBox_Beat,"vk%20",strlen(pBeatBox_Beat),6);
  67.             else if(pBeatBox_Text[i]=='6')strins(pBeatBox_Beat,"kt%20",strlen(pBeatBox_Beat),6);
  68.             else if(pBeatBox_Text[i]=='7')strins(pBeatBox_Beat,"kttp%20",strlen(pBeatBox_Beat),8);
  69.             else if(pBeatBox_Text[i]=='8')strins(pBeatBox_Beat,"krp%20",strlen(pBeatBox_Beat),7);
  70.             else if(pBeatBox_Text[i]=='9')strins(pBeatBox_Beat,"pv%20",strlen(pBeatBox_Beat),6);
  71.             format(pBeatBox_Beat,sizeof pBeatBox_Beat,"%s",pBeatBox_Beat);
  72.         }
  73.         BeatBox(playerid,pBeatBox_Beat);
  74.         return false;
  75.     }
  76.     return true;
  77. }
  78.  
  79. //____________________________________________________________________Function's
  80. BeatBox(playerid,BeatBox_Beat[])
  81. {
  82.     new pBeatBox_Lenght=strlen(BeatBox_Beat),pBeatBox_Text[pBEAT_BOX_MLEN+70];
  83.     for(new i=0;i<pBeatBox_Lenght;i++)
  84.         if(BeatBox_Beat[i]==' ')strdel(BeatBox_Beat,i,i+1);
  85.     format(pBeatBox_Text,sizeof pBeatBox_Text,"http://translate.google.com/translate_tts?ie=UTF-8&q=%s&tl=de&format=bb",BeatBox_Beat);
  86.     PlayAudioStreamForPlayer(playerid,pBeatBox_Text,0,0,0,0,0);
  87.     return 1;
  88. }
  89.  
  90. ShowValidBeats(playerid)
  91. {
  92.     SCM(#"{"#FFFF00"}""[Beat 0] "#"{"#FF9933"}""\"0\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Suspended Cymbal\"");
  93.     SCM(#"{"#FFFF00"}""[Beat 1] "#"{"#FF9933"}""\"1\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Snare\"");
  94.     SCM(#"{"#FFFF00"}""[Beat 2] "#"{"#FF9933"}""\"2\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Brush\"");
  95.     SCM(#"{"#FFFF00"}""[Beat 3] "#"{"#FF9933"}""\"3\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Bass\"");
  96.     SCM(#"{"#FFFF00"}""[Beat 4] "#"{"#FF9933"}""\"4\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Flam\"");
  97.     SCM(#"{"#FFFF00"}""[Beat 5] "#"{"#FF9933"}""\"5\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Roll Tap\"");
  98.     SCM(#"{"#FFFF00"}""[Beat 6] "#"{"#FF9933"}""\"6\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Flam\"");
  99.     SCM(#"{"#FFFF00"}""[Beat 7] "#"{"#FF9933"}""\"7\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Hi Hat Tap\"");
  100.     SCM(#"{"#FFFF00"}""[Beat 8] "#"{"#FF9933"}""\"8\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Short Roll\"");
  101.     SCM(#"{"#FFFF00"}""[Beat 9] "#"{"#FF9933"}""\"9\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Hi Hat\"");
  102.     SCM(#"{"#FFFF00"}""[Beat 10] "#"{"#FF9933"}""\".\" "#"{"#33AA33"}""»»» for »»» "#"{"#FF9933"}""\"Short Break\"");
  103.     return true;
  104. }
  105.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement