| 
                
                  | 文♂   
         
  
 | 分享:        ▼         
 [1.6][插件] [npc有關] 正在寫瞄準npc會出現信息
                      
                        
                        
                          |  x0 | 
 
   複製程式
public ZombiesStatus(id)
{
       if (is_user_alive(id) && !is_user_bot(id))
       {
              new enemy, body, zombie_status[65]
              get_user_aiming(id, enemy, body)
              if (is_user_connected(enemy) || get_user_team(enemy) == 1 || get_user_team(enemy) == 2)
                     return PLUGIN_CONTINUE
              else if (!pev_valid(enemy))
              {
                     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("StatusText"), _, id);
                     write_byte(0);
                     write_string("");
                     message_end();
                     return PLUGIN_CONTINUE
              }
              if (pev_valid(enemy) && !dead[enemy])
              {
                     if (enemy == find_ent_by_class(-1, "zombie"))
                     {
                            if (!evolutioned[enemy])
                                   format(zombie_status, 64, "種類 : 喪屍 - 血量 : %d - 未變種", get_health(enemy)) 
                            else
                                   format(zombie_status, 64, "種類 : 獵人 - 血量 : %d - 已變種", get_health(enemy)) 
                     }
                     message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("StatusText"), _, id);
                     write_byte(0);
                     write_string(zombie_status);
                     message_end();
                     return PLUGIN_CONTINUE
              }
       }
       return PLUGIN_CONTINUE
}
register_forward(FM_PlayerPreThink, "ZombiesStatus");
register_forward(FM_PlayerPostThink, "ZombiesStatus");
 這是我寫的一段語法 奇怪的在遊戲測試 瞄準玩家的時候 本來的消息會消失了   還有的就是瞄準第一隻npc會出現信息 再瞄準第二隻就不會出現了   是不是不可以用get_user_msgid("StatusText")?  
 
 [ 此文章被文♂在2011-07-29 15:18重新編輯 ] 
 
 |  
                  | 
                
                  | 
 |  
                  |  x1  [樓 主]
                    
                    
                     From:香港網上行 |  Posted:2011-07-28 22:01 | |  |  
                
                  | Abcdzxc555 
         
  
 | 分享:        ▲
                    
                      ▼         
 
   把這段複製程式 
                     if (enemy == find_ent_by_class(-1, "zombie")) 
                     { 
                            if (!evolutioned[enemy]) 
                                   format(zombie_status, 64, "種類 : 喪屍 - 血量 : %d - 未變種", get_health(enemy))  
                            else 
                                   format(zombie_status, 64, "種類 : 獵人 - 血量 : %d - 已變種", get_health(enemy))  
                     }
 改成複製程式 
                     new classname[32]
                     pev(enemy, pev_classname, classname, 31)
                     
                     if (equal(classname, "zombie")) 
                     { 
                            if (!evolutioned[enemy]) 
                                   format(zombie_status, 64, "種類 : 喪屍 - 血量 : %d - 未變種", get_health(enemy))  
                            else 
                                   format(zombie_status, 64, "種類 : 獵人 - 血量 : %d - 已變種", get_health(enemy))  
                     }
 應該就沒問題了  
 |  
                  | 
                
                  | 
 |  
                  |  x0  [3 樓]
                    
                    
                     From:香港網上行 |  Posted:2011-07-29 17:24 | |  |  |