05.07.2013, 18:42
Not Tested
pawn Код:
#define <ZCMD>
new audioplayed[MAX_PLAYERS];//Put this top of your script
new audiourl[MAX_PLAYERS][128];//Put this top of your script
new audioplayed[playerid] = 0;//Put this Under OnplayerConnect to avoid problem or bug
format(audiourl[playerid], 128, "");//Put this Under OnplayerConnect to avoid problem or bug
CMD:playaudio(playerid, params[]))
{
if(!isnull(params))
{
new music[128];
PlayAudioStreamForPlayer(playerid, params);
format(audiourl[playerid], 128, params); //save the url
audioplayed[playerid] = 1;
SendClientMessage(playerid, -1, "Audio played");
}
else SendClientMessage(playerid, COLOR_WHITE, "USAGE: /playaudio [url]");
return 1;
}
public OnPlayerUpdate(playerid)
{
if(audioplayed[playerid] == 1)
{
PlayAudioStreamForPlayer(playerid, audiourl[playerid]); // play the url all the time
}
return 1;
}