i little your script a little and this is what i ended up with
Code:
public OnPluginStart()
{
RegisterHook(HK_Touch, OnTouch, false);
RegConsoleCmd("prop", create_prop);
}
public Action:create_prop(client,args)
{
decl ent;
decl Float:vAngles[3], Float:vOrigin[3],Float:vec[3];
ent = CreateEntityByName("prop_physics_multiplayer");
if(IsValidEntity(ent))
{
DispatchKeyValue(ent,"model","models/props_junk/watermelon01.mdl");
DispatchSpawn(ent);
GetClientEyePosition(client,vOrigin);
GetClientEyeAngles(client,vAngles);
GetAngleVectors(vAngles,vec,NULL_VECTOR,NULL_VECTOR);
NormalizeVector(vec,vec);
ScaleVector(vec,GetRandomFloat(600.0,800.0));
TeleportEntity(ent, vOrigin,vAngles,vec);
AddHooksToEntity(ent);
PrintToServer("%d prop created",ent);
}
}
public Action:OnTouch(toucher, touched)
{
decl String:cls[64];
GetEdictClassname(toucher, cls, sizeof(cls));
if(StrEqual(cls, "prop_physics_multiplayer"))
{
decl String:touchedcls[64];
GetEdictClassname(touched, touchedcls, sizeof(touchedcls));
PrintToChatAll("toucher %s touched %s", cls, touchedcls);
}
}
now touch actually works fine, the touch wont get called touching world spawn but it gets called when touching other entities such as prop_physics_multiplayer and even brushed entites such as func_bomb_target and func_buyzone so i can't really help you with figuring out how to find out when it touches a wall...because this is how the game works prop_physics_multiplayer's touch functions dont get called when they touch world...
__________________