Description
Type !music <music name> to play YouTube videos in hidden MOTD windows.
Limitations and Bugs
- YouTube Advertisements may play
- Playing with the same query may return different results with players in different countries, due to Google's search mechanism
You cannot use !musicfull in CS:S and CS:GO (Likely not fixable without opening another video)
For CS:GO users!
Make a html file with the content below, upload it somewhere, and set the ytmusic_displayurl to the url of it.
Code:
<html>
<body onload="window.open('https://www.youtube.com/watch?v=q6EoRBvdVPQ','Set your volume here','height=560,width=315');">
</body>
</html>
CVars
ytmusic_version "1.2.3" - Guess what..
ytmusic_displayurl "" - Change only if !musicfull is not working on your mod. Url to some video to open for !musicfull.
Commands
!<yt|music> <music name> - Play first YouTube result of
<music name>
!<yt_|music>to <target> <music name> - Play first YouTube result of
<music name> to
<target>
!<yt_|music>full - Display currently playing music (for changing volume)
!<yt_|music>stop - Stop playing it.
How does it work?
It uses the special URL
http://www.google.com/search?tbm=vid&btnI=1&q=<search terms urlencoded>
(the above link will search for "yee")
which means a google feeling lucky (= redirect to first result) search in videos
Changelog
v1.2.3
- Added cvar ytmusic_displayurl. Change if !musicfull is not working in your mod.
v1.2.2
- Fixed stopping music
- you can write !yt_* too instead of !music* (if you use SMDJ then use !dj for that)
v1.2.1
v1.2
- Switched to transitional syntax (-> 1.7 compiler needed.
compiled will probably run on older nevermind, it won't)
- Added !musicto command
- !musicyt (-> for compatiblity with smdj)
- Correct url buffer size, as source engine limits it to 192 bytes (-> a limit of max 33 russian characters)
- !musicfull command no longer needs music name, brings up currently opened one
v1.1
- URL-encoding for special chars (
Untested)
- Replaced left-in hungarian message saying "You f**ked it up, type !music <music name>"
- Notify users about !musicfull and !musicstop after playing a song
- !musicfull command
v1.0
Credits:
- URL encoding snippet with some modifications taken from here
Download count of prior versions: 290