View Single Post
Author Message
Austin
Senior Member
Join Date: Oct 2005
Old 07-21-2022 , 01:49   [CSGO] how to warp players without getting stuck in walls?
Reply With Quote #1

I have the following code that warps the farthest bot to where I am pointing.
It works perfectly when pointing at the floor but
when pointing to a wall or other things it places the bots into them and they get stuck.

Is there a way to do the trace to keep them from being placed into things and being stuck?
tx


PHP Code:
public Action Command_warpFarBot(int clientint args)
{
    
float clientPos[3];
    
GetEntPropVector(clientProp_Data"m_vecOrigin"clientPos);

    
int farthestBotIndex getFarthestBot(client);

    new 
Float:g_Origin[3];
    new 
Float:g_Angle[3];
    new 
Float:normal[3];
    
    
GetClientEyePosition(clientg_Origin);
    
GetClientEyeAngles(clientg_Angle);
    
TR_TraceRayFilter(g_Origing_AngleMASK_SOLIDRayType_InfiniteTraceRayDontHitSelfclient);
    
//TR_TraceRayFilter(g_Origin, g_Angle, MASK_OPAQUE, RayType_Infinite, TraceRayDontHitSelf, client);
    
if(TR_DidHit(INVALID_HANDLE))
    {
        
//TR_GetSurfaceName(INVALID_HANDLE,tmp, 255);
        //PrintToChat(client, "[Surface]= %s", tmp);
        
        
TR_GetEndPosition(g_Origin);
        
TR_GetPlaneNormal(INVALID_HANDLEnormal); 
        
GetVectorAngles(normalnormal); 
        
normal[0] += 90.0
        
TeleportEntity(farthestBotIndexg_OriginnormalNULL_VECTOR);    
        
//TeleportEntity(farthestBotIndex, g_Origin, g_Angle, NULL_VECTOR);
        //TeleportEntity(ent, end, normal, NULL_VECTOR); 
        
PrintToChat(client"[SM] Teleported %N to you."farthestBotIndex);
    } 

Last edited by Austin; 07-21-2022 at 16:03.
Austin is offline