13/11/2018, 07:32 AM
Código PHP:
public cmd_bomba(id)
{
new Float:fAim[3], Float:fOrigin[3]
velocity_by_aim(id, 64, fAim)
pev(id, pev_origin, fOrigin)
fOrigin[0] += fAim[0]
fOrigin[1] += fAim[1]
new ent = engfunc(EngFunc_CreateNamedEntity, iAllocInfoTarget)
if(ent)
{
engfunc(EngFunc_SetModel, ent, model_bombal)
engfunc(EngFunc_SetSize, ent, Float:{-15.0,-15.0,-15.0}, Float:{15.0,15.0,15.0})
engfunc(EngFunc_SetOrigin, ent, fOrigin)
set_pev(ent, pev_classname, entidad_bomba)
set_pev(ent, pev_dmg, 100.0)
set_pev(ent, pev_flSwimTime, EntTypeJetPack)
set_pev(ent, pev_movetype, MOVETYPE_TOSS)
set_pev(ent, pev_solid, SOLID_TRIGGER)
set_rendering(ent, kRenderFxGlowShell, 255, 15, 15, kRenderNormal, 10)
set_task(3.0,"explotar_bomba", ent)
}
}
public explotar_bomba(entity)
{
// Round ended (bugfix)
if (g_endround) return;
if (!pev_valid(entity))
return
new Float:originF[3]
pev(entity, pev_origin, originF);
engfunc(EngFunc_MessageBegin, MSG_PVS, SVC_TEMPENTITY, originF, 0)
write_byte(TE_EXPLOSION)
engfunc(EngFunc_WriteCoord, originF[0])
engfunc(EngFunc_WriteCoord, originF[1])
engfunc(EngFunc_WriteCoord, originF[2])
write_short(g_fire) //sprite index
write_byte(25) // scale in 0.1's
write_byte(10) // framerate
write_byte(0) // flags
message_end()
static flOrigin[3], PlayerPos[3], distance
pev(entity, pev_origin, originF);
new attacker = pev(entity, pev_owner)
zp_colored_print(attacker, "nombre : %s", g_playername[attacker])
for (new i = 1; i <= g_maxplayers; i++)
{
if(g_isalive[i])
{
if(g_class[i] == ZOMBIE){
get_user_origin(i, PlayerPos)
distance = get_distance(PlayerPos, flOrigin)
if (distance <= 240.0)
{
if(get_user_health(i) - 2300.0 > 0)
fakedamage(i, "Pipe Bomb", 2300.0, 256);
else
zp_colored_print(0,"USER MUERTOO!!")
//ExecuteHamB(Ham_Killed, i, attacker, 2)
}
}
}
}
remove_task(entity)
remove_entity(entity)
}
Código PHP:
register_clcmd("bomba", "cmd_bomba")
Buenas, no logro que me tome el que tiró la bomba. Es una modificación que estoy haciendo (ayuda con código de la bomba pipe), que al poner bomba en consola, largue una bomba en el piso y luego de 3 segundo explote y le saque daño a los que estén cerca... el problema que tengo es que no me toma al atacante, y al momento de morir la victima se crashea, alguna ayuda?