点通粉丝 发表于 2009-1-5 07:21:15

jim_yang 唔该进来帮一下手

本帖最后由 点通粉丝 于 2009-1-5 07:27 编辑

*/
// VERY VERY CPU optimized version.
#include <amxmod>
#define SHOTGUN_AIMING 32
new light;
new tracers, ln, is_cs = 0;
lightning(vec1,vec2)
{
/ ghtning
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( light );
write_byte( 1 ); // framestart
write_byte( 5 ); // framerate
write_byte( 2 ); // life
write_byte( 20 ); // width
//write_byte( 30 ); // noise
write_byte(ln);
write_byte( 200 ); // r, g, b
write_byte( 200 ); // r, g, b
write_byte( 200 ); // r, g, b
write_byte( 200 ); // brightness
write_byte( 200 ); // speed
message_end();
}
tracer(vec1,vec2) {
message_begin(MSG_PAS, SVC_TEMPENTITY,vec1 );
write_byte( 6 ) /* TE_TRACER - see commo/const.h in HLSDK */
write_coord(vec1);
write_coord(vec1);
write_coord(vec1);
write_coord(vec2);
write_coord(vec2);
write_coord(vec2);
message_end();
}
draw(vec1,vec2) {
if(tracers==1) {
tracer(vec1,vec2);
} else {
lightning(vec1,vec2);
}
}
new users_ammo;
new users_w
public drawtracer(id)
{
if(tracers==0) {
return PLUGIN_HANDLED;
}
new ammo = read_data(3), weapon = read_data(2); // I read it only once to save CPU time.
if(users_ammo>ammo && ammo>=0 && users_w==weapon) {
new vec1, vec2;
if(tracers == 2) {
get_user_origin(id,vec1);
vec1+=8;
// For lightnings we do it a special way, 'cause lightnings from eye positon look shit
} else {
get_user_origin(id,vec1,1);
}
if(is_cs==1) {
get_user_origin(id,vec2,4);
} else {
get_user_origin(id,vec2,3);
}
if(is_cs == 1 && (weapon==CSW_M3 || weapon==CSW_XM1014)) { // Shotguns in CS
draw(vec1,vec2);

vec2+=SHOTGUN_AIMING;
draw(vec1,vec2);
vec2+=SHOTGUN_AIMING;
draw(vec1,vec2);
vec2+=SHOTGUN_AIMING;
draw(vec1,vec2);
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
draw(vec1,vec2);
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
draw(vec1,vec2);
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
vec2-=SHOTGUN_AIMING; // Repeated substraction is faster then multiplication !
draw(vec1,vec2);
} else {
draw(vec1,vec2);
}
users_ammo=ammo;
} else {
users_w=weapon;
users_ammo=ammo;
}
return PLUGIN_HANDLED;
}

public checktracervars() {
tracers = get_cvar_num("amx_tracers 2");
ln = get_cvar_num("amx_tracers_ln 30");
}
public amx_settracers(id)
{
new arg1;
new nt;
read_argv(1,arg1,32);
nt = str_to_num(arg1);
if(nt == 1) {
client_print(id,print_console," Advanced Tracers> Tracer mode set to 1, Normal Tracers.");
} else if(nt == 2) {
client_print(id,print_console," Advanced Tracers> Tracer mode set to 2, Lightning Tracers.");
} else if(nt==0 && equal(arg1,"0")) {
client_print(id,print_console," Advanced Tracers> Tracer mode set to 0, No Tracers.");
} else {
client_print(id,print_console," Advanced Tracers> Please type 0, 1 or 2!");
return PLUGIN_HANDLED;
}
tracers = nt;
set_cvar_num("amx_tracers",tracers);
return PLUGIN_HANDLED;
}
public amx_setamplitude(id)
{
new arg1;
new na;
read_argv(1,arg1,32);
na = str_to_num(arg1);
if(na>=0) {
client_print(id,print_console," Advanced Tracers> Amplitude for Lightning Tracers set to %d.",na);
ln = na;
set_cvar_num("amx_tracers_ln",ln);
}
return PLUGIN_HANDLED;
}
public plugin_precache()
{
light = precache_model("sprites/lgtning.spr");
return PLUGIN_CONTINUE;
}
public plugin_init()
{
new modname;
register_plugin("Advanced Tracers","0.1","-g-s-ivan@web.de");
register_event("CurWeapon","drawtracer","be","1=1"); //,"3>=0");
register_cvar("amx_tracers","1")
register_cvar("amx_tracers_ln","30");
register_concmd("amx_settracers","amx_settracers",ADMIN_LEVEL_A,"<0|1|2> Set tracer mode.");
register_concmd("amx_setamplitude","amx_setamplitude",ADMIN_LEVEL_A,"<noise> Noise for lightning tracers.");
set_task(5.0,"checktracervars",0,"",0,"b");
checktracervars();
get_modname(modname,32);
if(equal(modname,"cstrike")) is_cs = 1;
return PLUGIN_CONTINUE;
}

我想将他改做b51这把枪才有那个闪电.请问怎改
不要所有枪一开枪那闪电.闪到眼都花啦
只要B51有就ok啦

点通粉丝 发表于 2009-1-5 07:23:01

在这里这样改好像不行啊..怎办
register_event("CurWeapon","drawtracer","be","1=1","2=18");
改为
register_event("CurWeapon","drawtracer","be","1=1","2=20");

点通粉丝 发表于 2009-1-5 07:26:22

改这亠段那闪电只能射出一两米左右
if(is_cs == 1 && (weapon==CSW_M3 || weapon==CSW_XM1014)) { // Shotguns in CS
draw(vec1,vec2);
真是不会改啊.帮帮手

jim_yang 发表于 2009-1-5 10:05:17

http://forums.alliedmods.net/showthread.php?p=544649
看看这个插件的代码,不过好像没有闪电
页: [1]
查看完整版本: jim_yang 唔该进来帮一下手