[/color]
//首先需要的模塊
#include <amxmodx>
#include <fakemeta>
#include <fun>
#include <zombieplague>
--------------------------------
//新增項目
const OFFSET_MODELINDEX = 491
const OFFSET_LINUX = 5
new const first_zclass_model[] = { "tank_zombi_origin" } // 殭屍王的模組
new const kzm_kills = 3 // 感染多少人才會進化為殭屍王
new const kkzm_kills = 5 // 感染多少人才會進化為殭屍魔王
//定義變數
new g_kzm_health, g_kkzm_health
new first_zm_model
new zp_gamemode
new bool:g_kzm[33]
new bool:g_kkzm[33]
new infect_num[33]
//CVAR和forward等等
public plugin_init()
{
g_kzm_health = register_cvar("zp_zclass_kzm_health", "7000")
g_kkzm_health = register_cvar("zp_zclass_kkzm_health", "14000")
register_forward(FM_ClientUserInfoChanged, "fw_changemodel")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")//此是要設定在新回合時重新計算變數
}
//緩存模組
public plugin_precache()
{
new model[64]
format(model, 63, "models/player/%s/%s.mdl", first_zclass_model, first_zclass_model)
first_zm_model = precache_model(model)
}
//感染(此地方可直接覆蓋)
public zp_user_infected_post(id, infector)
{
if (zp_gamemode == MODE_INFECTION || zp_gamemode == MODE_MULTI) //注意!! 以下殭屍代碼請自行打上 例如g_zclass_rage<-----此為代碼
{
if (is_user_alive(infector) && zp_get_user_zombie(infector) && zp_get_user_zombie_class(infector) == g_zclass_殭屍代碼)
{
infect_num[infector]++
if (!g_kzm[infector] && !g_kkzm[infector] && infect_num[infector] == kzm_kills)
{
g_kzm[infector] = true
fm_set_user_model(infector, first_zclass_model)
fm_set_user_model_index(infector, first_zm_model)
set_pev(infector, pev_health, float(get_pcvar_num(g_kzm_health)))
client_print(infector, print_chat, "你已進化成為殭屍王")
infect_num[infector] = 0
}
if (g_kzm[infector] && !g_kkzm[infector] && infect_num[infector] == kkzm_kills)
{
g_kkzm[infector] = true
set_pev(infector, pev_health, float(get_pcvar_num(g_kkzm_health)))
client_print(infector, print_chat, "你已進化成為殭屍魔王")
}
}
}
}
public fw_changemodel(id)//直接加上
{
if (g_kzm[id])
{
new current_model[32]
fm_get_user_model(id, current_model, charsmax(current_model))
if (!equal(current_model, first_zclass_model))
{
fm_set_user_model(id, first_zclass_model)
return FMRES_SUPERCEDE;
}
}
return FMRES_IGNORED;
}
public zp_user_humanized_post(id)//請自行找是否有同樣public 如無可直接加上(大部分有)
{
g_kzm[id] = false
g_kkzm[id] = false
infect_num[id] = 0
}
public choose_kzm()//(直接加上)
{
for (new id = 1; id <= 32; id++)
{
if (is_user_alive(id) && zp_get_user_zombie(id) && zp_get_user_zombie_class(id) == g_zclass_殭屍代碼)
{
g_kzm[id] = true
fm_set_user_model(id, first_zclass_model)
fm_set_user_model_index(id, first_zm_model)
}
}
}
public zp_round_started(gamemode, id)//(直接加上)
{
if (gamemode == MODE_INFECTION || gamemode == MODE_MULTI)
set_task(0.1, "choose_kzm", 0)
zp_gamemode = gamemode
}
//stork(直接加上)
stock fm_get_user_model(player, model[], len)
{
get_user_info(player, "model", model, len)
}
stock fm_set_user_model(id, const model[])
{
set_user_info(id, "model", model)
}
stock fm_set_user_model_index(id, value)
{
set_pdata_int(id, OFFSET_MODELINDEX, value, OFFSET_LINUX)
}
[color=#659b28]