local objects = 
{
	--Maxime
	createObject(14858,1133.2998047,-749.3994141,980.4000244,0.0000000,0.0000000,0.0000000,5), --object(veg_pol_main1,5), (1,5),
	createObject(14858,1129.0000000,-760.0000000,980.4000244,0.0000000,0.0000000,90.0000000,5), --object(veg_pol_main1,5), (3,5),
	createObject(1649,1106.6999512,-773.7999878,976.9000244,0.0000000,0.0000000,0.0000000,5), --object(wglasssmash,5), (1,5),
	createObject(1502,1103.0000000,-773.7550049,975.2500000,0.0000000,0.0000000,0.0000000,5), --object(gen_doorint04,5), (1,5),
	createObject(1502,1110.3994141,-773.7041016,975.2500000,0.0000000,0.0000000,179.9945068,5), --object(gen_doorint04,5), (2,5),
	createObject(1649,1096.1300049,-773.7999878,976.9000244,0.0000000,0.0000000,0.0000000,5), --object(wglasssmash,5), (2,5),
	createObject(1502,1099.8320312,-773.7041016,975.2500000,0.0000000,0.0000000,179.9945068,5), --object(gen_doorint04,5), (4,5),
	createObject(1569,1103.4000244,-778.7999878,975.2199707,0.0000000,0.0000000,0.0000000,5), --object(adam_v_door,5), (2,5),
	createObject(3440,1105.6999512,-778.4000244,977.5999756,0.0000000,0.0000000,306.0000000,5), --object(arptpillar01_lvs,5), (1,5),
	createObject(3440,1102.3994141,-778.3994141,977.5999756,0.0000000,0.0000000,235.9973145,5), --object(arptpillar01_lvs,5), (2,5),
	createObject(3440,1100.4000244,-778.4000244,977.5999756,0.0000000,0.0000000,288.0000000,5), --object(arptpillar01_lvs,5), (3,5),
	createObject(3440,1097.1999512,-778.4000244,977.5999756,0.0000000,0.0000000,244.0000000,5), --object(arptpillar01_lvs,5), (4,5),
	createObject(3440,1107.6992188,-778.5000000,977.5999756,0.0000000,0.0000000,247.9998779,5), --object(arptpillar01_lvs,5), (5,5),
	createObject(3354,1104.0999756,-778.7999878,976.9997559,90.0000000,90.0000000,0.0000000,5), --object(burbdoor2ref,5), (4,5),
	createObject(3440,1110.9000244,-778.5000000,977.5999756,0.0000000,0.0000000,302.0000000,5), --object(arptpillar01_lvs,5), (6,5),
	createObject(1722,1095.8000488,-776.7000122,975.2399902,0.0000000,0.0000000,270.0000000,5), --object(off_chairnu,5), (1,5),
	createObject(1722,1095.8000488,-776.0000000,975.2399902,0.0000000,0.0000000,269.9945068,5), --object(off_chairnu,5), (2,5),
	createObject(2185,1103.0999756,-769.0999756,975.2700195,0.0000000,0.0000000,0.0000000,5), --object(med_office6_desk_1,5), (1,5),
	createObject(2185,1107.8000488,-768.4000244,975.2700195,0.0000000,0.0000000,0.0000000,5), --object(med_office6_desk_1,5), (2,5),
	createObject(2185,1098.1999512,-769.0000000,975.2700195,0.0000000,0.0000000,0.0000000,5), --object(med_office6_desk_1,5), (3,5),
	createObject(1714,1099.0000000,-767.7999878,975.2299805,0.0000000,0.0000000,0.0000000,5), --object(kb_swivelchair1,5), (1,5),
	createObject(1714,1103.9000244,-768.0000000,975.2299805,0.0000000,0.0000000,0.0000000,5), --object(kb_swivelchair1,5), (2,5),
	createObject(1714,1108.5999756,-767.2999878,975.2999878,0.0000000,0.0000000,0.0000000,5), --object(kb_swivelchair1,5), (3,5),
	createObject(2167,1096.4000244,-772.2999878,975.2500000,0.0000000,0.0000000,90.0000000,5), --object(med_office_unit_7,5), (1,5),
	createObject(2204,1106.5000000,-770.5000000,975.2500000,0.0000000,0.0000000,270.0000000,5), --object(med_office8_cabinet,5), (1,5),
	createObject(2164,1103.9000244,-765.7999878,975.2500000,0.0000000,0.0000000,0.0000000,5), --object(med_office_unit_5,5), (1,5),
	createObject(630,1102.3000488,-766.2999878,976.2999878,0.0000000,0.0000000,0.0000000,5), --object(veg_palmkb8,5), (1,5),
	createObject(2204,1107.3000488,-765.7000122,975.2399902,0.0000000,0.0000000,0.0000000,5), --object(med_office8_cabinet,5), (2,5),
	createObject(2197,1111.4000244,-766.7999878,975.2399902,0.0000000,0.0000000,0.0000000,5), --object(filling_cabinet,5), (1,5),
	createObject(2202,1111.4000244,-772.0000000,975.2000122,0.0000000,0.0000000,270.0000000,5), --object(photocopier_2,5), (1,5),
	createObject(630,1100.6999512,-772.9000244,976.2999878,0.0000000,0.0000000,0.0000000,5), --object(veg_palmkb8,5), (2,5),
	createObject(2162,1097.3000488,-765.7999878,975.2500000,0.0000000,0.0000000,0.0000000,5), --object(med_office_unit_1,5), (1,5),
	createObject(2161,1099.9000244,-765.7999878,975.2500000,0.0000000,0.0000000,0.0000000,5), --object(med_office_unit_4,5), (1,5),
	createObject(1727,1100.6999512,-771.0000000,975.2999878,0.0000000,0.0000000,270.0000000,5), --object(mrk_seating2b,5), (2,5),
	createObject(1715,1099.0000000,-770.2000122,975.2999878,0.0000000,0.0000000,180.0000000,5), --object(kb_swivelchair2,5), (1,5),
	createObject(1715,1104.8000488,-770.4000244,975.2999878,0.0000000,0.0000000,200.0000000,5), --object(kb_swivelchair2,5), (2,5),
	createObject(1715,1103.4000244,-770.4000244,975.2999878,0.0000000,0.0000000,160.0000000,5), --object(kb_swivelchair2,5), (3,5),
	createObject(1715,1108.5999756,-769.7000122,975.2999878,0.0000000,0.0000000,179.9945068,5), --object(kb_swivelchair2,5), (4,5),
	createObject(1726,1111.1999512,-768.5999756,975.2999878,0.0000000,0.0000000,270.0000000,5), --object(mrk_seating2,5), (2,5),
	createObject(1727,1102.1999512,-772.4000244,975.2999878,0.0000000,0.0000000,90.0000000,5), --object(mrk_seating2b,5), (3,5),
	createObject(2167,1096.4000244,-771.4000244,975.2500000,0.0000000,0.0000000,90.0000000,5), --object(med_office_unit_7,5), (3,5),
	createObject(2207,1110.0000000,-775.6770020,975.2500000,0.0000000,0.0000000,280.0000000,5), --object(med_office7_desk_1,5), (1,5),
	createObject(1714,1111.5999756,-776.2999878,975.2999878,0.0000000,0.0000000,280.0000000,5), --object(kb_swivelchair1,5), (4,5),
	createObject(2190,1110.4000244,-777.2000122,976.0150146,0.0000000,0.0000000,110.0000000,5), --object(pc_1,5), (1,5),
	createObject(1722,1095.8000488,-775.2999878,975.2399902,0.0000000,0.0000000,269.9945068,5), --object(off_chairnu,5), (3,5),
	createObject(11426,1115.0999756,-775.5000000,975.5000000,0.0000000,0.0000000,0.0000000,5), --object(des_adobe03,5), (1,5),
}

local col = createColSphere(1104.16919, -778.24506, 976.25159 , 20)

local function watchChanges( )
	if getElementDimension( getLocalPlayer( ) ) > 0 and getElementDimension( getLocalPlayer( ) ) ~= getElementDimension( objects[1] ) and getElementInterior( getLocalPlayer( ) ) == getElementInterior( objects[1] ) then
		for key, value in pairs( objects ) do
			setElementDimension( value, getElementDimension( getLocalPlayer( ) ) )
		end
	elseif getElementDimension( getLocalPlayer( ) ) == 0 and getElementDimension( objects[1] ) ~= 65535 then
		for key, value in pairs( objects ) do
			setElementDimension( value, 65535 )
		end
	end
end
addEventHandler( "onClientColShapeHit", col,
	function( element )
		if element == getLocalPlayer( ) then
			addEventHandler( "onClientRender", root, watchChanges )
		end
	end
)
addEventHandler( "onClientColShapeLeave", col,
	function( element )
		if element == getLocalPlayer( ) then
			removeEventHandler( "onClientRender", root, watchChanges )
		end
	end
)

-- Put them standby for now.
for key, value in pairs( objects ) do
	setElementDimension( value, 65535 )
end


for index, object in ipairs ( objects ) do
    setElementDoubleSided ( object, true )
	--setElementCollisionsEnabled ( object, true )
end


