| 
                
                  | 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]男女混打(共存) 的1F講解題要 其實就有提及  只是在那邊單純究個案說明  如果你想知道關於這方面其他的資訊  你的問題是...  如何令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 | |  |  |