View Single Post
Mitchell
~lick~
Join Date: Mar 2010
Old 05-30-2012 , 23:32   Re: Tracerays! and detecting water!
Reply With Quote #6

after 5 seconds, and several hours after i found a solution, it returns these contents when you look at water on the ground: 256, but 1 if there is something in the way.
PHP Code:
public Action:GetEnd(clientargs)
{
    new 
Float:vAngles[3], Float:vOrigin[3], Float:pos[3];

    
GetClientEyePosition(clientvOrigin);
    
GetClientEyeAngles(clientvAngles);

    new 
Handle:trace TR_TraceRayFilterEx(vOriginvAnglesMASK_WATERRayType_InfiniteTraceASDF);

    if(
TR_DidHit(trace))
    {
        
TR_GetEndPosition(postrace);
        if(
TR_GetPointContents(pos) != 1)
        {
            
PrintToChat(client"Hit water! :D");
        }
    }
    
CloseHandle(trace);

    return 
Plugin_Handled;

Mitchell is offline