暴走插件!
本帖最后由 8874323 于 2009-4-28 18:23 编辑#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
#include <fun>
#define fm_get_user_button(%1) pev(%1, pev_button)
new const g_sound_pressure[] = "zombie_plague/zombi_pressure.wav" //声音文件路径
new zmkillcount //用于存储感染人数的变酿
new onrage //此数组每元素用于表示一玩家是否在狂暴状态,0否,1斿
new cvar_spendhp, cvar_rageduration, cvar_xspeed //3个变量分别用于狂暴耗血量,狂暴维持时间,狂暴时速度倍数
public plugin_precache()
{
precache_sound(g_sound_pressure)
return PLUGIN_CONTINUE
}
public plugin_init()
{
register_plugin("Zombie-Rage", "1.0", "ding ding")
cvar_spendhp = register_cvar("zp_rage_spendhp", "1000") //耗费500血
cvar_rageduration = register_cvar("zp_rageduration", "10") //持续12祿
cvar_xspeed = register_cvar("zp_xspeed", "3.5") //狂暴速度为原本速度瘿.5便
register_forward(FM_PlayerPreThink, "fw_playerprethink")
register_event("RoundTime", "roundstart", "bc")
register_event("SendAudio", "roundstart", "a", "1=0")
}
public roundstart() //每开新一局将感染数清零,消除上一局狂暴状徿
{
for ( new i = 0; i < 33; i++ )
{
if( onrage == 1 )
endrage(i)
zmkillcount = 0
}
return PLUGIN_HANDLED
}
public zp_user_infected_post(id, infector)
{
if (zp_get_user_zombie(infector))
zmkillcount += 1 //玩家每感染一人,他的感染计数刿
return PLUGIN_CONTINUE
}
public fw_playerprethink(id)
{
if (onrage ==1) //如果玩家是狂暴状徿
{
set_user_maxspeed(id, (pev(id, pev_maxspeed) * 1.0 * get_pcvar_num(cvar_xspeed)))//就把速度变为2.5便
return FMRES_HANDLED
}
else if (!is_user_alive(id))
return FMRES_IGNORED
else if (!zp_get_user_zombie(id))
return FMRES_IGNORED
else
{
new button = fm_get_user_button(id) //获得玩家按键
if (button & IN_USE && (zmkillcount >= 3) && pev(id, pev_health) > get_pcvar_num(cvar_spendhp) )
{// 如果玩家按下E钿,并且玩家感染了超过3个人类,并且玩家的生命足够开启一次狂昿
onrage = 1 //该玩家狂暴状态设䶿(开启)
engfunc(EngFunc_EmitSound, id, CHAN_VOICE, g_sound_pressure, 1.0, ATTN_NORM, 0, PITCH_NORM) //播放狂暴声音
set_pev(id, pev_health, (pev(id, pev_health)*1.0 - get_pcvar_num(cvar_spendhp))) //生命消羿
set_task(get_pcvar_num(cvar_rageduration)*1.0, "endrage", id) //设置一个任务,在狂暴时间结束后执行
return FMRES_HANDLED
}
}
return FMRES_IGNORED
}
public endrage(id) //此一函数用于在狂暴时间结束后把玩家狂暴状态设置为0(关闭)
{
onrage = 0
return PLUGIN_HANDLED
} 狂暴和无敌差不多吧..就是自身会掉血.如果有无敌了就不需要了吧 谁去试验了?试验过的和我们说说 怎么编译? 转自 modchina 的插件。独孤后人的作品。
目的是模仿CSOL里僵尸暴走的效果。 什么意思? 1.76c.......测试通过....谢谢啦..LZ 测式通过。。不错支持一下 谁在1。8。1下测试过? 支持一下!!!谢谢!
页:
[1]
2