Hello, I want to teleport player where he looks, but of course it'll teleport player to textures, so I tried traceray:
PHP Code:
float PlayerPos[3];
float clientEye[3], clientAngle[3];
GetClientEyePosition(client, clientEye);
GetClientEyeAngles(client, clientAngle);
TR_TraceRayFilter(clientEye, clientAngle, MASK_SOLID, RayType_Infinite, TraceRayTryToHit);
if (TR_DidHit(INVALID_HANDLE))
TR_GetEndPosition(PlayerPos);
TeleportEntity(client, PlayerPos, NULL_VECTOR, NULL_VECTOR);
and
PHP Code:
public bool TraceRayTryToHit(int entity, int mask)
{
if(entity > 0 && entity <= MaxClients)
return false;
return true;
}
but it also can teleport to walls, I think bool TraceRayTryToHit must be changed, but I don't know what exactly.
__________________