Bob_Marley

[PAWNO] Advanced Dynamic Radio R1

Oct 14th, 2012
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.21 KB | None | 0 0
  1. #file "player.amx"
  2. #include <a_samp>
  3. #include <YSI\y_hooks>
  4.  
  5.  
  6. hook OnFilterScriptInit() print(">> Radio R1 successfully loaded.");
  7. hook OnPlayerCommandText(playerid, cmdtext[])
  8. {
  9.     if(strcmp(cmdtext, "/radio", true) == 0) return Useradio(playerid);
  10.     return SendClientMessage(playerid,-1,"SERVER: unknown command.");    
  11. }
  12.  
  13. hook OnPlayerDeath(playerid, killerid, reason) StopAudioStreamForPlayer(playerid);
  14. hook OnPlayerDisconnect(playerid, reason) StopAudioStreamForPlayer(playerid);
  15. hook OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
  16.  
  17.     switch(dialogid){
  18.         case 1:{
  19.             switch(listitem) {
  20.                 case 0: PlayAudioStreamForPlayer(playerid,"http://webcast.emg.fm:55655/europaplus128.mp3");
  21.                 case 1: StopAudioStreamForPlayer(playerid);
  22.             }
  23.         }
  24.     }  
  25. }
  26.  
  27. Useradio(playerid)  
  28. {    
  29.     printf("Use radio %s.",Name(playerid));
  30.     return ShowPlayerDialog(playerid,1,DIALOG_STYLE_LIST,"Selecting a radio station","Europa plus\n\
  31.    {FF0000}Radio OFF{FFFFFF}","ENTER","EXIT");
  32. }
  33. stock Name(playerid)
  34. {
  35.     new name[MAX_PLAYER_NAME];
  36.     GetPlayerName(playerid, name, sizeof(name));
  37.     return name;
  38. }  
  39. #endscript
Advertisement
Add Comment
Please, Sign In to add comment