SA-MP Forums Archive
How to create a command that plays Audio. - 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: How to create a command that plays Audio. (/showthread.php?tid=537965)



How to create a command that plays Audio. - Mrashad - 19.09.2014

Could you give me an example?
PlayAudioStreamForPlayer(playerid,


Re: How to create a command that plays Audio. - The__ - 19.09.2014

https://sampwiki.blast.hk/wiki/PlayAudioStreamForPlayer
pawn Код:
PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
Basically replace the needs inside of it. You can find a url, you can get the players position, ect.


Re: How to create a command that plays Audio. - Team_PRO - 19.09.2014

Код:
CMD:song(playerid, params[])
{
        PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=237394");
        SendClientMessage(playerid, 0xFFFFFFAA, "Some Message Here.");
        return 1;
}



Re: How to create a command that plays Audio. - Mrashad - 19.09.2014

I want it to be played for everyone....


Re: How to create a command that plays Audio. - JacobEdwards - 20.09.2014

Use a loop then.

Default SA-MP Example:
pawn Код:
CMD:test(playerid, params[]) {
    for(new i = 0; i < MAX_PLAYERS; i++) {
        PlayAudioStreamForPlayer(i, "audiostream");
    }
    return 1;
}
Foreach Example:
pawn Код:
CMD:test(playerid, params[]) {
    foreach(new i: Player) {
        PlayAudioStreamForPlayer(i, "audiostream");
    }
    return 1;
}



Re: How to create a command that plays Audio. - Mrashad - 21.09.2014

Okay so I want an example.
Command = /play
Range = A bit large
URL = "Example"
Could someone do it for me please?


Re: How to create a command that plays Audio. - Mrashad - 21.09.2014

Anyone?


Re: How to create a command that plays Audio. - Mrashad - 21.09.2014

I really need help anyone?


Re: How to create a command that plays Audio. - ReD_HunTeR - 23.09.2014

pawn Код:
CMD:music(playerid,params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: /music [url]");
    {
       PlayAudioStreamForPlayer(playerid, params);
    }
    return 1;
}