05.11.2011, 18:30
V0.1.1
nPlayer is a dynamic media system using dialogs, you simply create a category and attach items to that category based on id.[ame]http://www.youtube.com/watch?v=KeiIuRWg7mU[/ame]
How do I use it?
Simply download the include put it in your pawno includes folder and at the top of your script:
pawn Code:
#include <nplayer>
Good question, below is some example code that does just that.
pawn Code:
new eHouse = PlayerAddCategory("House");
AddStreamToCategory(eHouse, "Deadmau5 - Some Chords", "http://streamurl");
AddStreamToCategory(eHouse, "Deadmau5 - Strobe (Special Features Remix)", "http://streamurl");
AddStreamToCategory(eHouse, "Deadmau5 - Where My Keys", "http://streamurl");
AddStreamToCategory(eHouse, "Chuckie, Gregor Salto - What Happens In Vegas (Club Mix)", "http://streamurl");
How do I show the dialog to players?
The function
pawn Code:
PlayerInitDialog(playerid);
pawn Code:
COMMAND:player(playerid, params[])
{
PlayerInitDialog(playerid);
return true;
}
Of course, that's what it was designed for. The original script was nRadio which since 0.3d I have changed the name and updated.
Below is a huge list of radio stations ready to go, all you do is paste:
pawn Code:
new cmrfcrccrtkmgxp = PlayerAddCategory("Trance");
AddStreamToCategory(cmrfcrccrtkmgxp, "Discover Trance Radio", "http://london02.discovertrance.com:80");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - Trance", "http://u11aw.di.fm:80/di_trance");
AddStreamToCategory(cmrfcrccrtkmgxp, "Trance.FM", "http://nl-sc.trance.fm:8080");
AddStreamToCategory(cmrfcrccrtkmgxp, "TranceRadio.CH", "http://server8.digital-webstream.de:10780");
AddStreamToCategory(cmrfcrccrtkmgxp, "Afterhours FM", "http://nl2.ah.fm:9000");
AddStreamToCategory(cmrfcrccrtkmgxp, "Club Lounge Radio - Trance td", "http://Club-Lounge-Radio.com:8888");
AddStreamToCategory(cmrfcrccrtkmgxp, "1Mix Radio", "http://marc.1mix.co.uk:8000");
AddStreamToCategory(cmrfcrccrtkmgxp, "1.FM Radio - Trance", "http://64.71.145.130:8040");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - Vocal Trance", "http://205.188.215.230:8004");
AddStreamToCategory(cmrfcrccrtkmgxp, "NERadio International", "http://87.98.182.201:80");
AddStreamToCategory(cmrfcrccrtkmgxp, "Chromanova.FM", "http://85.25.86.69:8000");
AddStreamToCategory(cmrfcrccrtkmgxp, "Bassfabrik", "http://178.63.65.7:8005");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - DJ Mixes", "http://209.247.146.100:8000");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - Progressive", "http://scfire-dtc-aa04.stream.aol.com:80/stream/1026");
AddStreamToCategory(cmrfcrccrtkmgxp, "Afterhours FM - DJS", "http://205.188.215.229:8020");
AddStreamToCategory(cmrfcrccrtkmgxp, "NERadio Sweden", "http://94.23.27.140");
AddStreamToCategory(cmrfcrccrtkmgxp, "p s y r a d i o FM", "http://81.88.37.2:8010");
AddStreamToCategory(cmrfcrccrtkmgxp, "PulsRadio Version Trance", "http://91.121.1.154:9000");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - Classic Trance", "http://67.21.210.110:8000");
AddStreamToCategory(cmrfcrccrtkmgxp, "SomaFM - Tag's Trip", "http://205.188.215.230:8012");
AddStreamToCategory(cmrfcrccrtkmgxp, "Mika FM", "http://stream1-1.mika.fm:80");
AddStreamToCategory(cmrfcrccrtkmgxp, "Digitally Imported - Breaks", "http://205.188.215.225:8002");
AddStreamToCategory(cmrfcrccrtkmgxp, "PSYCHEDELIK", "http://88.191.102.69:8010");
AddStreamToCategory(cmrfcrccrtkmgxp, "PSYCHEDELIK - Trance Flux", "http://88.191.102.69:8000");
AddStreamToCategory(cmrfcrccrtkmgxp, "1Club.FM - Trance", "http://208.77.21.19:80/trance");
AddStreamToCategory(cmrfcrccrtkmgxp, "TranceSection.FM", "http://212.95.42.87:88");
AddStreamToCategory(cmrfcrccrtkmgxp, "1Club.FM - 24/7 Trance Mixes", "http://208.77.21.19:80/trancemixes");
AddStreamToCategory(cmrfcrccrtkmgxp, "Shathor", "http://212.62.227.4:8500");
AddStreamToCategory(cmrfcrccrtkmgxp, "DJTiestoStream.NL", "http://213.148.243.128:8020");
AddStreamToCategory(cmrfcrccrtkmgxp, "Trancemission.FM", "http://87.230.21.161:9000");
AddStreamToCategory(cmrfcrccrtkmgxp, "Dance Radio Global - Trance", "http://75.126.73.136:8090");
AddStreamToCategory(cmrfcrccrtkmgxp, "ETN fm - Trance", "http://toronto.etn.fm:8130");
AddStreamToCategory(cmrfcrccrtkmgxp, "Trance Elements", "http://tranceelements.com:9990");
AddStreamToCategory(cmrfcrccrtkmgxp, "Techno FM - Trance", "http://69.174.241.145/trance.mp3");
AddStreamToCategory(cmrfcrccrtkmgxp, "Radio Seven", "http://sc5.radioseven.se:8002");
new sverbpvwntsampc = PlayerAddCategory("Local");
AddStreamToCategory(sverbpvwntsampc, "Cool FM 97.4 FM", "http://icy-e-01.sharp-stream.com:80/coolfm.mp3");
AddStreamToCategory(sverbpvwntsampc, "Citybeat 96.7 FM", "http://213.229.90.229:8600");
AddStreamToCategory(sverbpvwntsampc, "IUR FM", "http://iurfm.internet-radio.org.uk:11832");
AddStreamToCategory(sverbpvwntsampc, "U105.8FM", "http://stream1.radiomonitor.com/U105");
AddStreamToCategory(sverbpvwntsampc, "Carrickfergus 106.7 FM", "http://lush.wavestreamer.com:5055");
AddStreamToCategory(sverbpvwntsampc, "Blast 106.4 FM", "http://origin01.proradiostreaming.com:8018");
new oowzorafhvvchyb = PlayerAddCategory("Holidays");
AddStreamToCategory(oowzorafhvvchyb, "Christmas Classics - Word Of Truth Radio", "http://208.53.138.118:8090");
AddStreamToCategory(oowzorafhvvchyb, "Christmas Radio Network", "http://216.59.35.37:8100");
new pxnajerjsboexjm = PlayerAddCategory("Country");
AddStreamToCategory(pxnajerjsboexjm, "181.Fm - Kickin Country - Today's Best Country!", "http://scfire-ntc-aa08.stream.aol.com:80/stream/1075");
AddStreamToCategory(pxnajerjsboexjm, "DRS 2006 - Country Radio Switzerland", "http://rs3.radiostreamer.com:9330");
AddStreamToCategory(pxnajerjsboexjm, "CMR Nashville", "http://91.121.122.94:8013");
AddStreamToCategory(pxnajerjsboexjm, "The World Net Radio - Country Oldies", "http://theworldnetradio.com:8024");
AddStreamToCategory(pxnajerjsboexjm, "181.Fm - Highway 181 (Classic Country)", "http://uplink.duplexfx.com:8018");
AddStreamToCategory(pxnajerjsboexjm, "Country 108 - Your Country Music Station - 247", "http://tuner.country108.com");
AddStreamToCategory(pxnajerjsboexjm, "1.FM - Country", "http://72.13.81.178:8020");
AddStreamToCategory(pxnajerjsboexjm, "WKRK Radio", "http://shoutatme.com:7034");
AddStreamToCategory(pxnajerjsboexjm, "1.FM - Absolutely Country Hits", "http://72.13.81.178:7800");
AddStreamToCategory(pxnajerjsboexjm, "Nashville Classics", "http://ophanim.net:7100");
AddStreamToCategory(pxnajerjsboexjm, "HPR1 - Classic Country", "http://130.166.82.14:8006");
AddStreamToCategory(pxnajerjsboexjm, "Active Radio US", "http://s5.voscast.com:7264");
AddStreamToCategory(pxnajerjsboexjm, "Boot Liquor", "http://207.200.96.230:8014");
AddStreamToCategory(pxnajerjsboexjm, "Nashville FM", "http://server-14.stream-server.nl:8300");
AddStreamToCategory(pxnajerjsboexjm, "UK Country Radio", "http://87.117.250.3:9078");
AddStreamToCategory(pxnajerjsboexjm, "Super Country", "http://s5.viastreaming.net:7690");
AddStreamToCategory(pxnajerjsboexjm, "Country Music24", "http://212.48.110.70:9000");
AddStreamToCategory(pxnajerjsboexjm, "The World Net Radio - Country", "http://theworldnetradio.com:8720");
AddStreamToCategory(pxnajerjsboexjm, "Steel Radio", "http://steelradio.serverroom.us:8300");
AddStreamToCategory(pxnajerjsboexjm, "Trucknet Radio", "http://212.105.73.74:8001");
AddStreamToCategory(pxnajerjsboexjm, "Lonestar 101 - Texas Country", "http://70.84.35.211:8000");
AddStreamToCategory(pxnajerjsboexjm, "The New Highway - 40 Country", "http://64.64.3.161:8000");
AddStreamToCategory(pxnajerjsboexjm, "Radioio - Classic Country", "http://76.76.18.109:8666");
AddStreamToCategory(pxnajerjsboexjm, "Country Crossroads Radio", "http://67.205.85.183:7710");
AddStreamToCategory(pxnajerjsboexjm, "Radio Country Club", "http://91.197.164.12:8130");
AddStreamToCategory(pxnajerjsboexjm, "KLMR AM Classic Country", "http://69.145.25.169:8000");
AddStreamToCategory(pxnajerjsboexjm, "1.FM - Absolute Country Hits", "http://72.13.81.5:5010");
AddStreamToCategory(pxnajerjsboexjm, "The Country Top 30", "http://clubhost.ca:8030");
new aaagvxyxmdagsdo = PlayerAddCategory("Hardstyle");
AddStreamToCategory(aaagvxyxmdagsdo, "Hard.FM - The #1 Hardstyle Radio", "http://192.mp3.streams.lsw.evo.hard.fm:8000");
AddStreamToCategory(aaagvxyxmdagsdo, "Digitally Imported - Hardstyle", "http://u11aw.di.fm:80/di_hardstyle");
AddStreamToCategory(aaagvxyxmdagsdo, "Q-Dance", "http://stream01.platform02.true.nl:8000/qdance-hard");
AddStreamToCategory(aaagvxyxmdagsdo, "Hardsection FM", "http://89.31.134.100:82");
AddStreamToCategory(aaagvxyxmdagsdo, "Hardbase FM", "http://mp3.hb-stream.net");
AddStreamToCategory(aaagvxyxmdagsdo, "Clubsoundz FM", "http://87.118.112.38:8000");
new wnzzzkedevrmtvm = PlayerAddCategory("Dubstep");
AddStreamToCategory(wnzzzkedevrmtvm, "Dubstep FM", "http://72.233.84.175:80");
AddStreamToCategory(wnzzzkedevrmtvm, "Sensimedia - Strictly Dubstep & Bass", "http://sensimedia.net:9002");
AddStreamToCategory(wnzzzkedevrmtvm, "Filth FM", "http://75.125.130.122:8062");
AddStreamToCategory(wnzzzkedevrmtvm, "DubstepLive Radio (DNBTV)", "http://173.236.56.82:8004");
AddStreamToCategory(wnzzzkedevrmtvm, "Shakedown FM", "http://cp.internet-radio.org.uk:15580");
AddStreamToCategory(wnzzzkedevrmtvm, "Digitally Imported - Dubstep", "http://67.21.210.110:8002");
AddStreamToCategory(wnzzzkedevrmtvm, "Rough Tempo", "http://217.112.93.51:8200");
new obfwsstwzfbbjnb = PlayerAddCategory("Dance");
AddStreamToCategory(obfwsstwzfbbjnb, "Gaydar Radio", "http://mp31.gaydarradio.com/gaydarradio_high_1");
AddStreamToCategory(obfwsstwzfbbjnb, "MaxDance - Trance/Dance", "http://cp.internet-radio.org.uk:15114");
AddStreamToCategory(obfwsstwzfbbjnb, "Energy FM", "http://204.45.8.170:8051");
AddStreamToCategory(obfwsstwzfbbjnb, "Digitally Imported - Hard Dance", "http://209.247.146.98:8000");
AddStreamToCategory(obfwsstwzfbbjnb, "Digitally Imported - Eurodance", "http://scfire-ntc-aa02.stream.aol.com:80/stream/1024");
AddStreamToCategory(obfwsstwzfbbjnb, "Soundic Radio", "http://193.10.239.174");
AddStreamToCategory(obfwsstwzfbbjnb, "NonStopPlay - Dance Radio", "http://highdedi.nonstopplay.co.uk:80");
AddStreamToCategory(obfwsstwzfbbjnb, "Gay FM", "http://www.alcelec.lu");
new apmvrwycjfwhwjv = PlayerAddCategory("Metal");
AddStreamToCategory(apmvrwycjfwhwjv, "Rockradio1.Com - Classic Hard Rock & Heavy Metal", "http://91.121.203.207:8000");
AddStreamToCategory(apmvrwycjfwhwjv, "SnakeNet Metal Radio", "http://205.188.215.231:8016");
AddStreamToCategory(apmvrwycjfwhwjv, "1.FM - High Voltage", "http://sc8.1.fm:8035");
AddStreamToCategory(apmvrwycjfwhwjv, "Netrock101", "http://76.73.107.66:8418");
AddStreamToCategory(apmvrwycjfwhwjv, "ChroniX Metal", "http://205.188.215.225:8022");
AddStreamToCategory(apmvrwycjfwhwjv, "Death FM", "http://209.9.229.211:80");
AddStreamToCategory(apmvrwycjfwhwjv, "Hard Rock Radio Live", "http://66.90.103.189:8868");
AddStreamToCategory(apmvrwycjfwhwjv, "Braingell", "http://76.73.21.74:8102");
AddStreamToCategory(apmvrwycjfwhwjv, "Metal Tome", "http://metaltome.com:7900");
new esydmygyznroyxf = PlayerAddCategory("House");
AddStreamToCategory(esydmygyznroyxf, "House Radio", "http://78.129.250.9:8052");
AddStreamToCategory(esydmygyznroyxf, "SSRadio", "http://server2.myshoutcast.de:9044");
AddStreamToCategory(esydmygyznroyxf, "Dance Radio Global - Progressive House", "http://75.126.73.136:8080");
AddStreamToCategory(esydmygyznroyxf, "ETN fm - House", "http://toronto.etn.fm:8230");
new pwzbbgxjdvjdowx = PlayerAddCategory("Chillout");
AddStreamToCategory(pwzbbgxjdvjdowx, "Digitally Imported - Chillout Dreams", "http://195.43.138.147:8000");
AddStreamToCategory(pwzbbgxjdvjdowx, "Chillout Radio Greece - Chillout/Ambient/Lounge Music", "http://live.chilloutradio.gr:8999");
AddStreamToCategory(pwzbbgxjdvjdowx, "4clubbers", "http://94.23.226.80:8500");
new ocvmkzwvdsggmkx = PlayerAddCategory("80s");
AddStreamToCategory(ocvmkzwvdsggmkx, "Offshore Music Radio", "http://bitsmitter.com:8000");
AddStreamToCategory(ocvmkzwvdsggmkx, "More Fm - Classic Rock Radio", "http://216.66.84.2:6320");
AddStreamToCategory(ocvmkzwvdsggmkx, "ABC 80s Ireland", "http://173.244.194.212:8067");
AddStreamToCategory(ocvmkzwvdsggmkx, "Threeten Radio", "http://threetenradio.com:8089");
AddStreamToCategory(ocvmkzwvdsggmkx, "Glam FM", "http://173.193.223.145:8046");
AddStreamToCategory(ocvmkzwvdsggmkx, "Absolute 80s", "http://mp3-a8-128.as34763.net");
AddStreamToCategory(ocvmkzwvdsggmkx, ".977 The 80s Channel", "http://205.188.215.229:8004");
AddStreamToCategory(ocvmkzwvdsggmkx, "Kick Radio - 80s & 90s", "http://brd.kickradio.nl:9000");
AddStreamToCategory(ocvmkzwvdsggmkx, "Dance Groove Radio", "http://server3.digital-webstream.de:12160");
AddStreamToCategory(ocvmkzwvdsggmkx, "80s Planet", "http://eu2.servemp3.com");
new zbegxcahbczxoyc = PlayerAddCategory("Techno");
AddStreamToCategory(zbegxcahbczxoyc, "Techno FM", "http://http://stream.techno.fm/techno.mp3");
AddStreamToCategory(zbegxcahbczxoyc, "JumpStation.FM", "http://85.25.84.200:8036");
new jjkkrroxkxvszpe = PlayerAddCategory("Hardcore");
AddStreamToCategory(jjkkrroxkxvszpe, "Digitally Imported - Happy Hardcore", "http://u11aw.di.fm:80/di_hardcore");
AddStreamToCategory(jjkkrroxkxvszpe, "Hardcore Radio", "http://shoutcast1.hardcoreradio.nl");
AddStreamToCategory(jjkkrroxkxvszpe, "Hardcore Power Radio", "http://hardcorepower.stream2us.com:8126");
new avsktonvwxxtyyn = PlayerAddCategory("RnB");
AddStreamToCategory(avsktonvwxxtyyn, "Defjay", "http://sc1.netstreamer.net:8008");
AddStreamToCategory(avsktonvwxxtyyn, "KISS", "http://icy-e-01.sharp-stream.com/kiss100.mp3");
new xvhjsxjrzovsono = PlayerAddCategory("Rock");
AddStreamToCategory(xvhjsxjrzovsono, "Atlantic Sound Factory", "http://208.85.240.83");
AddStreamToCategory(xvhjsxjrzovsono, "Regular Rotation", "http://cp2.internet-radio.org.uk:30047");
AddStreamToCategory(xvhjsxjrzovsono, "Noise FM", "http://stream01.noisefm.pl:8000");
AddStreamToCategory(xvhjsxjrzovsono, "Idobi Radio", "http://65.19.189.162");
AddStreamToCategory(xvhjsxjrzovsono, "Beatles Radio", "http://beatlesradio.com:8088");
AddStreamToCategory(xvhjsxjrzovsono, "Absolute Radio", "http://mp3-vr-128.smgradio.com");
AddStreamToCategory(xvhjsxjrzovsono, "181.FM - The Eagle (Classic Rock)", "http://uplink.duplexfx.com:8030");
AddStreamToCategory(xvhjsxjrzovsono, "Rock Radio1", "http://91.121.203.207:8000");
AddStreamToCategory(xvhjsxjrzovsono, "Megarock Radio", "http://205.188.215.228:8012");
new kdxrhdcnydoozya = PlayerAddCategory("Drum & Bass");
AddStreamToCategory(kdxrhdcnydoozya, "Bassjunkees.com - Drum & Bass, Oldskool, Jungle & Dubstep", "http://ducks.and.ponies.listen.bassjunkees.com:8442");
AddStreamToCategory(kdxrhdcnydoozya, "Digitally Imported - Drum and Bass", "http://207.200.96.229:8030");
AddStreamToCategory(kdxrhdcnydoozya, "DnB Heaven", "http://dnbheaven.com:8000");
AddStreamToCategory(kdxrhdcnydoozya, "DnB Radio", "http://ponies.and.turtles.love.dnbradio.hosted.by.ilovedrumnbass.com:8000");
AddStreamToCategory(kdxrhdcnydoozya, "UK Bass Radio", "http://92.48.87.11:8740");
AddStreamToCategory(kdxrhdcnydoozya, "Destroyer", "http://destroyer.net:8800");
AddStreamToCategory(kdxrhdcnydoozya, "Bassdrive", "http://screlay-dtc0l-3.shoutcast.com:8084");
new bajpwtdkkamjzcc = PlayerAddCategory("Misc");
AddStreamToCategory(bajpwtdkkamjzcc, "HIT104 - Your Top 40 Channel", "http://tuner.hit104.com:80");
AddStreamToCategory(bajpwtdkkamjzcc, ".977 The Hits Channel", "http://205.188.215.230:8002");
AddStreamToCategory(bajpwtdkkamjzcc, "Jack FM - All Hit Radio", "http://tuner.jackfm.de:80");
new wvjhjmrrxtbkptc = PlayerAddCategory("Electro");
AddStreamToCategory(wvjhjmrrxtbkptc, "Electro Radio", "http://stream.electroradio.ch:26630");
AddStreamToCategory(wvjhjmrrxtbkptc, "Digitally Imported - Electro House", "http://scfire-dtc-aa01.stream.aol.com:80/stream/1025");
AddStreamToCategory(wvjhjmrrxtbkptc, "Tuff and Twisted", "http://server2.myshoutcast.de:9042");
AddStreamToCategory(wvjhjmrrxtbkptc, "House Section FM", "http://stream.housesection.fm:84");
pawn Code:
forward PlayerCategoryBrowse(playerid, listitem);
forward PlayerAddCategory(name[NPMAX_CATEGORY_LENGTH]);
forward AddStreamToCategory(categoryid, name[NPMAX_ITEM_LENGTH], streamurl[NPMAX_STREAM_URL_LENGTH]);
forward PlayerInitDialog(playerid);
forward PlayerStop(playerid);
forward PlayerPlay(playerid, itemid);
forward DeleteCategory(categoryid);
forward ModifyCategory(categoryid, name[NPMAX_CATEGORY_LENGTH]);
forward ModifyItem(itemid, name[NPMAX_ITEM_LENGTH], streamurl[NPMAX_STREAM_URL_LENGTH]);
forward DeleteItem(itemid);
forward ItemCountFromCategory(categoryid);
forward CategoryIDFromDialogOrder(listitem);
forward ItemIDFromDialogOrder(playerid, listitem);
Download - Pastebin