我的ZP伺服器裝了個人類升級插件。複製程式
……
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
……
public fw_TakeDamage(victim, inflictor, attacker, Float:damage, damage_type)
{
// 插件开关
if (!g_pluginenabled) return HAM_IGNORED;
if (victim == attacker || !is_user_connected(attacker))
return HAM_IGNORED;
// 如果是人类攻击
if(!zp_get_user_zombie(attacker))
{
// 攻击倍数
if(g_human_level[attacker][HLU_DAMAGE])
damage *=float(g_human_level[attacker][HLU_DAMAGE])*1.2
//如果满级则不增加经验
if(g_human_level[attacker][HLU_LEVEL] < sizeof LEVELSCORE-1)
{
// 储存伤害值
g_damagedealt[attacker] += floatround(damage)
// 经验值增加
while (g_damagedealt[attacker] > hlu_damage_reward)
{
if(get_user_flags(attacker) & ADMIN_RESERVATION)
{
g_human_level[attacker][HLU_EXPERIENCE] += floatround(float(hlu_experience) * hlu_vip) // VIP获得经验倍数
}else{
g_human_level[attacker][HLU_EXPERIENCE] += hlu_experience // 普通用户获得经验
}
g_damagedealt[attacker] -= hlu_damage_reward
}
for(new i = 0; i < sizeof LEVELSCORE; i++)
{
if(g_human_level[attacker][HLU_EXPERIENCE]<LEVELSCORE[i])
{
if(i>0)
{
g_human_level[attacker][HLU_LEVEL] = i;
g_human_level[attacker][HLU_EXPSCORE] = g_human_level[attacker][HLU_EXPERIENCE] - LEVELSCORE[i-1]; // 当前经验值
g_human_level[attacker][HLU_EXPNEED] = LEVELSCORE[i] - LEVELSCORE[i-1]; // 升级所需经验值
}else{
g_human_level[attacker][HLU_EXPNEED] = 100;
g_human_level[attacker][HLU_EXPSCORE] = g_human_level[attacker][HLU_EXPERIENCE];
}
g_human_level[attacker][HLU_EXPRATE] = floatround(float(g_human_level[attacker][HLU_EXPSCORE]) / float(LEVELSCORE[i] - LEVELSCORE[i-1]) * 100.0) // 升级百分比
break;
}
}
}
SetHamParamFloat(4, damage)
check_leveling_up(attacker); // 检查是否升级了
return HAM_IGNORED;
}
SetHamParamFloat(4,damage)
return HAM_HANDLED
}
……
但是我裝到伺服器裏後,攻擊BOT(不是PODBOT)發現經驗根本不會增加。
只有攻擊PODBOT或者真人,經驗才會增加。
有大大知道這是為什麼嗎?為什麼攻擊CS1.6自帶的BOT不增加經驗?