Need Someone To Edit RaveBreak

Ok, so on my server i have rabebreak, bu the song is getting old, and instead of changing it myself, why don i just have like 5 songs that it plays randomly, so when you play it the first time, the next time it will play a diferent song.

Heres the current code



if SERVER then
	AddCSLuaFile("autorun/rave.lua")
	
	function InitRave()
		resource.AddFile("sound/ravebreak.mp3")
	end
	hook.Add("Initialize", "RaveInit", InitRave)

	function RaveBreakSay( pl, text, teamonly )
		if (text == "!ravebreak") then
			pl:ConCommand("ravebreak_now")
			return text
		end
	end
	hook.Add("PlayerSay", "RaveBreakSay", RaveBreakSay)

	function RaveCommand( pl, cmd, args )
		if pl:IsAdmin() then

			if not Raving then
				RaveBreak()
			else
				pl:ChatPrint("You're already raving dude!")
			end
		end
	end
	concommand.Add("ravebreak_now",RaveCommand) 
	
	function RaveBreak()
		umsg.Start("RaveBreak")
		umsg.End()

		Raving = true
		
		// 1 second buildup
		timer.Simple(1,function()
			hook.Add("Think","RaveThink",RaveThink)
		end)
		
		timer.Simple(24,function()
			hook.Remove("Think","RaveThink")
			umsg.Start("RaveEnd")
			umsg.End()
			Raving = false
		end)
		
	end

	function RaveThink()
		for k, v in pairs(player.GetAll()) do
			v:PrintMessage(HUD_PRINTCENTER,"RAVE BREAK!")
		end
	end

else

	RAVESOUND = "ravebreak.mp3"

	function RaveBreak(um)
		RunConsoleCommand("stopsounds")

		timer.Simple(0.01,surface.PlaySound,RAVESOUND)
		timer.Simple(1,function()
			hook.Add("RenderScreenspaceEffects", "RaveDraw",RaveDraw)
		end)
	end
	usermessage.Hook("RaveBreak",RaveBreak)

	local lightCnt = 1
	local lastRaveUpdate = 0

	function RaveDraw()
		
		local MySelf = LocalPlayer()
		local ang = MySelf:EyeAngles()
		ang.p = 30*math.sin((CurTime()%2*math.pi)*5)
		MySelf:SetEyeAngles( ang )
				
		if lastRaveUpdate < CurTime()-0.5 then
			lastRaveUpdate = CurTime()
			local last = lightCnt
			while (last == lightCnt) do
				lightCnt = math.random(1,#RaveColTab)
			end
		end

		DrawColorModify( RaveColTab[lightCnt] )
	end

	function RaveEnd(um)
		hook.Remove("RenderScreenspaceEffects", "RaveDraw")
	end
	usermessage.Hook("RaveEnd",RaveEnd)

	RaveColTab = {
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0.05,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 10,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 10
	},
	{
		[ "$pp_colour_addr" ] 		= 0,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0.05,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 0,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 20
	},
	{
		[ "$pp_colour_addr" ] 		= 0,
		[ "$pp_colour_addg" ] 		= 0.05,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 0,
		[ "$pp_colour_mulg" ] 		= 20,
		[ "$pp_colour_mulb" ] 		= 0
	},
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 20,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 0
	},
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0.05,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 10,
		[ "$pp_colour_mulg" ] 		= 10,
		[ "$pp_colour_mulb" ] 		= 0
	}

	}
end


there will be 4 songs, names:
song1.mp3
song2.mp3
song3.mp3
song4.mp3

Pretty easy, right?

this function make you head bob after a 1 second delay



		local MySelf = LocalPlayer()
		local ang = MySelf:EyeAngles()
		ang.p = 30*math.sin((CurTime()%2*math.pi)*5)
		MySelf:SetEyeAngles( ang )


and this is the delay which after the music starts, pauses for 1 second, then starts the visual effects and the head bob



		// 1 second buildup
		timer.Simple(1,function()
			hook.Add("Think","RaveThink",RaveThink)
		end)
		
		timer.Simple(24,function()
			hook.Remove("Think","RaveThink")
			umsg.Start("RaveEnd")
			umsg.End()
			Raving = false
		end)
		
	end


but i want each song to have a different build up time and posibly bob speed
and possibly display a different or text acrost the screen for each song with random rave phrases

all help is appreciated

My friend said to make the changes you will se in this script
(to lazy to explain)



