SMA 音效編寫<這次簡單點...不過還是不懂>

Home Home
引用 | 編輯 timmy3a
2014-07-20 12:41
樓主
推文 x0
這是1個殺人吸血的插件呀~ 部份修改了~
SMA碼如下
------------------------------------------------------------------------------------------------
#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN_VERSION "1.0c"

new health_add
new health_hs_add
new health_max

new nKiller
new nKiller_hp
new nHp_add1
new nHp_add2
new nHp_max


new const HeadShothSound[] = "vm/HEADSHOT.wav";
new const NormalKillSound[] = "vm/NORMALKILL.wav";

public plugin_init()
{
   register_plugin("Vampire", PLUGIN_VERSION, "Shalfey")

   health_add = register_cvar("amx_vampire_hp", "5")
   health_hs_add = register_cvar("amx_vampire_hp_hs", "10")
   health_max = register_cvar("amx_vampire_max_hp", "110")

   register_event("DeathMsg", "hook_death", "a", "1>0")     
}


public plugin_precache()
{
precache_sound(HeadShothSound);
precache_sound(NormalKillSound);
}

public hook_death(id)
{
   // Killer id
   nKiller = read_data(1)
   nKiller_hp = get_user_health(nKiller)
   nHp_max = get_pcvar_num (health_max)

   if ( (read_data(3) == 1) && (read_data(5) == 0) )
   {
        nHp_add1 = get_pcvar_num (health_hs_add)
if ( nKiller_hp < nHp_max )
{
set_user_health(nKiller, nKiller_hp + nHp_add1)
{
      emit_sound(id, CHAN_AUTO, HeadShothSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
  set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
    show_hudmessage(nKiller, "Healed +%d hp", nHp_add1)
}
   }
   else
   {
        nHp_add2 = get_pcvar_num (health_add)
if ( nKiller_hp < nHp_max )
{
set_user_health(nKiller, nKiller_hp + nHp_add2)
{
emit_sound(id, CHAN_AUTO, NormalKillSound, 1.0, ATTN_NORM, 0, PITCH_NORM)
}
  set_hudmessage(0, 255, 0, -1.0, 0.15, 0, 1.0, 1.0, 0.1, 0.1, -1)
    show_hudmessage(nKiller, "Healed +%d hp", nHp_add2)
}


   }


   // Maximum HP check
   if (nKiller_hp > nHp_max) nKiller_hp = nHp_max


}  
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang2067\\ f0\\ fs16 \n\\ par }
*/
------------------------------------------------------------------------------------------------
emit_sound 裡有一些設定碼 <能說明一下有什麼用途嗎??>

/* Constants for emit_sound() */
/* Channels */
#define CHAN_AUTO 0
#define CHAN_WEAPON 1
#define CHAN_VOICE 2
#define CHAN_ITEM 3
#define CHAN_BODY 4
#define CHAN_STREAM 5 /* allocate stream channel from the static or dynamic area */
#define CHAN_STATIC 6 /* allocate channel from the static area  */
#define CHAN_NETWORKVOICE_BASE 7 /* voice data coming across the network */
#define CHAN_NETWORKVOICE_END 500 /* network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). */


/* Attenuation values */
#define ATTN_NONE 0.00
#define ATTN_NORM 0.80
#define ATTN_IDLE 2.00
#define ATTN_STATIC 1.25


/* Pitch values */
#define PITCH_NORM 100 /* non-pitch shifted */
#define PITCH_LOW 95 /* other values are possible - 0-255, where 255 is very high */
#define PITCH_HIGH 120
------------------------------------------------------------------------------------------------
實質插件問題:
1.如何在這插件裡 設定爆頭擊殺時的音效

2.如何在這插件裡 設定普通擊殺時的音效


~ 以上設定TEST 之後都沒有效果的表情

獻花 x0