sakulekingz请教一下.关于write_byte的用法
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(12);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_byte(200);
write_byte(10);
message_end();
} 我在闪亮出场代码结尾部份加了
上面这代码以后.就出现了这个效果
看图 但这像烟花的爆炸特效一出.就有一声似手雷的爆炸声
想问一下怎样把他去掉.又可保留这个特效
我最后所希望做出的效果想和这视频一样
闪亮登场视频
http://www.tudou.com/programs/view/_FUcYG-P-Ks/ create_explo2(const Float:originF)
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION2) // TE id: 12
engfunc(EngFunc_WriteCoord, originF) // x
engfunc(EngFunc_WriteCoord, originF) // y
engfunc(EngFunc_WriteCoord, originF) // z
write_byte(1) // starting color
write_byte(10) // num colors
message_end()
}
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// write_byte(TE_EXPLOSION2)
// write_coord(position.x)
// write_coord(position.y)
// write_coord(position.z)
// write_byte(starting color)
// write_byte(num colors)
这个特效本身都带声音的,应该是无法去掉!
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION)
write_coord(pos)
write_coord(pos)
write_coord(pos)
write_short(spr)
write_byte(scale) // scale in 0.1's
write_byte(framerate) // framerate
write_byte(4) // Do not play the explosion sound
message_end()
试一下
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_short(要显示的SPR);
write_byte(时间);
write_byte(帧速);
write_byte(TE_EXPLFLAG_NOSOUND);//关键代码,这样就没有爆炸声了
message_end();
}你可以把火星效果做成SPR,然后使用上面的代码
你用的代码是没法设置发声的 本帖最后由 点通粉丝 于 2010-2-28 20:55 编辑
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_short(要显示的SPR);
write_byte(时间);
write_byte(帧速);
write_byte(TE_EXPLFLAG_NOSOUND);//关键代码,这样就没有爆炸声了
message_end();
}楼上的代码..己在我总代码上有的一个效果了
而就算用了这代码也做不出我想要的效果.知不
下面这代码才是我想要的效果知不
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(12);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_byte(200);
write_byte(10);
message_end();
}
==========================
在我原来的总代码的结尾部份是这样的
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(TE_EXPLOSION)
write_coord(vec1)
write_coord(vec1)
write_coord(vec1)
write_short(g_lightning)
write_byte(250)
write_byte(180)
write_byte(TE_EXPLFLAG_NOSOUND)
message_end();
}
所以楼上的那段代码上..跟本做不出我所说的烟花爆炸效果
这我也知可运用cs中的spr来做一个 write_short(g_lightning)烟花爆炸效果
但效果不理想...跟视频上那效果差远了 再发个列子代码.让大家帮忙看一下
这是B13手枪杀敌效果.他里面就有一段这样的代码
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(12);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_byte(200);
write_byte(10);
message_end();
}
但问是下面的代码里.他杀人后也会有这像烟花的爆炸效果
但他不会有爆炸声呀.............
我就想问一下他是怎做到的.情形就是这样了 MODULES required: Fakemeta
*/
#include <amxmodx>
#include <fakemeta>
#define V_MODEL "models/v_deagle.mdl"
#define W_MODEL "models/w_357.mdl"
#define P_MODEL "models/p_357.mdl"
#define DEAGLE_W_MODEL "models/w_357.mdl"
new
toggle,toggle_icon,toggle_shake,
toggle_fade,toggle_explode, toggle_mdl,
toggle_light,toggle_dur,p_dur,toggle_hs,p_hs;
new
shake,atack,
iconstatus,screenfade;
new bool:g_Icon;
new white,lightning,g_sModelIndexSmoke;
new g_Hs;
public plugin_init()
{
register_plugin("Deagle Power","2.1.1","anakin_cstrike");
register_forward(FM_SetModel,"fw_setmodel"/*,1*/);
register_event("CurWeapon", "event_curw", "be","1=1");
register_event("DeathMsg","hook_death","a");
toggle = register_cvar("deagle_power","1");
toggle_shake = register_cvar("deagle_power_shake","0");
toggle_icon = register_cvar("deagle_power_icon","1");
toggle_fade = register_cvar("deagle_power_screenflash","0");
toggle_explode = register_cvar("deagle_power_explode","1");
toggle_light = register_cvar("deagle_power_light","1");
toggle_dur = register_cvar("deagle_power_lightduration","6");
toggle_hs = register_cvar("deagle_power_hs","6");
toggle_mdl = register_cvar("deagle_power_model","1");
p_dur = get_pcvar_num(toggle_dur);
p_hs = get_pcvar_num(toggle_hs);
shake = get_user_msgid("ScreenShake");
iconstatus = get_user_msgid("StatusIcon");
screenfade = get_user_msgid("ScreenFade");
}
public client_connect(id) {g_Hs = 0;g_Icon = false;}
public client_disconnect(id) {g_Hs = 0;g_Icon = false;}
public plugin_precache()
{
engfunc(EngFunc_PrecacheModel,V_MODEL);
engfunc(EngFunc_PrecacheModel,P_MODEL);
engfunc(EngFunc_PrecacheModel,W_MODEL);
precache_sound( "ambience/mgun_burst4.wav");
precache_sound( "weapons/headshot2.wav");
precache_sound( "weapons/flashbang-2.wav");
g_sModelIndexSmoke = precache_model("sprites/steam1.spr");
lightning = precache_model("sprites/xenobeam.spr");
white = precache_model("sprites/white.spr");
return PLUGIN_CONTINUE
}
public fw_setmodel(ent,const model[])
{
if(get_pcvar_num(toggle) != 1)
return FMRES_IGNORED;
if(get_pcvar_num(toggle_mdl) != 1)
return FMRES_IGNORED;
if(strcmp(DEAGLE_W_MODEL,model))
return FMRES_IGNORED;
static classname
pev(ent,pev_classname,classname,31);
if(!strcmp(classname, "weaponbox") || !strcmp(classname, "armoury_entity") || !strcmp(classname, "grenade"))
{
engfunc(EngFunc_SetModel,ent,W_MODEL);
return FMRES_SUPERCEDE;
}
return FMRES_IGNORED;
}
public event_curw(id)
{
if(get_pcvar_num(toggle) != 1)
return PLUGIN_CONTINUE;
if(!is_user_alive(id))
return PLUGIN_CONTINUE;
new wID = read_data(2);
if(wID != CSW_DEAGLE)
return PLUGIN_CONTINUE;
set_pev(id,pev_viewmodel2,V_MODEL);
set_pev(id,pev_weaponmodel2,P_MODEL);
atack = pev(id,pev_button)
if(wID == CSW_DEAGLE && get_pcvar_num(toggle_shake) == 1 && atack & IN_ATTACK)
{
message_begin(MSG_ONE,shake,{0,0,0},id);
write_short(1<<13);
write_short(1<<13);
write_short(1<<13);
message_end();
}
return PLUGIN_CONTINUE;
}
public hook_death()
{
if(get_pcvar_num(toggle) != 1)
return PLUGIN_CONTINUE;
static weapon;
read_data(4,weapon,1);
if(weapon != 'd')
return PLUGIN_CONTINUE;
static killer,victim,kname;
killer = read_data(1);
victim = read_data(2);
get_user_name(killer,kname,31);
g_Hs = 0;
if(read_data(3))
{
g_Hs++;
if(get_pcvar_num(toggle_icon) == 1)
{
g_Icon = true;
message_begin(MSG_ONE,iconstatus,{0,0,0},killer);
write_byte(2);
write_string("dmg_shock");
write_byte(255);
write_byte(0);
write_byte(0);
message_end();
set_task(3.0,"reset_icon",killer);
}
if(get_pcvar_num(toggle_explode) == 1)
{
new vorigin,srco;
get_user_origin(victim,vorigin);
vorigin -= 26
srco = vorigin + 30
srco = vorigin + 40
srco = vorigin + 120
switch(random_num(1,3))
{
case 1:
{
emit_sound(0,CHAN_ITEM, "ambience/mgun_burst4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
deagle_thunder(srco,vorigin);
}
case 2:
{
emit_sound(0,CHAN_ITEM, "weapons/headshot2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
deagle_blood(vorigin);
}
case 3:
{
emit_sound(0,CHAN_ITEM, "weapons/flashbang-2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM);
deagle_explode(vorigin);
}
}
}
if(!is_user_alive(victim) && !is_user_bot(victim) && get_pcvar_num(toggle_fade) == 1)
{
message_begin(MSG_ONE_UNRELIABLE,screenfade,{0,0,0},victim);
write_short(6<<10);
write_short(5<<10);
write_short(1<<12);
write_byte(255);
write_byte(0);
write_byte(0);
write_byte(170);
message_end();
}
if(g_Hs == p_hs)
{
set_hudmessage(85, 215, 255, 0.1, 0.20, 0, 6.0, 5.0);
show_hudmessage(0, "%s: Deagle Warrior !",kname);
if(get_pcvar_num(toggle_light) == 1)
{
lights("d");
set_task(float(p_dur),"relights");
}
g_Hs = 0;
}
}
if(g_Icon)
{
g_Icon = false;
message_begin(MSG_ONE,iconstatus,{0,0,0},victim);
write_byte(0);
write_string("dmg_shock");
message_end();
}
return PLUGIN_CONTINUE;
}
deagle_explode(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec1);
write_byte(21);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1 + 16);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1 + 1936);
write_short(white);
write_byte(0);
write_byte(0);
write_byte(2);
write_byte(80);
write_byte(0);
write_byte(188);
write_byte(220);
write_byte(205);
write_byte(60);
write_byte(0);
message_end();
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(12);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_byte(120);
write_byte(10);
message_end();
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec1);
write_byte(5);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_short(g_sModelIndexSmoke);
write_byte(2);
write_byte(10);
message_end();
}
deagle_thunder(vec1,vec2)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(0);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_coord(vec2);
write_coord(vec2);
write_coord(vec2);
write_short(lightning);
write_byte(1);
write_byte(5);
write_byte(2);
write_byte(30);
write_byte(250);
write_byte(200);
write_byte(200);
write_byte(200);
write_byte(200);
write_byte(250);
message_end();
message_begin( MSG_PVS, SVC_TEMPENTITY,vec2);
write_byte(9);
write_coord(vec2);
write_coord(vec2);
write_coord(vec2);
message_end();
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,vec2);
write_byte(5);
write_coord(vec2);
write_coord(vec2);
write_coord(vec2);
write_short(g_sModelIndexSmoke);
write_byte(10);
write_byte(10)
message_end();
}
deagle_blood(vec1)
{
message_begin(MSG_BROADCAST,SVC_TEMPENTITY);
write_byte(10);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
message_end();
}
public reset_icon(id)
{
message_begin(MSG_ONE,iconstatus,{0,0,0},id);
write_byte(0);
write_string("dmg_shock");
message_end();
}
public relights() lights("n");
stock lights(const light[]) return engfunc(EngFunc_LightStyle,0,light); 7# 点通粉丝 等待回答中.......... deagle_explode(vec1)
{
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_LAVASPLASH);
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
message_end();
}试试这个
页:
[1]
2