Alright so this is for my teleport command, which a few people are running.
I am trying to implement the ability to not get stuck in walls when you are aiming at one, but I'm not sure how to go about it.
This is what I have at the moment:
PHP Code:
decl Float:vAngles[3];
decl Float:vOrigin[3];
GetClientEyePosition(client,vOrigin);
GetClientEyeAngles(client, vAngles);
//get endpoint for teleport
new Handle:trace = TR_TraceRayFilterEx(vOrigin, vAngles, MASK_SHOT, RayType_Infinite, TraceEntityFilterPlayer);
if(TR_DidHit(trace))
{
TR_GetEndPosition(g_pos, trace);
g_pos[2] += 10.0;
}
else
{
PrintToChat(client, "[SM] %s", "Could not teleport player");
CloseHandle(trace);
return false;
}
CloseHandle(trace);
return true;
I am assuming I will have to use GetVectorDistance(vOrigin,g_pos), subtract a bit off it, and then combine that with the view angles to somehow get the end point.
Any help would be muchly appreciated.