The big question is, does it work?
It wont work for the wiki's "Terrain MultiTex" terrain. Here

If thats the case, use this
Code:
var fmt, pxl; COLOR tmpC;

	c_trace(my.x,vector(my.x,my.y,(my.z - 500)),IGNORE_ME|IGNORE_PASSABLE|IGNORE_SPRITES|SCAN_TEXTURE);
	if(trace_hit)
	{
		my.ambient = -55;
		BMAP* shadows = ent_getskin(you,3);  //<<shadowmap skin number
		fmt = bmap_lock(shadows,0);
		pxl = pixel_for_bmap(shadows,hit.u1,hit.v1);
		bmap_unlock(shadows);
		pixel_to_vec(tmpC, NULL, fmt, pxl);
		my.ambient = my.ambient + ((tmpC.red + tmpC.green + tmpC.blue) / 3);
	}




"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial