Scripting/Server/Functions/PlayAudioStreamForPlayer
Plays a network audio stream for one player, like SA-MP. url must start with http:// or https:// and may be an .mp3 file, an internet radio stream (MP3) or a .pls / .m3u / .asx playlist that points at one. With usepos = true the sound is positional: full volume at x, y, z, fading to silence at distance metres. A player hears one stream at a time; a new call replaces the old one. PC and Android; ogg/aac are not supported.
Syntax
PlayAudioStreamForPlayer(player, url [, x, y, z, distance, usepos])Arguments
- Player player
- string url – Plays a network audio stream for one player, like SA-MP.
urlmust start withhttp://orhttps://and may be an.mp3file, an internet radio stream (MP3) or a.pls/.m3u/.asxplaylist that points at one. - float x (optional)
- float y (optional)
- float z (optional)
- float distance (optional) – With
usepos= true the sound is positional: full volume atx, y, z, fading to silence atdistancemetres. - any usepos (optional) – With
usepos= true the sound is positional: full volume atx, y, z, fading to silence atdistancemetres.
Returns
nothing
Example
function onPlayerCommand( player, cmd, params )
{
if ( cmd == "playaudiostreamforplayer" )
{
PlayAudioStreamForPlayer( player, "http://example.com/" );
}
}This sample was generated from the signature – adapt the values to your gamemode.
Related pages
Section: Audio streams, object editor and object picker (v0.3)
Categories: Server functions | Audio streams, object editor and object picker (v0.3)