GustavoAraujo

(Pawn) MusicStreamByName

Aug 24th, 2014
349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.80 KB | None | 0 0
  1. #include <a_http>
  2.  
  3. forward PlayAudioStreamByName(playerid, name[]);
  4. forward PlayAudioStreamByNameEx(index, response_code, data[]);
  5.  
  6. public PlayAudioStreamByName(playerid, name[])
  7. {
  8.     for(new i; i < strlen(name); i++) {
  9.         if(name[i] == ' ') name[i] = '+';
  10.     }
  11.     new str[160];
  12.     format(str, 160, "127.0.0.1:8080/SAMP.php?q=%s", name);
  13.     HTTP(playerid, HTTP_GET, str, "", "PlayAudioStreamByNameEx");
  14.     return 1;
  15. }
  16.  
  17. public PlayAudioStreamByNameEx(index, response_code, data[])
  18. {
  19.     if(response_code == 200) return PlayAudioStreamForPlayer(index, data);
  20.     return 1;
  21. }
  22. CMD:tocar(playerid, params[])
  23. {
  24.     new M[20];
  25.     if(sscanf(params, "s[50]", M)) return SendClientMessage(playerid, -1, "Use /tocar [Nome da Música]");
  26.     PlayAudioStreamByName(playerid, M);
  27.     return 1;
  28. }
Add Comment
Please, Sign In to add comment