谁能帮我改下这个插件

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS个性化修改专区谁能帮我改下这个插件
发帖 回复
倒序阅读 最近浏览的帖子最近浏览的版块
1个回复

谁能帮我改下这个插件

楼层直达
chen06122

ZxID:8499318

等级: 新兵
举报 只看楼主 使用道具 楼主   发表于: 2009-09-05 0
/*================================================================================
* Please don't change plugin register information.
================================================================================*/

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>

#define SUPPORT_BOT_TO_USE //支援BOT使用.(在最前面加上 // 即取消对BOT的技援)
#define DAMAGE_TYPE_IS_INFECT //伤害的型态是使用感染的方式.(在最前面加上 // 即是不使用感染,而是以一般损血的方式)

#if defined DAMAGE_TYPE_IS_INFECT
#define GET_DAMAGE_JUST_INFECT //使用感染的伤害型态时,受到伤害立即感染,不必等血扣光才感染.(在最前面加上 // 即是不会立即感染)
#endif

#define PLUGIN_NAME "[ZP] class:Self Explosion "
#define PLUGIN_VERSION "1.2"
#define PLUGIN_AUTHOR "Jim"

#define Explo_MaxDamage 280 //自爆攻击的最大伤害值(HP),即位置在爆炸最中心的伤害值
#define Explo_MinDamage 80 //自爆攻击的最小伤害值(HP),即位置在爆炸最外围的伤害值
#define Sub_Damage_Value (Explo_MaxDamage - Explo_MinDamage) //最高和最低伤害值的相差数值

// Self Explosion Zombie Attributes
new const zclass_name[] = { "自爆丧尸" } //丧尸名称
new const zclass_info[] = { "能使用自杀爆炸攻击" } //类型说明
new const zclass_model[] = { "zombie_csok" } //人物模组
new const zclass_clawmodel[] = { "v_csok_zombie.mdl" } //手的模组
const zclass_health = 3800 //血量(HP)
const zclass_speed = 220 //移动速度
const Float:zclass_gravity = 1.0 //承受重力
const Float:zclass_knockback = 1.75 //被击退的数值

new const sound_player_die[] = {"player/die1.wav" }
new const sound_player_pain[] = { "player/pl_pain2.wav" }

new bool:use_explo[33]
new bool:explo_started[33]
new g_exploSpr_1, g_exploSpr_2
new g_msgScoreAttrib, g_msgScoreInfo
new g_zclass_explo
new g_explo_range, g_explo_delay

public plugin_init()
{
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

g_explo_range = register_cvar("zp_zclass_explo_range", "200.0") //自爆攻击的有效范围距离
g_explo_delay = register_cvar("zp_zclass_explo_delay", "1.0") //自爆攻击发动后到產生爆炸的延迟时间(单位:秒)

register_forward(FM_PlayerPostThink, "fw_PlayerPostThink", 1)

register_event("ResetHUD","NewRound","be")
register_event("DeathMsg", "Death", "a")

g_msgScoreAttrib = get_user_msgid("ScoreAttrib")
g_msgScoreInfo = get_user_msgid("ScoreInfo")
}

public plugin_precache()
{
engfunc(EngFunc_PrecacheSound, sound_player_die)
engfunc(EngFunc_PrecacheSound, sound_player_pain)
g_exploSpr_1 = engfunc(EngFunc_PrecacheModel, "sprites/fexplo1.spr")
g_exploSpr_2 = engfunc(EngFunc_PrecacheModel, "sprites/explode1.spr")

g_zclass_explo = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
}

public zp_user_infected_post(id, infector)
{
if (zp_get_user_zombie_class(id) == g_zclass_explo)
{
client_print(id, print_chat, "自爆僵尸提示:靠近目标时,按'R'键可以使用自杀爆炸攻击!")
}
}

public zp_user_humanized_post(id)
{
if (use_explo[id])
{
use_explo[id] = false
explo_started[id] = false
fm_set_rendering(id, kRenderFxNone,0,0,0,kRenderNormal, 255)
if (task_exists(id)) remove_task(id)
}
}

public fw_PlayerPostThink(id)
{
if (!is_user_alive(id) || !zp_get_user_zombie(id) || (zp_get_user_zombie_class(id) != g_zclass_explo))
return PLUGIN_CONTINUE

if (zp_get_user_nemesis(id))
return PLUGIN_CONTINUE

if (!use_explo[id])
{
#if defined SUPPORT_BOT_TO_USE
if (is_user_bot(id))
{
// 判断是否是第一隻或是最后一隻丧尸,如果是的话不希望BOT太早使用自爆.
if (zp_get_user_first_zombie(id) || zp_get_user_last_zombie(id))
{
if (get_user_health(id) > 200) //是第一隻或是最后一隻丧尸时,血量少于200才使用自爆.
return PLUGIN_CONTINUE
}
else
{
if (get_user_health(id) > 400) //是第一般丧尸时,血量少于400才使用自爆.
return PLUGIN_CONTINUE
}

new enemy, body
get_user_aiming(id, enemy, body) //检查是否正在瞄準某个目标

if ((1 <= enemy <= 32) && !zp_get_user_zombie(enemy)) //检查是否是有效的目标
{
//new Float:valid_range = floatdiv(get_pcvar_float(g_explo_range), 2)
new Float:valid_range = get_pcvar_float(g_explo_range)

new Float:origin1[3], Float:origin2[3], Float:range
pev(id, pev_origin, origin1);
pev(enemy, pev_origin, origin2);
range = get_distance_f(origin1, origin2);

if (range <= valid_range)
use_explo[id] = true
}
}
else
{
#endif

static button, oldbutton
button = pev(id, pev_button)
oldbutton = pev(id, pev_oldbuttons)

if ((button & IN_RELOAD) && (oldbutton & IN_RELOAD))
use_explo[id] = true

#if defined SUPPORT_BOT_TO_USE
}
#endif
}
else
{
fm_set_rendering(id, kRenderFxGlowShell, 255, 255, 150, kRenderNormal, 100)

if (!explo_started[id])
{
explo_started[id] = true
new Float:delay = get_pcvar_float(g_explo_delay)
if (delay > 0.0)
set_task(delay, "explo_process", id) //开始自爆的时间倒数
else
explo_process(id)
}
}

return PLUGIN_CONTINUE
}

public explo_process(id)
{
if (explo_started[id])
{
new Float:origin[3]
pev(id, pev_origin, origin)
create_sprite(origin, g_exploSpr_1)
create_sprite(origin, g_exploSpr_2)
create_explo2(origin)

new target[32], Float:t_range[32], num, Float:range
range = get_pcvar_float(g_explo_range)
zp_get_in_range_target(id, target, t_range, num, range, 2) //搜寻自爆攻击有效范围内的玩家

new Float:velocity[3]
new damage, health, armor, kills, frags, deaths

#if defined DAMAGE_TYPE_IS_INFECT
new bool:infect_round
if (zp_is_nemesis_round() || zp_is_survivor_round() || zp_is_swarm_round())
infect_round = false
else
infect_round = true
#endif

kills = 0

for (new i = 0; i < num; i++)
{
if (is_user_alive(target))
{
get_speed_vector_to(id, target, 800.0, velocity) //算出弹开时的向量,弹开速度设為800.0
velocity[2] += 50.0 //加上弹开时的跳跃高度50.0
set_pev(target, pev_velocity, velocity)

damage = Explo_MaxDamage - floatround(float(Sub_Damage_Value) * t_range / get_pcvar_float(g_explo_range))
health = get_user_health(target)
armor = get_user_armor(target)

if (armor > 0) // 判断被攻击的人是否有穿护甲,如果有的话,在护甲数值保护的范围内的损血值减低
{
if (armor > damage)
{
fm_set_user_armor(target, armor - damage)
damage -= floatround(float(damage) / 3.0) // 算出扣除护甲保护数值(1/3)后的实际损血量
}
else
{
fm_set_user_armor(target, 0)
damage -= floatround(float(armor) / 3.0) // 算出扣除护甲保护数值(1/3)后的实际损血量
}
}

if (health > damage)
{
#if defined GET_DAMAGE_JUST_INFECT
if (!infect_round || zp_get_user_last_human(target))
{
fm_set_user_health(target, health - damage) //设定玩家血量成扣除损血后的数值
PlaySound(target, sound_player_pain) //播放人物受伤的音效
}
else
{
kills++
zp_infect_user(target) //设定玩家被感染成丧尸
frags = get_user_frags(target)
deaths = get_user_deaths(target) + 1
fm_set_user_deaths(target, deaths)
FixDeadAttrib(target)
Update_ScoreInfo(target, frags, deaths)
}
#else
fm_set_user_health(target, health - damage) //设定玩家血量成扣除损血后的数值
PlaySound(target, sound_player_pain) //播放人物受伤的音效
#endif
}
else
{
kills++

#if defined DAMAGE_TYPE_IS_INFECT
if (!infect_round || zp_get_user_last_human(target))
{
fm_set_user_health(target, 0) //设定玩家為死亡
PlaySound(target, sound_player_die) //播放人物死亡的音效
frags = get_user_frags(target) + 1
deaths = get_user_deaths(target)
fm_set_user_frags(target, frags)
}
else
{
zp_infect_user(target) //设定玩家被感染成丧尸
frags = get_user_frags(target)
deaths = get_user_deaths(target) + 1
fm_set_user_deaths(target, deaths)
}
#else
fm_set_user_health(target, 0) //设定玩家為死亡
PlaySound(target, sound_player_die) //播放人物死亡的音效
frags = get_user_frags(target) + 1
deaths = get_user_deaths(target)
fm_set_user_frags(target, frags)
#endif

FixDeadAttrib(target)
Update_ScoreInfo(target, frags, deaths)
}
}
}

fm_set_user_health(id, 0) //设定玩家為死亡
PlaySound(id, sound_player_die) //播放人物死亡的音效
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + kills)
frags = get_user_frags(id) + 1 + kills
deaths = get_user_deaths(id)
fm_set_user_frags(id, frags)
FixDeadAttrib(id)
Update_ScoreInfo(id, frags, deaths)
}
}

public client_connect(id)
{
use_explo[id] = false
explo_started[id] = false

return PLUGIN_CONTINUE
}

public client_disconnect(id)
{
use_explo[id] = false
explo_started[id] = false

return PLUGIN_CONTINUE
}

public NewRound(id)
{
use_explo[id] = false
explo_started[id] = false
}

public Death()
{
new player = read_data(2)
if (use_explo[player])
{
use_explo[player] = false
explo_started[player] = false
fm_set_rendering(player, kRenderFxNone,0,0,0,kRenderNormal, 255)
if (task_exists(player)) remove_task(player)
}
}

stock zp_get_in_range_target(id, target[32], Float:target_range[32], &target_num, Float:range, flag = 0) // flag: 0=Different, 1=Zombie, 2=Human
{
new Float:origin1[3], Float:origin2[3]
pev(id, pev_origin, origin1);

target_num = 0

static i, Float:i_range
for (i = 1; i <= 32; i++)
{
if ((i != id) && is_user_alive(i))
{
pev(i, pev_origin, origin2);
i_range = get_distance_f(origin1, origin2);

if (i_range <= range)
{
if ((flag == 0) && (zp_get_user_zombie(id) != zp_get_user_zombie(i)))
{
target[target_num] = i
target_range[target_num] = i_range
target_num++
}
else if ((flag == 1) && zp_get_user_zombie(i))
{
target[target_num] = i
target_range[target_num] = i_range
target_num++
}
else if ((flag == 2) && !zp_get_user_zombie(i))
{
target[target_num] = i
target_range[target_num] = i_range
target_num++
}
}
}
}
}

stock fm_set_rendering(entity, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16)
{
new Float:RenderColor[3];
RenderColor[0] = float(r);
RenderColor[1] = float(g);
RenderColor[2] = float(b);

set_pev(entity, pev_renderfx, fx);
set_pev(entity, pev_rendercolor, RenderColor);
set_pev(entity, pev_rendermode, render);
set_pev(entity, pev_renderamt, float(amount));

return 1;
}

stock get_speed_vector_to(ent1, ent2, Float:speed, Float:new_velocity[3])
{
if(!pev_valid(ent1) || !pev_valid(ent2))
return 0;

static Float:origin1[3]
pev(ent1,pev_origin,origin1)
static Float:origin2[3]
pev(ent2,pev_origin,origin2)

new_velocity[0] = origin2[0] - origin1[0];
new_velocity[1] = origin2[1] - origin1[1];
new_velocity[2] = origin2[2] - origin1[2];

static Float:num
num = speed / vector_length(new_velocity);

new_velocity[0] *= num;
new_velocity[1] *= num;
new_velocity[2] *= num;

return 1;
}

stock fm_set_user_health(index, health)
{
health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index);

return 1;
}

stock fm_set_user_armor(index, armor)
{
set_pev(index, pev_armorvalue, float(armor));

return 1;
}

stock fm_set_user_frags(index, frags)
{
set_pev(index, pev_frags, float(frags));

return 1;
}

#if defined DAMAGE_TYPE_IS_INFECT
stock fm_set_user_deaths(index, deaths) // Set User Deaths
{
set_pdata_int(index, 444, deaths, 5)
}
#endif

create_sprite(const Float:originF[3], sprite_index)
{
// 在设定座标点產生一个 Sprite 物件
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_SPRITE) // TE id (Additive sprite, plays 1 cycle)
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_short(sprite_index) // sprite index
write_byte(10) // scale in 0.1's
write_byte(200) // brightness
message_end()
}

create_explo2(const Float:originF[3])
{
// 在设定座标点產生爆炸效果
message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
write_byte(TE_EXPLOSION2) // TE id: 12
engfunc(EngFunc_WriteCoord, originF[0]) // x
engfunc(EngFunc_WriteCoord, originF[1]) // y
engfunc(EngFunc_WriteCoord, originF[2]) // z
write_byte(1) // starting color
write_byte(10) // num colors
message_end()
}

PlaySound(id, const sound[])
{
if (equal(sound[strlen(sound)-4], ".mp3"))
client_cmd(id, "mp3 play ^"sound/%s^"", sound)
else
client_cmd(id, "spk ^"%s^"", sound)
}

FixDeadAttrib(id) // Fix Dead Attrib on scoreboard
{
message_begin(MSG_BROADCAST, g_msgScoreAttrib)
write_byte(id) // id
write_byte(0) // attrib
message_end()
}

Update_ScoreInfo(id, frags, deaths) // Update Player's Frags and Deaths
{
// Update scoreboard with attacker's info
message_begin(MSG_BROADCAST, g_msgScoreInfo)
write_byte(id) // id
write_short(frags) // frags
write_short(deaths) // deaths
write_short(0) // class?
write_short(get_user_team(id)) // team
message_end()
}


我想改成按"E"键自爆,但我找不到在哪里改
lioujieu520

ZxID:2290358

等级: 中校
靠!连神仙都不讲义气!不用说了!我的兄弟们肯定都站在那边去了

举报 只看该作者 沙发   发表于: 2009-09-08 0
我搞不来啊 试试这个插件嘛 很好耍的

http://bbs.1v16.com/r166415/
哎!!没办法啊!!人长得帅!!连裸体都漂亮!!
« 返回列表
发帖 回复