Quote:
Originally Posted by Powerlord
Out of curiosity, have you tried hooking SDKHook_SpawnPost in OnEntityCreated?
|
I tried this and it didn't work, it actually made the SetEntProp line not work anymore as well
PHP Code:
public OnEntityCreated(entity, const String:classname[])
{
if(!strcmp(classname, "hegrenade_projectile", false))
{
new iReference = EntIndexToEntRef(entity);
SDKHook(iReference,SDKHook_SpawnPost,OnGrenadeCreated);
}
}
public Action:OnGrenadeCreated(ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
SetEntProp(entity, Prop_Data, "m_nNextThinkTick", -1); // prevent the grenade from exploding
SDKHook(entity,SDKHook_Touch,GrenadeTouch);
}
public GrenadeTouch(entity,other)
{
if (1 <= other <= MaxClients) // grenade touches a player
PrintToServer("Player touched a grenade");
}