SA-MP Forums Archive
/music help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: /music help (/showthread.php?tid=368084)



/music help - nogh445 - 12.08.2012

This is the code and I would like it to play music to all of the players, but it will only play music to me for some reason. I even had someone else use the command and I heard the music but they did not. They do have the audio Client installed.
pawn Код:
CMD:music(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "You cannot use this command");
        return 1;
    }
    else
    {
        new string[128], url[128];
        if(sscanf(params, "s[256]", url)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /music [url]");
        if(!strcmp(url, "stop", true, 4))
        {
            StopAudioStreamForPlayer(playerid);
            SendClientMessage(playerid, COLOR_RED, " You have stopped listening to music.");
            return 1;
        }

        format(string, sizeof(string), "An Admin Has Started A Song. Use '/music stop' to stop the song");
        SendClientMessageToAll(COLOR_ORANGE, string);
        foreach(Player, i)
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}



Re: /music help - RedJohn - 12.08.2012

pawn Код:
CMD:music(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "You cannot use this command");
        return 1;
    }
    else
    {
        new string[128], url[128];
        if(sscanf(params, "s[256]", url)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /music [url]");
        if(!strcmp(url, "stop", true, 4))
        {
            StopAudioStreamForPlayer(playerid);
            SendClientMessage(playerid, COLOR_RED, " You have stopped listening to music.");
            return 1;
        }

        format(string, sizeof(string), "An Admin Has Started A Song. Use '/music stop' to stop the song");
        SendClientMessageToAll(COLOR_ORANGE, string);
        foreach (new i : Player)
        {
            PlayAudioStreamForPlayer(i, url);
        }
    }
    return 1;
}
Didn't tested it! But try anyway!