<commit_before>sound = nil
blaster = nil
ox, oy, oz = nil

function elementStreamIn()
	if (getElementType(source)=="object") then
		local model = getElementModel(source)
		if (model==2226) then
			local x, y, z = getElementPosition(source)
			local tx, ty, tz = getElementPosition(getLocalPlayer())
			
			if (blaster==nil) or (getDistanceBetweenPoints3D(x, y, z, tx, ty, tz)<getDistanceBetweenPoints3D(x, y, z, ox, oy, oz)) then
				ox, oy, oz = x, y, z
				
				if (blaster) then
					blaster = nil
					stopSound(sound)
					sound = nil
				end
				blaster = source
				sound = playSound3D("ghettoblaster/loop.mp3", x, y, z, true)
				setSoundMaxDistance(sound, 20)
				
				if (isPedInVehicle(getLocalPlayer())) then
					setSoundVolume(sound, 0.5)
				end
			end
		end
	end
end
addEventHandler("onClientElementStreamIn", getRootElement(), elementStreamIn)

function elementStreamOut()
	if (blaster~=nil) then
		if (source==blaster) then
			blaster = nil
			stopSound(sound)
			sound = nil
		end
	end
end
addEventHandler("onClientElementStreamOut", getRootElement(), elementStreamOut)
addEventHandler("onClientElementDestroy", getRootElement(), elementStreamOut)

function dampenSound(thePlayer)
	if (thePlayer==getLocalPlayer()) and (isElement(sound)) then
		setSoundVolume(sound, 0.5)
	end
end
addEventHandler("onClientVehicleEnter", getRootElement(), dampenSound)

function boostSound(thePlayer)
	if (thePlayer==getLocalPlayer()) and (isElement(sound)) then
		setSoundVolume(sound, 1.0)
	end
end
addEventHandler("onClientVehicleExit", getRootElement(), boostSound)<commit_msg>You can now have unlimited ghettoblasters<commit_after>blasters = { }

function elementStreamIn()
	if (getElementType(source)=="object") then
		local model = getElementModel(source)
		if (model==2226) then
			local x, y, z = getElementPosition(source)
			
			local sound = playSound3D("ghettoblaster/loop.mp3", x, y, z, true)
			blasters[source] = sound
			setSoundMaxDistance(sound, 20)
			
			if (isPedInVehicle(getLocalPlayer())) then
				setSoundVolume(sound, 0.5)
			end
		end
	end
end
addEventHandler("onClientElementStreamIn", getRootElement(), elementStreamIn)

function elementStreamOut()
	if (blasters[source]~=nil) then
		local sound = blasters[source]
		stopSound(sound)
		blasters[source] = nil
	end
end
addEventHandler("onClientElementStreamOut", getRootElement(), elementStreamOut)
addEventHandler("onClientElementDestroy", getRootElement(), elementStreamOut)

function dampenSound(thePlayer)
	for key, value in pairs(blasters) do
		setSoundVolume(value, 0.5)
	end
end
addEventHandler("onClientVehicleEnter", getRootElement(), dampenSound)

function boostSound(thePlayer)
	for key, value in pairs(blasters) do
		setSoundVolume(value, 1.0)
	end
end
addEventHandler("onClientVehicleExit", getRootElement(), boostSound)
{'fraction_non_alphanumeric': 0.10611263736263736, 'fraction_numerical': 0.010302197802197802, 'mean_word_length': 4.538022813688213, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6345999', 'n_tokens_mistral': 1089, 'n_tokens_neox': 936, 'n_words': 225}