|
发表于 2008-3-16 17:02:56
|
显示全部楼层
来自 中国–北京–北京–海淀区
回复: 求助: 玩家死后自爆 + 范围性伤害插件
[PHP]#include <amxmodx>
#include <engine>
#define TE_EXPLOSION 3
#define TE_SMOKE 5
#define TE_IMPLOSION 14
#define TE_BEAMCYLINDER 21
#define TE_EXPLFLAG_NONE 0
new g_cvar_death_explode
new g_cvar_radius
new g_cvar_damage
new g_sModelIndexFireball
new g_sModelIndexSmoke
new m_iSpriteTexture
new g_maxplayers
public plugin_init()
{
register_plugin("Death Explode","1.0","LiToViEtBoI & X-man")
register_cvar("death_explode", "1")
register_event("DeathMsg","death","a")
register_cvar("explosion_radius", "250")
register_cvar("explosion_damage", "200")
g_maxplayers = get_maxplayers()
}
public plugin_precache()
{
m_iSpriteTexture = precache_model( "sprites/shockwave.spr")
g_sModelIndexFireball = precache_model("sprites/zerogxplode.spr")
g_sModelIndexSmoke = precache_model("sprites/steam1.spr")
precache_sound("ambience/particle_suck1.wav")
}
public death()
{
if(!get_pcvar_num(g_cvar_death_explode))
return PLUGIN_CONTINUE
new id = read_data(2)
new origin[3]
get_user_origin(id, origin)
explode(origin)
emit_sound(id,CHAN_STATIC, "ambience/particle_suck1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
set_task(0.5, "blastcircles", id)
return PLUGIN_CONTINUE
}
public explode(const origin[3])
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_IMPLOSION)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2])
write_byte(100)
write_byte(20)
write_byte(5)
message_end()
}
public blastcircles(id)
{
new origin[3]
get_user_origin(id, origin)
new blast_cir = get_pcvar_num(g_cvar_radius)
// blast circles
message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
write_byte(TE_BEAMCYLINDER)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2] - 16)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2] - 16 + blast_cir)
write_short(m_iSpriteTexture)
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(6) // life
write_byte(16) // width
write_byte(0) // noise
write_byte(188)
write_byte(220)
write_byte(255)
write_byte(255) //brightness
write_byte(0) // speed
message_end()
message_begin(MSG_PAS, SVC_TEMPENTITY, origin)
write_byte(TE_BEAMCYLINDER)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2] - 16)
write_coord(origin[0])
write_coord(origin[1])
write_coord(origin[2] - 16 + blast_cir / 2)
write_short(m_iSpriteTexture)
write_byte(0) // startframe
write_byte(0) // framerate
write_byte(6) // life
write_byte(16) // width
write_byte(0) // noise
write_byte(188)
write_byte(220)
write_byte(255)
write_byte(255) //brightness
write_byte(0) // speed
message_end()
// random explosions
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_EXPLOSION) // This just makes a dynamic light now
write_coord(origin[0] + random_num(-100, 100))
write_coord(origin[1] + random_num(-100, 100))
write_coord(origin[2] + random_num(-50, 50))
write_short(g_sModelIndexFireball)
write_byte(random_num(20, 40)) // scale * 10
write_byte(12) // framerate
write_byte(TE_EXPLFLAG_NONE)
message_end()
// lots of smoke
message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
write_byte(TE_SMOKE)
write_coord(origin[0] + random_num(-100, 100))
write_coord(origin[1] + random_num(-100, 100))
write_coord(origin[2] + random_num(-50, 50))
write_short(g_sModelIndexSmoke)
write_byte(60) // scale * 10
write_byte(10) // framerate
message_end()
set_task(0.5, "bum", id)
}
public bum(id)
{
new team = get_user_team(id)
new radius = get_pcvar_num(g_cvar_radius)
new damage = get_pcvar_num(g_cvar_damage)
new dist
new origin[3], origin1[3]
get_user_origin(id,origin)
for(new i = 1; i <= g_maxplayers; i++)
{
if(is_user_alive(i) && get_user_team(i) != team)
{
get_user_origin(i, origin1)
dist = get_distance(origin, origin1)
if(dist < radius)
{
fakedamage(i, "Explosion", float(damage - damage * dist / radius), 0)
}
}
}
}
[/PHP]
试试这个 |
|