- 听众
- 收听
- 积分
- 296
- 主题
- 回帖
- 0
- 精华
注册时间2008-4-20
最后登录1970-1-1
该用户从未签到
|
发表于 2011-9-24 23:30:13
|
显示全部楼层
本帖最后由 badmonkey 于 2011-9-24 23:43 编辑
badmonkey 发表于 2011-9-24 13:27
夜视仪的话找到如下(代码可能和你提到的那个不太一样,但是大同小异,你只需该颜色代码就行)
new id ...
/****自定义夜视仪-Flea编拟,版本:1.0
功能:
忽略迷雾半透明效果(官网demo在使用screenfade时夜视仪有无视闪光弹的BUG)
去除默认夜视仪对FPS的压制作用
自定义颜色和其余自定义参数
服务器参数-表示即时生效的参数,~表示推荐启动时配置的参数)
amx_nvgon ~是否启用此插件,默认1启用,0关闭
amx_nvgalways ~为1时玩家是即使没有夜视仪也可以开启,默认0
amx_nvgr -夜视仪红色分量,默认255
amx_nvgg -夜视仪绿色分量,默认255
amx_nvgb -夜视仪蓝色分量,默认255
amx_nvg_rds -光照半径,默认128
amx_nvg_dlt -光照刷新的时间间隔,默认0.3,如果大于amx_nvg_life/10 将偶尔出现闪烁线
amx_nvg_life -单次光照的生命期,默认4,配合amx_nvg_dlt参数一起以达到适合的视觉效果
amx_nvg_decay -光照的衰减率,默认1
模块: cstrike
**********************************/
#include <amxmodx>
#include <cstrike>
const NVGTASKDLT = 123456
new bool:NvgOn[33] //记录开启状态
new pnable,pal
new pr,pg,pb
new pdlt
new prds,plife,pdec
public plugin_init() {
register_plugin("Custom NVG","1.0","Flea")
pnable = register_cvar("amx_nvgon","1")
pal = register_cvar("amx_nvgalways","0")
pr = register_cvar("amx_nvgr","255")//看这里看这里。。。这里参数不用改了,都改好了
pg = register_cvar("amx_nvgg","255")
pb = register_cvar("amx_nvgb","255")
prds = register_cvar("amx_nvg_rds","128")
pdlt = register_cvar("amx_nvg_dlt","0.3")
plife = register_cvar("amx_nvg_life","4")
pdec = register_cvar("amx_nvg_decay","1")
register_clcmd("nightvision","ToggleNvg")
register_event("ResetHUD","cl_start","be")
}
public ToggleNvg(id){
if(!get_pcvar_num(pnable) || !is_user_alive(id)) return PLUGIN_CONTINUE
if(!get_pcvar_num(pal) && !cs_get_user_nvg(id)) return PLUGIN_CONTINUE
if (NvgOn[id]) StopNvg(id)
else StartNvg(id)
return PLUGIN_HANDLED
}
public StartNvg(id){
emit_sound(id,CHAN_ITEM,"items/nvg_on.wav",1.0,ATTN_NORM,0,PITCH_NORM)
NvgLoop(id + NVGTASKDLT)//第一次马上执行
set_task(get_pcvar_float(pdlt),"NvgLoop",id+NVGTASKDLT,_,_,"b")
NvgOn[id] = true
return PLUGIN_HANDLED
}
public StopNvg(id) {
if (!NvgOn[id]) return
emit_sound(id,CHAN_ITEM,"items/nvg_off.wav",1.0,ATTN_NORM,0,PITCH_NORM)
NvgOn[id] = false
remove_task(id+NVGTASKDLT)
}
public NvgLoop(tid) {
new id = tid - NVGTASKDLT
if (!is_user_alive(id) || !get_pcvar_num(pnable)) {//夜视仪打开的状态下玩家死亡,或者服务器参数关闭
StopNvg(id)
return
}
static upos[3]
get_user_origin(id,upos,0)
//夜视仪消息
message_begin(MSG_ONE_UNRELIABLE,SVC_TEMPENTITY,{0,0,0},id)
write_byte(TE_DLIGHT)// 27
write_coord(upos[0]) //玩家坐标
write_coord(upos[1])
write_coord(upos[2])
write_byte(get_pcvar_num(prds)) //半径
write_byte(get_pcvar_num(pr)) // r
write_byte(get_pcvar_num(pg)) // g
write_byte(get_pcvar_num(pb)) // b
write_byte(get_pcvar_num(plife)) // 生命期
write_byte(get_pcvar_num(pdec)) // 衰减率?
message_end()
}
public cl_start(id){ StopNvg(id); }
public client_putinserver(id) { NvgOn[id] = false; }
public client_disconnect(id){ StopNvg(id); }
//源码给你,也给你指了该改的位置。。努力去吧孩子!
|
|