06.11.2011, 05:01
(
Последний раз редактировалось Norn; 14.08.2012 в 00:33.
)
V0.1
nJukebox is an include that allows you to create dynamic jukeboxes and attach items (streams/files) accordingly.[ame]http://www.youtube.com/watch?v=Lx0RWQnRBCA[/ame]
Credits:
Norn
Leopard (Angle Function)
pawn Код:
forward JukeBoxDialog(playerid, jukeboxid);
forward CreateJukebox(Float:x, Float:y, Float:z, Float:rotx, Float:roty, Float:rotz, pps, Float:stream_distance);
forward AttachStreamToJukebox(jukeboxid, streamtitle[MAX_JB_STREAM_T], streamurl[MAX_JB_STREAM_URL]);
forward JukeBoxItemExists(id);
forward JukeBoxExists(id);
forward DestroyJukebox(id);
forward DestroyJukeboxItem(id);
forward SetJukeboxPos(id, Float:x, Float:y, Float:z);
forward SetJukeboxRot(id, Float:x, Float:y, Float:z);
forward SetJukeboxItemStream(id, newstream[MAX_JB_STREAM_T]);
forward SetJukeboxItemTitle(id, newtitle[MAX_JB_STREAM_T]);
forward SetJukeboxItemOwner(id, jukeboxid);
forward SetJukeboxPricePerSong(id, price);
forward SetJukeboxStreamDistance(id, Float:stream_distance);
pawn Код:
new jb = CreateJukebox(406.1645,-15.8582,991.2563, 0, 0, 359.5403, 1337, 15.00);
AttachStreamToJukebox(jb, "Tiesto - Traffic", "http://");
AttachStreamToJukebox(jb, "Tiesto - Maximal Crazy", "http://");
AttachStreamToJukebox(jb, "Deadmau5 - Some Chords", "http://");
AttachStreamToJukebox(jb, "Deadmau5 - Strobe (Special Features Remix)", "http://");
AttachStreamToJukebox(jb, "Deadmau5 - Where My Keys", "http://hulkshare.com/ap-x19tzglpzi31.mp3");
Flaws:
1. If a person comes from outside of the range after the song has started playing he/she won't hear it, I'm not going to code this until a SetStreamPosition function similar to the one in Incognito's audio plugin has been coded (if, that is).
2. No OnStreamEnd callback exists as of yet although it has been requested by several people including myself. Thus we're unable to detect when the stream has ended and allow people to use the jukebox again this means people can change the song at any time and griefing would occur I would imagine, especially if it's used in a highly populated server.
Other:
If you wish to change the maximum allowed amount of jukeboxes change:
pawn Код:
#define MAX_JUKEBOXES 100
pawn Код:
#define MAX_JUKEBOX_ITEMS 50
Download - Pastebin