Код
stock GetClientOnAim(client)
{
decl Float:origin[3], Float:angles[3];
GetClientEyePosition(client, origin); GetClientEyeAngles(client, angles);
TR_TraceRayFilter(origin, angles, MASK_SOLID, RayType_Infinite, Filter, client);
if (!TR_DidHit())
return -1;
new ent = TR_GetEntityIndex();
TR_GetEndPosition(origin);
if (ent > 0 && ent <= MaxClients) return ent;
else return -1;
}
public bool:Filter(ent, mask, any:client)
{
return client != ent;
}
//В коде:
//client - игрок, который смотрит
new target = GetClientOnAim(client);
if (target > 0)
{
//Смотрим на игрока с индексом target
}