someone can create a plugin when you hit the bomb on players back it will explode? there is a plugin but the explode function is not working anymore, already tried.
Code:
/***********************************************************/
/********************* WHEN PLAYER HURT ********************/
/***********************************************************/
/* BACK = hitbox = 8 + hitgroup = 2 */
public Action OnTracekAttack(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{
//if(B_active_track_bomb)
{
if(B_active_track_bomb_c4_explode)
{
if(Client_IsIngame(victim) && Client_IsIngame(attacker))
{
int c4 = GetPlayerWeaponSlot(victim, CS_SLOT_C4);
if(c4 != -1)
{
if(hitbox == 9 && damagetype == DMG_SHOT && hitgroup == 2)
{
if(GetClientTeam(victim) != GetClientTeam(attacker))
{
C_hit_num += 1;
damage = 0.0;
Handle kv = CreateKeyValues("bomb");
KvSetNum(kv, "hit", C_hit_num);
KvSetNum(kv, "total_hit", C_active_track_bomb_hit_num);
KvSetNum(kv, "victim", victim);
KvSetNum(kv, "attacker", attacker);
if(C_hit_num == C_active_track_bomb_hit_num)
{
Explode(victim, attacker, c4);
CreateTimer(F_active_track_bomb_delay_time_msg, DisplayMessageHolderExplode, kv);
C_hit_num = 0;
}
else if(C_hit_num != 0 && C_hit_num < C_active_track_bomb_hit_num)
{
CreateTimer(F_active_track_bomb_delay_time_msg, DisplayMessageWarningBomb, kv);
}
}
return Plugin_Changed;
}
}
}
}
}
return Plugin_Continue;
}
/***********************************************************/
/********************** PLAYER EXPLODE *********************/
/***********************************************************/
void Explode(int victim, int attacker, int c4)
{
float pos[3];
GetClientAbsOrigin(victim, pos);
int victim_death = GetEntProp(victim, Prop_Data, "m_iDeaths");
int vicitm_frags = GetEntProp(victim, Prop_Data, "m_iFrags");
int attacker_frags = GetEntProp(attacker, Prop_Data, "m_iFrags");
int explosion = CreateEntityByName("env_explosion");
if(explosion != -1)
{
SetEntityHealth(victim, 1);
// Stuff we will need
float vector[3];
int damage = 500;
int radius = 128;
int team = GetEntProp(victim, Prop_Send, "m_iTeamNum");
// We're going to use eye level because the blast can be clipped by almost anything.
// This way there's no chance that a small street curb will clip the blast.
GetClientEyePosition(victim, vector);
SetEntProp(explosion, Prop_Send, "m_iTeamNum", team);
SetEntProp(explosion, Prop_Data, "m_spawnflags", 264);
SetEntProp(explosion, Prop_Data, "m_iMagnitude", damage);
SetEntProp(explosion, Prop_Data, "m_iRadiusOverride", radius);
DispatchKeyValue(explosion, "rendermode", "5");
DispatchSpawn(explosion);
ActivateEntity(explosion);
TE_SetupExplosion(pos, M_HALO01_PRECACHED, 5.0, 1, 0, 100, 1500);
TE_Start("World Decal");
TE_WriteVector("m_vecOrigin", pos);
int random = GetRandomInt(0, 12);
TE_WriteNum("m_nIndex", M_TACK_BOMB_DECALS_BLOOD[random]);
TE_SendToAll();
RemovePlayerItem(victim, c4);
AcceptEntityInput(c4, "Kill");
TeleportEntity(explosion, vector, NULL_VECTOR, NULL_VECTOR);
EmitSoundToAll("weapons/hegrenade/explode3.wav", explosion, 1, 90);
AcceptEntityInput(explosion, "Explode");
EmitSoundToAll("weapons/c4/c4_explode1.wav", explosion, 1, 90);
SetEntProp(victim, Prop_Data, "m_iFrags", vicitm_frags);
SetEntProp(victim, Prop_Data, "m_iDeaths", victim_death + 1);
SetEntProp(attacker, Prop_Data, "m_iFrags", attacker_frags + 1);
}
}
/***********************************************************/
/****************** PRECACHE BLOOD DECALS ******************/
/***********************************************************/
void PrecacheDecalsBlood()
{
M_TACK_BOMB_DECALS_BLOOD[0] = PrecacheDecal("decals/blood_splatter.vtf");
M_TACK_BOMB_DECALS_BLOOD[1] = PrecacheDecal("decals/bloodstain_003.vtf");
M_TACK_BOMB_DECALS_BLOOD[2] = PrecacheDecal("decals/bloodstain_101.vtf");
M_TACK_BOMB_DECALS_BLOOD[3] = PrecacheDecal("decals/bloodstain_002.vtf");
M_TACK_BOMB_DECALS_BLOOD[4] = PrecacheDecal("decals/bloodstain_001.vtf");
M_TACK_BOMB_DECALS_BLOOD[5] = PrecacheDecal("decals/blood8.vtf");
M_TACK_BOMB_DECALS_BLOOD[6] = PrecacheDecal("decals/blood7.vtf");
M_TACK_BOMB_DECALS_BLOOD[7] = PrecacheDecal("decals/blood6.vtf");
M_TACK_BOMB_DECALS_BLOOD[8] = PrecacheDecal("decals/blood5.vtf");
M_TACK_BOMB_DECALS_BLOOD[9] = PrecacheDecal("decals/blood4.vtf");
M_TACK_BOMB_DECALS_BLOOD[10] = PrecacheDecal("decals/blood3.vtf");
M_TACK_BOMB_DECALS_BLOOD[11] = PrecacheDecal("decals/blood2.vtf");
M_TACK_BOMB_DECALS_BLOOD[12] = PrecacheDecal("decals/blood1.vtf");
}