18.01.2013, 02:38
pawn Код:
//Functions
native AttachCameraToAttachedObject(playerid, slot);
native Audio:CreateAudioStream(url[], Float:posX = 0.0, Float:posY = 0.0, Float:posZ = 0.0, Float:distance = 50.0, usepos = 0, playerid = INVALID_PLAYER_ID, interiorid = -1, virtualworldid = -1); // -- > return the handlerid, and add the parameter "playerid - interiorid - virtualworldid" (-1 for all)
native DestroyAudioStream(Audio:handlerid);
native AttachAudioStreamToPlayer(playerid, Audio:handlerir);
//Callbacks
forward OnAudioFinished(playerid, Audio:handlerid); // if is a public audio, playerid is INVALID_PLAYER_ID
//Definitions
#define INVALID_AUDIO_HANDLE -1
pawn Код:
new
Audio:Song[MAX_PLAYERS] = {INVALID_AUDIO_HANDLE, ...};
public OnPlayerSpawn(playerid)
{
Song[playerid] = CreateAudioStream("http://somafm.com/tags.pls", 0.0, 0.0, 0.0, 0.0, playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyAudioStream(Song[playerid]);
return 1;
}
public OnAudioFinished(playerid, Audio:handlerid)
{
if(playerid != INVALID_PLAYER_ID && Song[playerid] != INVALID_SOUND_HANDLE)
{
SendClientMessage(playerid, -1, "SONG FINISHED. NEXT SONG: X");
Song[playerid] = CreateAudioStream("http://somafm.com/tags2.pls", 0.0, 0.0, 0.0, 0.0, playerid);
}
return 1;
}
PD: sorry for my english