// @music atcommand // changes the music for all players on the map // // group lv: 2 // group char lv: 99 // log: True // // usage: // @music // // example: // @music fun - script @music 32767,{ end; OnCall: if (!is_evtc()) { end; } // TODO: tmw-like argv splitter .@map$ = getmap(); .@m$ = strtolower(.@atcmd_parameters$[0]); // GMs might not know and want a list of musics if (.@m$ == "" || .@m$ == "list") { .@r$="list"; freeloop(true); .@size=getarraysize($MUSIC_ARRAY$); for (.@i = 0; .@i < .@size; ++.@i) { .@r$+=", "+$MUSIC_ARRAY$[.@i]; } freeloop(false); dispbottom("Music list: "+.@r$); end; } .@key = array_exists($MUSIC_ARRAY$, .@m$); if (!.@key) { //.@m$ = implode(.@atcmd_parameters$[0], " "); message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't broadcast: %s.ogg", .@m$)); } else { message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now broadcasting: %s", .@m$)); changemusic .@map$, .@m$ + ".ogg"; } end; OnMyself: .@m$ = strtolower(.@atcmd_parameters$[0]); .@key = array_exists($MUSIC_ARRAY$, .@m$); // TODO: Check if you have the music unlocked? Bitmask? Array? if (!.@key) { //.@m$ = implode(.@atcmd_parameters$[0], " "); message(getcharid(CHAR_ID_ACCOUNT), sprintf("Can't play: %s.ogg", .@m$)); } else { message(getcharid(CHAR_ID_ACCOUNT), sprintf("Now playing: %s", .@m$)); changeplayermusic .@m$ + ".ogg"; } end; OnInit: bindatcmd "music", "@music::OnCall", 0, 99, 1; bindatcmd "jukebox", "@music::OnMyself", 0, 50, 0; end; }