View Single Post
Balimbanana
Member
Join Date: Jan 2017
Old 06-08-2020 , 21:55   Re: Can SourceMod detect texture surface props?
Reply With Quote #2

A bit of a late reply, but it is possible with SourceMod 1.10+ I believe.
Code:
float clpos[3];
float eyeang[3];
GetClientEyePosition(client, clpos);
GetClientEyeAngles(client, eyeang);
char surfname[128];
Handle trace = TR_TraceRayFilterEx(clpos, eyeang, MASK_SHOT, RayType_Infinite, TraceEntityFilter, client);
int surfflags = TR_GetSurfaceFlags(trace);
TR_GetSurfaceName(trace,surfname,sizeof(surfname));
int surfprops = TR_GetSurfaceProps(trace);
CloseHandle(trace);
PrintToChat(client,"TRMaterial Flags %i Props %i Name %s",surfflags,surfprops,surfname);
The SURF_ defines are in scripting\include\sdktools_trace.inc
Although I don't think it gives info like $surfaceprop, the $basetexture is in SurfaceName though. Maybe you can use the info in the flags and props or do a
if (StrContains(surfname,"metal",false) != -1)
Balimbanana is offline