if(strcmp(cmd, "/music", true) == 0) { Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096", false, false, false); return 1; } if(strcmp(cmd, "/stopmusic", true) == 0) { Audio_Stop(playerid, 0); return 1; }
if(strcmp(cmd, "/music", true) == 0) { if(Music[playerid] == 0) { Music[playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096"); SendClientMessage(playerid,COLOR,"You are listening Tunein Station."); Music[playerid] = 1; } return true; } if(strcmp(cmd, "/stopmusic", true) == 0) { if(Music[playerid] == 1) { Audio_Stop(playerid, Music[playerid]); SendClientMessage(playerid,COLOR,"Your are stoped Radio."); Music[playerid] = 0; } return true; }
new Radio[MAX_PLAYERS]; //On top of your script (Not sure if you need MAX_PLAYERS but I use it like that :p)
//In your /music cmd:
Radio[playerid] = Audio_PlayStreamed(blah.......);
//In your /stop cmd:
Audio_Stop(playerid, Radio[playerid]);
Also you can create new Music[MAX_PLAYERS]; and check if player listening music or not
Код:
if(strcmp(cmd, "/music", true) == 0) { if(Music[playerid] == 0) { Music[playerid] = Audio_PlayStreamed(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=674096"); SendClientMessage(playerid,COLOR,"You are listening Tunein Station."); Music[playerid] = 1; } return true; } if(strcmp(cmd, "/stopmusic", true) == 0) { if(Music[playerid] == 1) { Audio_Stop(playerid, Music[playerid]); SendClientMessage(playerid,COLOR,"Your are stoped Radio."); Music[playerid] = 0; } return true; } |
Like this:
pawn Код:
|