Do it in OnPlayerConnect Callback;
Like This :-
pawn Код:
public OnPlayerConnect(playerid)
{
PlayAudioStreamForPlayer(playerid,"http://picosong.com/static/songs/b5caac76a6f6546a8982a005ab845f01/2%20Chainz%20-%20I%27m%20Different%20%28Lyrics%20On%20Screen%29%20%5BBased%20On%20A%20T.R.U.%20Story%5D.mp3");
}
Parameters :-
Код:
(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
Код:
playerid - The ID of the player to play the audio for.
url[] - The url to play. Valid formats are mp3 and ogg/vorbis. A link to a .pls (playlist) file will play that playlist.
Float:PosX - The X position at which to play the audio. Default 0.0. Has no effect unless usepos is set to 1.
Float:PosY - The Y position at which to play the audio. Default 0.0. Has no effect unless usepos is set to 1.
Float:PosZ - The Z position at which to play the audio. Default 0.0. Has no effect unless usepos is set to 1.
Float:distance - The distance over which the audio will be heard. Has no effect unless usepos is set to 1.
usepos - Use the positions and distance specified. Default disabled (0).
pawn Код:
PlayAudioStreamForPlayer(playerid, url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0)
For Example :-
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/radio", cmdtext, true) == 0)
{
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls");
return 1;
}
if (strcmp("/radiopos", cmdtext, true) == 0)
{
new Float:X, Float:Y, Float:Z, Float:Distance = 5.0;
GetPlayerPos(playerid, X, Y, Z);
PlayAudioStreamForPlayer(playerid, "http://somafm.com/tags.pls", X, Y, Z, Distance, 1);
return 1;
}
return 0;
}