if SERVER then
	AddCSLuaFile("autorun/rave.lua")
	
	function InitRave()
		resource.AddFile("sound/ravebreak.mp3")
		resource.AddFile("sound/rave1.mp3")
		resource.AddFile("sound/rave2.mp3")
		resource.AddFile("sound/rave3.mp3")

	end
	hook.Add("Initialize", "RaveInit", InitRave)

	function RaveBreakSay( pl, text, teamonly )
		if (text == "!ravebreak") then
			pl:ConCommand("rave_now")
			return text
		end
	end
	hook.Add("PlayerSay", "RaveBreakSay", RaveBreakSay)

	function RaveCommand( pl, cmd, args )
		if pl:IsAdmin() then

			if not Raving then
				RaveBreak()
			else
				pl:ChatPrint("You're already raving dude!")
			end
		end
	end
	concommand.Add("rave_now",RaveCommand) 
	
	function RaveBreak()
		umsg.Start("RaveBreak")
		umsg.End()

		Raving = true
		
		// 1 second buildup
		timer.Simple(2,function()
			hook.Add("Think","RaveThink",RaveThink)
		end)
		
		timer.Simple(24,function()
			hook.Remove("Think","RaveThink")
			umsg.Start("RaveEnd")
			umsg.End()
			Raving = false
		end)
		
	end

	function RaveThink()
		for k, v in pairs(player.GetAll()) do
			v:PrintMessage(HUD_PRINTCENTER,"|TvA| RAVE Party!")
		end
	end

else

	 local songs = { "ravebreak.mp3", "rave1.mp3", "rave2.mp3", "rave3.mp3" }

	function RaveBreak(um)
		RunConsoleCommand("stopsounds")

		timer.Simple(0.01, surface.PlaySound, songs[math.random(1, table.Count(songs)])
		timer.Simple(1,function()
			hook.Add("RenderScreenspaceEffects", "RaveDraw",RaveDraw)
		end)
	end
	usermessage.Hook("RaveBreak",RaveBreak)

	local lightCnt = 1
	local lastRaveUpdate = 0

	function RaveDraw()
		
		local MySelf = LocalPlayer()
		local ang = MySelf:EyeAngles()
		ang.p = 30*math.sin((CurTime()%2*math.pi)*5)
		MySelf:SetEyeAngles( ang )
				
		if lastRaveUpdate < CurTime()-0.5 then
			lastRaveUpdate = CurTime()
			local last = lightCnt
			while (last == lightCnt) do
				lightCnt = math.random(1,#RaveColTab)
			end
		end

		DrawColorModify( RaveColTab[lightCnt] )
	end

	function RaveEnd(um)
		hook.Remove("RenderScreenspaceEffects", "RaveDraw")
	end
	usermessage.Hook("RaveEnd",RaveEnd)

	RaveColTab = {
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0.05,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 10,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 10
	},
	{
		[ "$pp_colour_addr" ] 		= 0,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0.05,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 0,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 20
	},
	{
		[ "$pp_colour_addr" ] 		= 0,
		[ "$pp_colour_addg" ] 		= 0.05,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 0,
		[ "$pp_colour_mulg" ] 		= 20,
		[ "$pp_colour_mulb" ] 		= 0
	},
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 20,
		[ "$pp_colour_mulg" ] 		= 0,
		[ "$pp_colour_mulb" ] 		= 0
	},
	{
		[ "$pp_colour_addr" ] 		= 0.05,
		[ "$pp_colour_addg" ] 		= 0.05,
		[ "$pp_colour_addb" ] 		= 0,
		[ "$pp_colour_brightness" ] = 0.1,
		[ "$pp_colour_contrast" ] 	= 1,
		[ "$pp_colour_colour" ] 	= 0,
		[ "$pp_colour_mulr" ] 		= 10,
		[ "$pp_colour_mulg" ] 		= 10,
		[ "$pp_colour_mulb" ] 		= 0
	}

	}
end


-snip-

Hey, that’s my script :stuck_out_tongue:

I’ll make a quick edit for you. Hold on a sec.

EDIT:

[lua]
local songs = {
{ file = “sound/ravebreak.mp3”, duration = 24, buildup = 1 },
{ file = “sound/rave1.mp3”, duration = 20, buildup = 1 },
{ file = “sound/rave2.mp3”, duration = 99, buildup = 1 },
{ file = “sound/rave3.mp3”, duration = 1337, buildup = 1 }
}

if SERVER then
AddCSLuaFile(“autorun/rave.lua”)

function InitRave()
	for k, v in pairs(songs) do
		resource.AddFile(v.file)
	end
end

hook.Add("Initialize", "RaveInit", InitRave)

function RaveBreakSay( pl, text, teamonly )
	if (text == "!ravebreak") then
		pl:ConCommand("rave_now")
		return text
	end
end
hook.Add("PlayerSay", "RaveBreakSay", RaveBreakSay)

function RaveCommand( pl, cmd, args )
	if pl:IsAdmin() then

		if not Raving then
			RaveBreak()
		else
			pl:ChatPrint("You're already raving dude!")
		end
	end
end
concommand.Add("rave_now",RaveCommand) 

