SA-MP Forums Archive
[Include] nJukebox v0.1 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] nJukebox v0.1 (/showthread.php?tid=295405)



nJukebox v0.1 - Norn - 06.11.2011

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


Re: nJukebox v0.1 - Kar - 06.11.2011

uh huh, nice release!


Re: nJukebox v0.1 - Lorenc_ - 06.11.2011

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


Re: nJukebox v0.1 - [GTA]Leon[RPD] - 06.11.2011

Wow Nice Work!!


Re: nJukebox v0.1 - CyNiC - 06.11.2011

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


Re: nJukebox v0.1 - FireCat - 06.11.2011

Looks sexy!! :b
Sexy corn


Re : nJukebox v0.1 - Naruto_Emilio - 06.11.2011

Good job!!.


Re: nJukebox v0.1 - Norn - 14.08.2012

Edited post, some stuff was missing.


Re: nJukebox v0.1 - The__ - 14.08.2012

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


Re: nJukebox v0.1 - Norn - 25.08.2012

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.