29.08.2013, 11:07
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/playurl", cmdtext, true, 10) == 0)
{
if(IsPlayerConnected(playerid))
{
new idx,sendername[200];
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[500];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /playurl [AudioURL]");
return 1;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
PlayAudioStreamForPlayer(i, (result));
}
}
return 1;
}
return 0;
}
>> Keep in mind that the Audio URL cannot be too long, otherwise it wont play. Use /playurl <URL>

