|
楼主 |
发表于 2009-3-1 14:04:53
|
显示全部楼层
来自 中国–湖南–衡阳
public shooter_think(id){
new shots,r,g,b, effects[30], Float:origin[3]
shots = entity_get_int(id,EV_INT_iuser1)
pev(id,pev_iuser2,r)
pev(id,pev_iuser3,g)
pev(id,pev_iuser4,b)
entity_get_string(id,EV_SZ_target,effects,29)
pev(id,pev_origin,origin)
origin[2] += 10
touch_effect(origin,255,255,255)
fireworks_spawn(id,"firework_normal",effects,r,g,b)
shoot_firework(id)
shots = shots - 1
if(shots < 1) detonate_shooter(id)
else set_pev(id,pev_iuser1,shots);
return 1;
}
public detonate_shooter(id){
explode(id)
remove_entity(id)
remove_task(id)
return 1;
}
public spawn_firework(id){
if(!check_fireworks(id,1)){
client_print(id,print_chat,"[FIRE] 你不能放更多的烟花.")
return PLUGIN_HANDLED;
}
new arg[30],type2[30]
read_argv(0,type2,29)
if(equali(type2,"firework")) format(type2,29,"firework_normal");
read_argv(1,arg,29)
new r = str_to_num(arg)
read_argv(2,arg,29)
new g = str_to_num(arg)
read_argv(3,arg,29)
new b = str_to_num(arg)
read_argv(4,arg,29)
new type = read_flags(arg)
if(!type ) format(arg,29,"abcdefsz")
fireworks_spawn(id,type2,arg,r,g,b)
return PLUGIN_HANDLED;
}
public fireworks_spawn(id,type[],effects[],r,g,b) {
new Float:Origin[3]
new Float:Angles[3]
Angles[0] = 90.0
Angles[1] = random_float(0.0,360.0)
Angles[2] = 0.0
pev(id,pev_origin,Origin)
new Float:Mins[3] = {-4.0, -4.0, -1.0}
new Float:Maxs[3] = {4.0, 4.0, 12.0}
new Ent = create_entity("info_target")
if (!Ent) return PLUGIN_HANDLED;
engfunc(EngFunc_SetOrigin,Ent,Origin)
engfunc(EngFunc_SetSize,Ent,Mins,Maxs)
engfunc(EngFunc_SetModel,Ent,"models/rpgrocket.mdl")
entity_set_string(Ent,EV_SZ_classname,"nrm_fireworks")
entity_set_string(Ent,EV_SZ_target,effects)
entity_set_string(Ent,EV_SZ_targetname,type)
set_pev(Ent,pev_angles,Angles)
set_pev(Ent,pev_owner,id)
set_pev(Ent,pev_solid,3)
set_pev(Ent,pev_movetype,6)
dllfunc(DLLFunc_Spawn,Ent)
if(r != 0 || g != 0 || b != 0) client_cmd(id,"speak beep.wav")
else if (get_cvar_num("fireworks_colortype")) {
switch(random_num(0,6)) {
case 0: r = 255
case 1: g = 255
case 2: b = 255
case 3:
{
g = 255
b = 255
}
case 4:
{
r = 255
b = 255
}
case 5:
{
r = 255
g = 255
}
case 6:
{
r = 255
g = 128
}
}
}
else
{
r = random_num(0,255)
g = random_num(0,255)
b = random_num(0,255)
}
set_rendering(Ent,kRenderFxGlowShell,r,g,b,kRenderNormal,20)
set_pev(Ent,pev_iuser2,r)
set_pev(Ent,pev_iuser3,g)
set_pev(Ent,pev_iuser4,b)
if (has_drop) emit_sound(Ent, CHAN_WEAPON, "fireworks/weapondrop1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
else emit_sound(Ent, CHAN_WEAPON, "items/weapondrop1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
entity_set_float(Ent,EV_FL_nextthink,halflife_time() + 5.0)
if( (id < 33) && (id > -1) ) player_fireworks[id] += 1;
return PLUGIN_HANDLED
}
public shoot_firework(id){
detonate_fireworks(id,"firework_rc")
detonate_fireworks(id,"firework_rv")
detonate_fireworks(id,"firework_normal")
fireworks_shoot(id,"nrm_fireworks")
return PLUGIN_HANDLED;
}
public fireworks_shoot(id,class[]) {
new ent = find_ent_by_owner(-1,class,id,0);
if(!ent) return 0;
while ( ent != 0 )
{
new tname[200]
entity_get_string(ent,EV_SZ_targetname,tname,199)
entity_set_string(ent,EV_SZ_classname,tname)
set_pev(ent,pev_effects,64)
emit_sound(ent, CHAN_WEAPON, "weapons/rocketfire1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
if (has_rocket) emit_sound(ent, CHAN_VOICE, "fireworks/rocket1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
else emit_sound(ent, CHAN_VOICE, "weapons/rocket1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)
new r,g,b
set_pev(ent,pev_iuser1,get_cvar_num("fireworks_maxlife"))
r = pev(ent,pev_iuser2)
g = pev(ent,pev_iuser3)
b = pev(ent,pev_iuser4)
set_pev(ent,pev_movetype,5)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(22)
write_short(ent)
write_short(sprSmoke)
write_byte(45)
write_byte(4)
write_byte(r)
write_byte(g)
write_byte(b)
write_byte(255)
message_end()
new Float:vVelocity[3]
vVelocity[2] = random_float(400.0,1000.0)
set_pev(ent,pev_velocity,vVelocity)
entity_set_float(ent,EV_FL_nextthink,halflife_time() + 0.1)
ent = find_ent_by_owner(ent, class, id, 0);
}
return PLUGIN_HANDLED
} |
|