[Include] nJukebox v0.1
#1

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);
OnGameModeInit example:

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");
When a player presses enter in range of the jukebox it'll set the player to face the jukebox and open that jukeboxes unique dialog.

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
Same goes for items (streams)
pawn Код:
#define MAX_JUKEBOX_ITEMS   50
Download
Download - Pastebin
Reply
#2

uh huh, nice release!
Reply
#3

RP's will surely find this useful. Nice release!
Reply
#4

Wow Nice Work!!
Reply
#5

Creative. A party with juke box? Only in few games it's possible, and SA-MP is one now.
Reply
#6

Looks sexy!! :b
Sexy corn
Reply
#7

Good job!!.
Reply
#8

Edited post, some stuff was missing.
Reply
#9

Does the music restart if the player leaves the area in the middle of the song, only to him ?
Reply
#10

Quote:
Originally Posted by The__
Посмотреть сообщение
Does the music restart if the player leaves the area in the middle of the song, only to him ?
It just continues to play.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)