|
楼主 |
发表于 2009-1-13 13:51:05
|
显示全部楼层
来自 中国–广东–广州–白云区
- #include <amxmodx>
- #include <fakemeta>
- #define PLUGIN "Solar Flash"
- #define VERSION "1.0"
- #define AUTHOR "anakin_cstrike"
- new
- toggle_plugin, toggle_type, toggle_color,
- toggle_duration, toggle_trail, toggle_light, toggle_vel;
- new g_trail;
- new p_color[16], color[3][4];
- new p_duration, p_type;
- /* Initialization */
- public plugin_init()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR);
-
- register_event("HLTV","nround","a","1=0","2=0");
- register_message(get_user_msgid("ScreenFade"), "screenfade_message");
-
- // Fakemeta Forwards
- register_forward(FM_Touch,"fw_touch");
- register_forward(FM_SetModel,"fw_setmodel",1);
- register_forward(FM_EmitSound,"fw_emitsound");
-
- // Cvars
- toggle_plugin = register_cvar("solarflash","1");
- toggle_type = register_cvar("solarflash_colortype","1");
- toggle_color = register_cvar("solarflash_rgb","255 170 45");
- toggle_duration = register_cvar("solarflash_duration","7");
- toggle_trail = register_cvar("solarflash_trail","1");
- toggle_light = register_cvar("solarflash_light","1");
- toggle_vel = register_cvar("solarflash_velocity","0");
-
- }
- /* Precache */
- public plugin_precache()
- g_trail = precache_model("sprites/laserbeam.spr");
- /* New Round - get cvar value */
- public nround()
- {
- get_pcvar_string(toggle_color, p_color, 15);
- parse(p_color,color[0],3,color[1],3,color[2],3);
- p_duration = get_pcvar_num(toggle_duration);
- p_type = get_pcvar_num(toggle_type);
-
- }
- /* Screenfade - change color */
- public screenfade_message(msgid,msgtype,id)
- {
- if(get_pcvar_num(toggle_plugin) != 1)
- return PLUGIN_CONTINUE;
-
- if(get_msg_arg_int(4) == 255 && get_msg_arg_int (5) == 255 && get_msg_arg_int(6) == 255 && get_msg_arg_int(7) > 199)
- {
- set_msg_arg_int( 1, ARG_SHORT , convert(p_duration) );
- set_msg_arg_int( 2, ARG_SHORT , convert(p_duration) );
- set_msg_arg_int( 4, ARG_BYTE , p_type == 1 ? str_to_num(color[0]) : random(255) );
- set_msg_arg_int( 5, ARG_BYTE , p_type == 1 ? str_to_num(color[1]) : random(255) );
- set_msg_arg_int( 6, ARG_BYTE , p_type == 1 ? str_to_num(color[2]) : random(255) );
- }
-
- return PLUGIN_CONTINUE;
- }
- /* Setmodel forward - glow, trail & change velocity */
- public fw_setmodel(ent,model[])
- {
- if(get_pcvar_num(toggle_plugin) != 1)
- return FMRES_IGNORED;
- if(!equali(model,"models/w_flashbang.mdl"))
- return FMRES_IGNORED;
- set_pev(ent,pev_bInDuck,1);
-
- Render(ent,kRenderFxGlowShell,p_type == 1 ? str_to_num(color[0]) : random(255),p_type == 1 ? str_to_num(color[1]) : random(255),p_type == 1 ? str_to_num(color[2]) : random(255),kRenderNormal,15);
-
- if(get_pcvar_num(toggle_vel) == 1)
- {
- new Float:vel[3];
-
- vel[0] = float(random(300));
- vel[1] = float(random(300));
- vel[2] = float(random(300));
-
- set_pev(ent,pev_velocity,vel);
- }
- if(get_pcvar_num(toggle_trail) == 1)
- Follow(ent,g_trail,10,5,p_type == 1 ? str_to_num(color[0]) : random(255),p_type == 1 ? str_to_num(color[1]) : random(255),p_type == 1 ? str_to_num(color[2]) : random(255),175);
-
- return FMRES_IGNORED;
- }
- /* Touch forward - light effects */
- public fw_touch(touched, toucher)
- {
- if(get_pcvar_num(toggle_plugin) != 1)
- return FMRES_IGNORED;
- if(get_pcvar_num(toggle_light) != 1)
- return FMRES_IGNORED;
-
- if(!pev(toucher,pev_bInDuck))
- return FMRES_IGNORED;
-
- if(!touched)
- {
- new Float:origin[3];
- pev(toucher, pev_origin, origin);
- Light(origin);
-
- }
-
- return FMRES_IGNORED;
- }
- /* Emit sound Forward - set glow back to normal */
- public fw_emitsound(Ent)
- {
- if(pev(Ent,pev_bInDuck))
- Render(Ent,kRenderFxNone,255,255,255,15);
- }
- /* Usefull stocks */
- // fakemeta rendering
- Render(index, fx=kRenderFxNone, r=255, g=255, b=255,render=kRenderNormal,amount=16)
- {
- set_pev(index, pev_renderfx, fx);
- new Float:RenderColor[3];
- RenderColor[0] = float(r);
- RenderColor[1] = float(g);
- RenderColor[2] = float(b);
- set_pev(index, pev_rendercolor, RenderColor);
- set_pev(index, pev_rendermode, render);
- set_pev(index, pev_renderamt, float(amount));
- return 1;
- }
- // set beam follow
- Follow(entity,index,life,width,red,green,blue,alpha)
- {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_BEAMFOLLOW);
- write_short(entity);
- write_short(index);
- write_byte(life);
- write_byte(width);
- write_byte(red);
- write_byte(green);
- write_byte(blue);
- write_byte(alpha);
- message_end();
- }
- // dyanamic light
- Light(Float:origin[3])
- {
- message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
- write_byte(TE_DLIGHT);
- write_coord(floatround(origin[0]));
- write_coord(floatround(origin[1]));
- write_coord(floatround(origin[2]));
- write_byte(10);
- write_byte(p_type == 1 ? str_to_num(color[0]) : random(255));
- write_byte(p_type == 1 ? str_to_num(color[1]) : random(255));
- write_byte(p_type == 1 ? str_to_num(color[2]) : random(255));
- write_byte(5);
- write_byte(20);
- message_end();
- }
- // convert seconds to units
- convert(num) return ((1<<12) * (num));
- o3可以控制闪光的时间源码
复制代码 27# 点通粉丝 |
评分
-
查看全部评分
|