function RaveBreak()
	local toStart = math.random(1,#songs)

	umsg.Start("RaveBreak")
		usmg.Short(toStart)
	umsg.End()

	Raving = true
	
	// 1 second buildup
	timer.Simple(songs[toStart].buildup,function()
		hook.Add("Think","RaveThink",RaveThink)
	end)
	
	timer.Simple(songs[toStart].duration,function()
		hook.Remove("Think","RaveThink")
		umsg.Start("RaveEnd")
		umsg.End()
		Raving = false
	end)
	
end

function RaveThink()
	for k, v in pairs(player.GetAll()) do
		v:PrintMessage(HUD_PRINTCENTER,"|TvA| RAVE Party!")
	end
end

else

function RaveBreak(um)
	RunConsoleCommand("stopsounds")

	local song = um:ReadShort()
	
	timer.Simple(0.01, surface.PlaySound, songs[song].file)
	timer.Simple(songs[song].buildup,function()
		hook.Add("RenderScreenspaceEffects", "RaveDraw",RaveDraw)
	end)
end
usermessage.Hook("RaveBreak",RaveBreak)

local lightCnt = 1
local lastRaveUpdate = 0

function RaveDraw()
	
	local MySelf = LocalPlayer()
	local ang = MySelf:EyeAngles()
	ang.p = 30*math.sin((CurTime()%2*math.pi)*5)
	MySelf:SetEyeAngles( ang )
			
	if lastRaveUpdate &lt; CurTime()-0.5 then
		lastRaveUpdate = CurTime()
		local last = lightCnt
		while (last == lightCnt) do
			lightCnt = math.random(1,#RaveColTab)
		end
	end

	DrawColorModify( RaveColTab[lightCnt] )
end

function RaveEnd(um)
	hook.Remove("RenderScreenspaceEffects", "RaveDraw")
end
usermessage.Hook("RaveEnd",RaveEnd)

RaveColTab = {
{
	[ "$pp_colour_addr" ] 		= 0.05,
	[ "$pp_colour_addg" ] 		= 0,
	[ "$pp_colour_addb" ] 		= 0.05,
	[ "$pp_colour_brightness" ] = 0.1,
	[ "$pp_colour_contrast" ] 	= 1,
	[ "$pp_colour_colour" ] 	= 0,
	[ "$pp_colour_mulr" ] 		= 10,
	[ "$pp_colour_mulg" ] 		= 0,
	[ "$pp_colour_mulb" ] 		= 10
},
{
	[ "$pp_colour_addr" ] 		= 0,
	[ "$pp_colour_addg" ] 		= 0,
	[ "$pp_colour_addb" ] 		= 0.05,
	[ "$pp_colour_brightness" ] = 0.1,
	[ "$pp_colour_contrast" ] 	= 1,
	[ "$pp_colour_colour" ] 	= 0,
	[ "$pp_colour_mulr" ] 		= 0,
	[ "$pp_colour_mulg" ] 		= 0,
	[ "$pp_colour_mulb" ] 		= 20
},
{
	[ "$pp_colour_addr" ] 		= 0,
	[ "$pp_colour_addg" ] 		= 0.05,
	[ "$pp_colour_addb" ] 		= 0,
	[ "$pp_colour_brightness" ] = 0.1,
	[ "$pp_colour_contrast" ] 	= 1,
	[ "$pp_colour_colour" ] 	= 0,
	[ "$pp_colour_mulr" ] 		= 0,
	[ "$pp_colour_mulg" ] 		= 20,
	[ "$pp_colour_mulb" ] 		= 0
},
{
	[ "$pp_colour_addr" ] 		= 0.05,
	[ "$pp_colour_addg" ] 		= 0,
	[ "$pp_colour_addb" ] 		= 0,
	[ "$pp_colour_brightness" ] = 0.1,
	[ "$pp_colour_contrast" ] 	= 1,
	[ "$pp_colour_colour" ] 	= 0,
	[ "$pp_colour_mulr" ] 		= 20,
	[ "$pp_colour_mulg" ] 		= 0,
	[ "$pp_colour_mulb" ] 		= 0
},
{
	[ "$pp_colour_addr" ] 		= 0.05,
	[ "$pp_colour_addg" ] 		= 0.05,
	[ "$pp_colour_addb" ] 		= 0,
	[ "$pp_colour_brightness" ] = 0.1,
	[ "$pp_colour_contrast" ] 	= 1,
	[ "$pp_colour_colour" ] 	= 0,
	[ "$pp_colour_mulr" ] 		= 10,
	[ "$pp_colour_mulg" ] 		= 10,
	[ "$pp_colour_mulb" ] 		= 0
}

}

end
[/lua]

Untested, but should work. Guess you can figure out how to configure your songs if you look at the first few lines.

can someone link me to the ravebreak file? i dont seem to haev it in my directories.

my friend put it on his server and he turned it on and everyone was like “what the hell is going on” it was perfect