Audio Stream for All Help!
#1

Hi, I'm making an admin command that will let you stream audio for everyone, but I'm not sure how to set it up..

if any of you could help me out, that would be great!

My Includes:
pawn Код:
#include                      <a_samp>
#include                      <zcmd>
#include                      <sscanf2>
#include                      <streamer>
pawn Код:
CMD:playsong(playerid, params[])
{
    if(IsPlayerAdmin[playerid])
    {
        // What do I do here?
    }
    return 1;
}
Reply
#2

You have to perform a loop and play the audio for each player using a per-player function. I didn't see foreach in your includes so I didn't use foreach, I recommend that you use it tho.

pawn Код:
CMD:playsong(playerid, params[])
{
    if(!IsPlayerAdmin[playerid]) return 0;

    new url[128];
    if(sscanf(params, "s[128]", url)) return SendClientMessage(playerid, -1, "Usage: /playsong (url).");
    for(new i; i < MAX_PLAYERS; i ++)
    {
        PlayAudioStreamForPlayer(i, url);
    }
    return 1;
}
Sent from mobile.
Reply
#3

1) Check if the player is an administrator and if the level meets the requirements.
2) You sure want the administrator to use a custom link, I assume. You then have to check if the parameters he filled in are correct. E.g.: Is it a link for a song? If not, create a list of links and make them choose between the links in the list (Dialogs).
3) Stream the custom link. (As far as I know, there's no function to play an audio stream for everyone. What you can do is loop through the connected players and then play the audio stream for them individually using: https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer)

Edit: And the poster above me spoon fed you the code. I hope you learn from it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)