@ PVP - I must admit I haven't looked at the intersect command yet so I can't comment on its suitability, but I've often wondered about solving this problem. This is all very pie in the sky and you'll know a lot more about how movable objects interact with static environmental objects so you may say straight off the bat that what I'm about to propose is impossible.
Add to all wall, building etc class objects a custom config entry stating that if its a solid object then it forces the players weapon to be lowered (eg. lowerWeapon = true). This could be done fairly high up the class tree or you could be more specific if you liked based on wall/vehicle height etc (for example, some objects would only occlude if you were kneeling). I then envisaged a nearObjects type loop that would look for all objects that contained the custom config statement within a metre or so of the player and if a players hands or weapon were within a certain distance the player would be forced to lower his weapon - I imagine this would have to be done in model space. A similar method could be used to identify walls etc that a player could use for cover or when stacking up next to a closed door using something like smookies custom animations. All of this would be fairly processor intensive I guess so it it may not be worth contemplating.
Anyway my 2 cents let me know if you want me to flesh out the idea further - if I ever get the time I may even get around to giving it a go.
norrin
EDIT: Ignore all of that 
Try this, it seems to work, the distance from the wall may need a little tweaking and you can also get locked into a weapon up/down loop because the players eye position moves when the weapon is lowered - this would probably work better with the shactac addon. The only other problem I can see is that when you are in aiming mode you only lower your weapon for a second if you are standing against a wall, seems to work fine when you're kneeling in aim mode though.
Code:
_occlude = false;
_c = 0;
while {true} do {
_wepDir = player weaponDirection (primaryWeapon player);
_wepRotate = (_wepDir select 0) atan2 (_wepDir select 1);
_playerPos = eyePos player;
_viewPos = [(_playerPos select 0) + (sin _wepRotate) * 1.2, (_playerPos select 1) + (cos _wepRotate) * 1.2, (_playerPos select 2)]; //eye distance from wall = 1.2 metres
_occlude = lineIntersects [eyePos player, _viewPos];
hintSilent format ["%1", _occlude];// Hint Player against wall
if (_occlude) then {
if (_c == 0) then {
player action ["WeaponOnBack", player];
_c = 1;
};
} else {
if (_c == 1) then {
player action ["WeaponInHand", player];
_c = 0;
};
};
sleep 0.1;
};
One final thing if you were to reverse the distance eg. -1.2 you could determine whether a players back was against a wall!