Raised This Month: $ Target: $400
 0% 

Teleport by using traceray


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 05-25-2017 , 10:31   Teleport by using traceray
Reply With Quote #1

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(clientclientEye);
    
GetClientEyeAngles(clientclientAngle);

    
TR_TraceRayFilter(clientEyeclientAngleMASK_SOLIDRayType_InfiniteTraceRayTryToHit);
    
    
    if (
TR_DidHit(INVALID_HANDLE))
        
TR_GetEndPosition(PlayerPos);
        
    
TeleportEntity(clientPlayerPosNULL_VECTORNULL_VECTOR); 
and
PHP Code:
public bool TraceRayTryToHit(int entityint mask)
{
    if(
entity && 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.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 04:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode