I try to make prop susceptible to damage and at the same time that bullets pass through it
Who can tell how it can be implemented?
Code:
int CreateGift(const Float:pos[3], client)
{
if ((ent = CreateEntityByName("prop_physics_override")) != -1)
{
decl String:tmp[64];
FormatEx(tmp, sizeof(tmp), "gift_%i", ent);
DispatchKeyValue(ent, "model", "models/props/de_vertigo/concretebags2.mdl");
DispatchKeyValue(ent, "massScale", "0.5");
DispatchKeyValue(ent, "targetname", tmp);
DispatchKeyValue(ent, "spawnflags", "1");
DispatchSpawn(ent);
SetEntProp(ent, Prop_Send, "m_usSolidFlags", 1);
SetEntProp(ent, Prop_Send, "m_CollisionGroup", 2);
SetEntProp(ent, Prop_Data, "m_takedamage", 2, 1);
SetEntProp(ent, Prop_Data, "m_iHealth", 300);
SetEntPropEnt(ent, Prop_Send, "m_hEffectEntity", client);
TeleportEntity(ent, pos, NULL_VECTOR, NULL_VECTOR);
SetEntityMoveType(ent, MOVETYPE_NONE);
CreateTimer(0.0, Ven, ent, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT);
SDKHook(ent, SDKHook_OnTakeDamage, OnTakeDamage);
return ent
}
return -1
}
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if (0 < attacker <= MaxClients)
{
new client = GetEntPropEnt(victim, Prop_Send, "m_hOwnerEntity");
if ((client != attacker) && IsPlayerAlive(attacker))
{
return Plugin_Handled;
}
return Plugin_Continue;
}
return Plugin_Continue;
}