/*---------------------------------------------------------—
  CleanRP SoundMaster
  
  Copyright © 2017 Jonas Hogeback / UltimateRP
  All Rights Reserved
  Website: UltimateRP.net
—-----------------------------------------------------------*/

SoundMaster = SoundMaster or {}

-- SoundMaster.TearSound(Player(), Typ String, Mode String)	
-- Example: 
-- SoundMaster.TearSound(ply,"tear01", "local")	

function SoundMaster.TearSound(activator,typ,mode)	
		-- Sound Type	
		if (typ == "random") then
			pitch = math.random(70, 130)
			sounds = {"soundmaster/essentials/tear01.mp3"}
			sound = sounds[math.random(1, #sounds)]
		end
		
		if (typ == "tear01") then
			pitch = math.random(70, 130)
			sound = "soundmaster/essentials/tear01.mp3"
		end
		
		-- Local or Global	
		if (mode == "global") then
			activator:EmitSound(sound, 100, pitch)	
		elseif (mode == "local") then
			activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
		end
end

-- SoundMaster.SuccessSound(Player(), Typ String, Mode String)	
-- Example: 
-- SoundMaster.SuccessSound(ply,"success", "local")	

function SoundMaster.SuccessSound(activator,typ,mode)	
		-- Sound Type	
		if (typ == "random") then
			pitch = math.random(70, 130)
			sounds = {"soundmaster/essentials/success.wav"}
			sound = sounds[math.random(1, #sounds)]
		end
		
		if (typ == "success") then
			pitch = math.random(70, 130)
			sound = "soundmaster/essentials/success.wav"
		end
		
		-- Local or Global	
		if (mode == "global") then
			activator:EmitSound(sound, 100, pitch)	
		elseif (mode == "local") then
			activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
		end
end

-- SoundMaster.ErrorSound(Player(), Typ String, Mode String)	
-- Example: 
-- SoundMaster.ErrorSound(ply,"error01", "local")	

function SoundMaster.ErrorSound(activator,typ,mode)	
		-- Sound Type	
		if (typ == "random") then
			pitch = math.random(70, 90)
			sounds = {"soundmaster/essentials/error01.mp3"}
			sound = sounds[math.random(1, #sounds)]
		end
		
		if (typ == "error01") then
			pitch = math.random(70, 90)
			sound = "soundmaster/essentials/error01.mp3"
		end
		
		-- Local or Global	
		if (mode == "global") then
			activator:EmitSound(sound, 100, pitch)	
		elseif (mode == "local") then
			activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
		end
end

-- SoundMaster.SirenSound(Player(), Typ String, Mode String)	
-- Example: 
-- SoundMaster.SirenSound(ply,"siren", "local")	

function SoundMaster.SirenSound(activator,typ,mode)	
		-- Sound Type	
		if (typ == "random") then
			pitch = math.random(70, 130)
			sounds = {"soundmaster/essentials/siren.wav"}
			sound = sounds[math.random(1, #sounds)]
		end
		
		if (typ == "siren") then
			pitch = math.random(70, 130)
			sound = "soundmaster/essentials/siren.wav"
		end
		
		-- Local or Global	
		if (mode == "global") then
			activator:EmitSound(sound, 100, pitch)	
		elseif (mode == "local") then
			activator:SendLua("LocalPlayer():EmitSound('"..sound.."', 100, "..pitch..")");
		end
end