AykinDalike
|
分享:
▲
▼
下面是引用 doroemon 于 2010-01-08 21:25 发表的 ZP高手请帮帮忙.......: 请问如何令ZP会有以下功能: 10人以下有1只头尸;10~20人有2只头尸;20~28人有3只头尸;28人以上有3只头尸
我虽然看了这篇教学文,但都是看不懂: http://bbs.mychat.to/reads.php?tid=836806
各位大大请帮帮忙,非常感谢! 就容我来回答你吧 人数区分在主插件的基本款有三种 1. 活着的人数判定 fnGetAlive() 2. 僵尸人数的判定 fnGetZombies() 3. 人类人数的判定 fnGetHumans() 待会都会用到。 [ZP]男女混打(共存)的1 F讲解题要其实就有提及 只是在那边单纯究个案说明 如果你想知道关于这方面其他的资讯 你的问题是... 如何令10人 以下有1只僵尸王;10~20人有2只僵尸王;20~28人有3只僵尸王;28人以上有4只僵尸王?? 步骤一 在// CVAR pointers加入以下...( 蓝色) // CVAR pointers cvar_10human_2zombies, cvar_20human_3zombies, cvar_28above_4zombies, 步骤二 在// CVARS - General Purpose加入以下三点...( 蓝色) // CVARS - General Purpose cvar_10human_2zombies = register_cvar("zp_10human_2zombies", "0") cvar_20human_3zombies = register_cvar("zp_20human_3zombies", "0") cvar_28above_4zombies = register_cvar("zp_28above_4zombies", "0") 步骤三 为了在新回合开始前,让系统先『自动』判定人数,所以加在warmup的部分...( 蓝色) 你会在consle看到随着人数多寡,插件会自动转换条件。意思就是如果这步骤省略不写的话... 以上步骤一、二也可以拿出来个别当指令在控制台下达,变成『手动』的。 // Set a new "Make Zombie Task" remove_task(TASK_MAKEZOMBIE) set_task(2.0+random_float(get_pcvar_float(cvar_warmup), get_pcvar_float(cvar_warmup)+3.0), "make_zombie_task", TASK_MAKEZOMBIE)
// Default CVAR Definitions client_cmd(0,"zp_10human_2zombies 0"); client_cmd(0,"zp_20human_3zombies 0"); client_cmd(0,"zp_28above_4zombies 0")
// Analyze the Quantity of Players Automatically if (fnGetAlive() >= 10) { client_cmd(0,"zp_10human_2zombies 1") } if (fnGetAlive() >= 20) { client_cmd(0,"zp_20human_3zombies 1") } if (fnGetAlive() >= 28) { client_cmd(0,"zp_28above_4zombies 1") } 步骤四 重头戏,照你的需求帮你设定好了,以下...( 蓝色) // Single Infection Mode g_lastmode = MODE_INFECTION if (fnGetHumans() > 1) { // Turn player into the first zombie zombieme(id, 0, 0, 0) } if (fnGetHumans() >= 9 && get_pcvar_num(cvar_10human_2zombies)) { // Turn player into the first zombie while (g_zombie[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum)); zombieme(id, 0, 0, 0) } if (fnGetHumans() >= 18 && get_pcvar_num(cvar_20human_3zombies)) { // Turn player into the first zombie while (g_zombie[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum)); zombieme(id, 0, 0, 0) } if (fnGetHumans() >= 25 && get_pcvar_num(cvar_28above_4zombies)) { // Turn player into the first zombie while (g_zombie[id]) id = fnGetRandomAlive(random_num(1, iPlayersnum)); zombieme(id, 0, 0, 0) } 步骤五 关键时刻,设定前四步骤被定义的人数条件下出现的僵尸皆为僵尸王(firstzombie)...( 蓝色) else if (fnGetZombies() == 1) { // First zombie g_firstzombie[id] = true // Set health and gravity fm_set_user_health(id, floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp))) set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]]) // Infection sound engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM) } else if (fnGetZombies() == 2 && get_pcvar_num(cvar_10human_2zombies)) { // First zombie g_firstzombie[id] = true // Set health and gravity fm_set_user_health(id, floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp))) set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]]) // Infection sound engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM) } else if (fnGetZombies() == 3 && get_pcvar_num(cvar_20human_3zombies)) { // First zombie g_firstzombie[id] = true // Set health and gravity fm_set_user_health(id, floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp))) set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]]) // Infection sound engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM) } else if (fnGetZombies() == 4 && get_pcvar_num(cvar_28above_4zombies)) { // First zombie g_firstzombie[id] = true // Set health and gravity fm_set_user_health(id, floatround(g_zclass_hp[g_zombieclass[id]]*get_pcvar_float(cvar_zombiefirsthp))) set_pev(id, pev_gravity, g_zclass_grav[g_zombieclass[id]]) // Infection sound engfunc(EngFunc_EmitSound, id, CHAN_VOICE, zombie_infect[random_num(0, sizeof zombie_infect - 1)], 1.0, ATTN_NORM, 0, PITCH_NORM) } 搞定!! 你还可以加上这篇的内容 http://bbs.mychat.to/reads.php?tid=838765 会让你更容易辨别谁是"僵尸王" 喜欢的话..就给点掌声吧!!
[ 此文章被AykinDalike在2010-01-10 15:26重新编辑 ]
此文章被评分,最近评分记录财富:200 (by amore12) | 理由: 辛苦了.. | |
|
|
|
|
x8
[7 楼]
From:台湾中嘉宽频 | Posted:2010-01-10 00:27 |
|
|
|