local smus = "client/SuperMusic/SuperMusic.dat" COM_AddCommand("supermusic", function(player, arg) if player if arg local file = io.openlocal(smus,"w+") file:write(arg) file:close() rawset(_G,"supermusic", arg) CONS_Printf(player, "Super Music set to "..arg) S_StartSound(nil, sfx_kc48, player) else CONS_Printf(player,"Usage: supermusic | Sets super music") end end end, COM_LOCAL) COM_AddCommand("currentmusic", function(player) if player and supermusic != nil CONS_Printf(player,"Super Music is set to "..supermusic) else CONS_Printf(player,"Super Music hasn't been set. If you would like to set it, use supermusic ") end S_StartSound(nil, sfx_strpst, player) end,COM_LOCAL) addHook("PlayerThink", function(player) for player in players.iterate do if not(player.mo and player.mo.valid) then continue end if supermusic == nil local file = io.openlocal(smus) if file rawset(_G,"supermusic",file:read("*a")) file:close() else rawset(_G,"supermusic", "default") end S_StartSound(nil, sfx_addfil, player) CONS_Printf(player,"SuperMusic initialised!") end if player.powers[pw_super] and supermusic != nil and type(supermusic) == "string" and supermusic != "default" S_ChangeMusic(tostring(supermusic)) end end end) addHook("MusicChange", function(oldname,newname) if consoleplayer if consoleplayer.powers[pw_super] and supermusic != nil and type(supermusic) == "string" and supermusic != "default" and not player.hyper return tostring(supermusic) end end end)