Hello, I'm trying to create an explosion effect on an entity after hit, then I kill the entity.
Here's the code, the problem with this is that the shooter can't see the explosion, any other player can.
Why is this happening?
PHP Code:
void SpawnCrate()
{
...
SDKHook(crate, SDKHook_TraceAttackPost, SDKCB_Hit);
...
}
public void SDKCB_Hit(int victim, int attacker, int inflictor, float damage, int damagetype, int ammotype, int hitbox, int hitgroup)
{
float fPos[3];
GetEntPropVector(g_Crate, Prop_Send, "m_vecOrigin", fPos);
CreateExplosion(fPos);
AcceptEntityInput(g_Crate, "Kill");
//CratePickup(attacker);
g_Crate = INVALID_ENT_REFERENCE;
}
void CreateExplosion(float pos[3])
{
int explode = CreateEntityByName("env_explosion");
if (explode == -1)
return;
DispatchKeyValue(explode, "iMagnitude", "0");
DispatchKeyValue(explode, "rendermode", "5");
DispatchKeyValue(explode, "classname", "weapon_c4");
DispatchSpawn(explode);
TeleportEntity(explode, pos, NULL_VECTOR, NULL_VECTOR);
AcceptEntityInput(explode, "Explode");
}
Edit: fixed with tempents.
__________________