PHP Code:
public void OnEntityCreated(int entity, const char[] classname)
{
if(StrContains(classname, "_projectile") != -1) SDKHook(entity, SDKHook_SpawnPost, Grenade_SpawnPost);
if(StrContains(classname, "_projectile") != -1) SDKHook(entity, SDKHook_StartTouch, Catch);
}
public void Grenade_SpawnPost(int entity)
{
int client = GetEntPropEnt(entity, Prop_Send, "m_hOwnerEntity");
if (client == -1)return; // if the client's index is -1, stop
int iReference = EntIndexToEntRef(entity);
CreateTimer(0.1, Timer_OnGrenadeCreated, iReference);
}
public Action Timer_OnGrenadeCreated(Handle timer, any ref)
{
int entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
SetEntProp(entity, Prop_Data, "m_nNextThinkTick", -1); // block grenade explosion
SetEntProp(entity, Prop_Send, "m_CollisionGroup", 5);
}
}
public void Catch (int client, int entity)
{
if (!IsValidEntity(entity))
return;
PrintToChatAll("the football has hit something");
}
Try this
__________________