Or you could just use the last optional parameter, the exempt typemask, so that it looks through players. More like so:
package Chat
{
function serverCmdMessageSent(%client, %msg)
{
%position = %client.player.position;
InitContainerRadiusSearch(%position,30,$TypeMasks::PlayerObjectType);
while((%targetObject=containerSearchNext()) !$= 0)
{
//This needs to be if(false), because you don't want the msg to reach the target if it encounters something. The first Typemask argument are/is the Typemask(s) that will be searched for. The second Typemask argument are/is the Typemask(s) that will be ignored (allowing you to talk through people).
if(!ContainerRayCast(%position, %targetObject.player, $TypeMasks::All, $TypeMasks::PlayerObjectType))
{
%c = %targetObject.client;
messageClient(%c,'',"\c4[Local] \c7" SPC %client.clanprefix @ "\c3" @ %client.name @ "\c7" @ %client.clansuffix @ "\c6:" SPC %msg);
}
}
}
};