搜索
查看: 2901|回复: 4

关于ultimate_sounds,请高手帮忙

[复制链接]
发表于 2009-7-9 23:34:43 | 显示全部楼层 |阅读模式 来自 中国–宁夏–银川
/* AMX Mod script.
*
* ::Ultimate sounds::
*  by Hephaistos (hephaistos@djeyl.net)
*
*    First Blood
* First kill since round start
*    firstblood_mode < flags >
*       "a" - messages
*       "b" - sounds
*
*
*    Head Shot
* It's all in the name
*    hs_mode < flags >
*       "a" - messages
*       "b" - sounds
*
*
*    Multi Kill
* Multiple kills, max 3 sec in between
*    multi_mode < flags >
*       "a" - messages
*       "b" - sounds
*
*
*    Killing Spree
* Multiple kills without dying
*    spree_mode < flags >
*       "a" - messages
*       "b" - sounds
*
*
*    C4
*
*    bomb_mode < flags >
*       "a" - exploded
*       "b" - planting
*       "c" - defusing
*       "d" - planted
*       "e" - defused
*       "f" - failed to defuse
*       "g" - pickup
*       "h" - dropped
*       "i" - sounds
*
*
*    HE Kills
* HE-Kills
*    hekill_mode < flags >
*       "a" - show normal HE-Kill in hud
*       "b" - show suicide HE-Kill in hud
*       "c" - sounds
*
*
*    Knife Kills
* Knife Kills
*    knife_mode < flags >
*       "a" - messages
*       "b" - sounds
*
*    Last Man
*
*    lastman_mode < flags >
*       "a" - messages
*       "b" - hp
*       "c" - sounds
*
*   Thanks to ToT|V!PER, OLO, JustinHoMi, PsychoGuard and dJeyL for your plugins
*
*
*/





#include <amxmod>

#define KNIFF_MESSAGES   4
#define HE_MESSAGES   4          /* Number of Random Messages for Normal HE Kills */
#define HE_SMESSAGES  4          /* Number of Random Messages for Suicide HE Kills */
#define LAST_MESSAGES_NOHP 4
#define LAST_MESSAGES_HP 4

new planter
new defuser
new c4timer
new defusing
new Float:last_omg
new Float:last_plan
new alone_ann = 0

#define MULTI_START 2
#define MULTI_STEP 1
#define MULTI_LEVELS 4
#define MULTI_INTERVAL 3.0

#define SPREE_START 5
#define SPREE_STEP 5
#define SPREE_LEVELS 5
#define SPREE_TOP SPREE_START + SPREE_STEP * (SPREE_LEVELS - 1)

new bool:first = true

new multi_timer[33] = {0,...}
new multi_count[33] = {0,...}
new multi_messages[MULTI_LEVELS][] = {
   "%s: Double Kill!!",
   "%s: Multi-Kill!",
   "%s: Ultra-Kill!!!",
   "%s: Monster-kill!!!"
}

new multi_sounds[MULTI_LEVELS][] = {
   "misc/doublekill.wav",
   "misc/multikill.wav",
   "misc/ultrakill.wav",
   "misc/monsterkill.wav"
}

new spree_count[33] = {0,...}
new spree_messages[SPREE_LEVELS][] = {
   "%s is on a killing spree!",
   "%s is on a rampage!",
   "%s is dominating!",
   "%s is unstoppable!",
   "%s is Godlike!"
}
new spree_sounds[SPREE_LEVELS][] = {
   "misc/killingspree.wav",
   "misc/rampage.wav",
   "misc/dominating.wav",
   "misc/unstoppable.wav",
   "misc/godlike.wav"
}

new Blue[3] = {0,63,191}
new Red[3] = {255,0,0}
new Orange[3] = {200,100,0}

new kniff_messages[KNIFF_MESSAGES][] = {
"%s sliced and diced %s",
"%s pulled out knife and gutted %s",
"%s sneaks carefully behind and knifed %s",
"%s knived %s"}

new he_messages[HE_MESSAGES][] = {
"%s sends a little gift to %s",  
"%s throws a small present to %s",  
"%s made a precision throw to %s",  
"%s got a big explosion for %s"}        /* Random Messages for Normal HE Kills */

new hes_messages[HE_SMESSAGES][] = {
"%s detonated himself with a grenade",  
"%s trys the effect of a HE Grenade",  
"%s kicked a grenade into his own ass",  
"%s explodes!"}              /* Random Messages for Suicide HE Kills */

new last_messages_nohp[LAST_MESSAGES_NOHP][] = {"%i terrorist vs %i CT^n%s: Now all depend on you!",
"%i terrorist vs %i CT^n%s: I hope you still have a healthpack.",
"%i terrorist vs %i CT^n%s: All your teammates were killed. Good luck!",
"%i terrorist vs %i CT^n%s: Now you are alone. Have fun!"}

new last_messages_hp[LAST_MESSAGES_HP][] = {"%i terrorist vs %i CT^n%s (%i hp): Now all depend on you!",
"%i terrorist vs %i CT^n%s (%i hp): I hope you still have a healthpack.",
"%i terrorist vs %i CT^n%s (%i hp): All your teammates were killed. Good luck!",
"%i terrorist vs %i CT^n%s (%i hp): Now you are alone. Have fun!"}

get_bemode() {
   new bemode[10]
   get_cvar_string("bomb_mode",bemode,9)
   return read_flags(bemode)
}


get_spree() {
   new spree[3]
   get_cvar_string("spree_mode",spree,2)
   return read_flags(spree)
}


get_multi() {
   new multi[3]
   get_cvar_string("multi_mode",multi,2)
   return read_flags(multi)
}


public reset_multi(param[]){
   new id = param[0]
   multi_timer[id] = 0
   multi_count[id] = 0
}

public client_putinserver(id){
   reset_all(id)
   return PLUGIN_CONTINUE   
}

public reset_all(id){
   if (multi_timer[id]){
      remove_task(id)
      multi_timer[id] = 0
   }
   multi_count[id] = 0
   spree_count[id] = 0
}

public say_spree(id){
   new name[32]
   new spree_level
   new message[128]

   spree_level = (spree_count[id] - SPREE_START) / SPREE_STEP
   if (spree_level > SPREE_LEVELS - 1) {
      spree_level = SPREE_LEVELS - 1;
   }
   new spree = get_spree()
   if (spree&1){
      get_user_name(id,name,31)
      format(message,127,spree_messages[spree_level],name)
      set_hudmessage(Blue[0], Blue[1], Blue[2], 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
      show_hudmessage(0,message)
      client_print(0,print_chat,"* %s",message)
   }
   if (spree&2){
      client_cmd(0,"spk %s",spree_sounds[spree_level])
   }
}

public say_multi(id){
   new name[32]
   new multi_level

   multi_level = (multi_count[id] - MULTI_START) / MULTI_STEP
   if (multi_level > MULTI_LEVELS - 1) {
      multi_level = MULTI_LEVELS - 1;
   }
   new multi = get_multi()
   if (multi&1){
      get_user_name(id,name,31)
      set_hudmessage(Red[0], Red[1], Red[2], 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
      show_hudmessage(0,multi_messages[multi_level],name)
   }
   if (multi&2){
      client_cmd(0,"spk %s",multi_sounds[multi_level])
   }
}
 楼主| 发表于 2009-7-9 23:35:36 | 显示全部楼层 来自 中国–宁夏–银川
public death_event(){
   new killer = read_data(1)
   new victim = read_data(2)
   new name_v[32]
   new message[128]
   get_user_name(victim,name_v,31)

   if (killer == victim){
      if (spree_count[victim] >= SPREE_START){
         format(message,127,"%s was looking good till he killed himself!",name_v)
         set_hudmessage(Blue[0], Blue[1], Blue[2], 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)     
         show_hudmessage(0,message)
         client_print(0,print_chat,"* %s",message)
      }
   } else {
      if (killer){
         new name_k[32]
         get_user_name(killer,name_k,31)

         if (spree_count[victim] >= SPREE_START){
            format(message,127,"%s's killing spree was ended by %s",name_v,name_k)
            set_hudmessage(Blue[0], Blue[1], Blue[2], 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
            show_hudmessage(0,message)
            client_print(0,print_chat,"* %s",message)
         }
         if (get_user_team(killer) != get_user_team(victim)){
            if (first){
               first = false
               new fbmode[3]
               get_cvar_string("firstblood_mode",fbmode,2)
               new fbmode_bit = read_flags(fbmode)
               if (fbmode_bit & 1) {
                  format(message,127,"%s drew first blood!",name_k)
                  set_hudmessage(Red[0], Red[1], Red[2], 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2)
                  show_hudmessage(0,message)
                  client_print(0,print_chat,"* %s",message)
               }
               if (fbmode_bit & 2) {
                  client_cmd(0,"spk misc/firstblood.wav")
               }
            }
            if (multi_timer[killer]){
               remove_task(killer)
               multi_timer[killer] = 0
            }
            multi_count[killer]++
            if (multi_count[killer] >= MULTI_START && (multi_count[killer] - MULTI_START) % MULTI_STEP == 0){
               say_multi(killer)
            }
            new param[2]
            param[0] = killer
            set_task(MULTI_INTERVAL,"reset_multi",killer,param,1)

            spree_count[killer]++
            if (spree_count[killer] >= SPREE_START && spree_count[killer] <= SPREE_TOP && (spree_count[killer] - SPREE_START) % SPREE_STEP == 0){
               say_spree(killer)
            }
         }
      }
   }
   reset_all(victim)
}




public got_bomb(id){
   new bemode = get_bemode()
   if (bemode&1){
      planter = id
      defuser = defusing = 0
      if ((read_data(1)==2) && (last_omg < get_gametime())){
         new bplayers_t[32], numte
         get_players(bplayers_t,numte,"e","TERRORIST")
         last_omg = get_gametime() + 15.0
         new name[32]
         get_user_name(planter, name , 32)
         set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
         show_hudmessage(bplayers_t[0],"Omg! %s reached the target!",name)
      }
   }
}
public bdef_g(id){
   new bemode = get_bemode()
   if (read_data(1) == 3){
      if (last_plan < get_gametime()){
         if (bemode&2){
            new bplayers_t[32], numte
            get_players(bplayers_t,numte,"e","TERRORIST")
            last_plan = get_gametime() + 15.0
            new name[32]
            set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
            get_user_name(planter, name , 32)
            show_hudmessage(bplayers_t[0],"%s is planting the bomb!",name)
         }
      }
   }
   else {
      defuser = defusing = id   
      if (last_plan < get_gametime()){
         if (bemode&4){
            new bplayers_ct[32], numct
            get_players(bplayers_ct,numct,"e","CT")
            last_plan = get_gametime() + 15.0
            new name[32]
            set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
            get_user_name(defusing, name , 32)
            show_hudmessage(bplayers_ct[0],"%s is defusing the bomb ",name)
         }
      }
   }
}
public bdef_l(id)
   defusing = 0
public disable_c4(){
   c4timer = 0
   last_plan = 0.0
   last_omg = 0.0
   remove_task(8038)
}
public bomb_planted(){
   new bemode = get_bemode()
   if (bemode&256){
   client_cmd(0,"spk djeyl/c4powa")
   }
   if (bemode&8){
      new name[32]
      get_user_name(planter, name , 32)
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(0,"%s set us up the bomb!!!",name)
      c4timer = get_cvar_num("mp_c4timer") - 2
      set_task(1.0,"bomb_c",8038,"",0,"b")
      last_plan = 0.0
   }
}
public bomb_c(){
   new bemode = get_bemode()
   if (--c4timer > 0){
      if (c4timer == 30 || c4timer == 20){
         if (bemode&256){
         new temp[48]
         num_to_word(c4timer,temp,48)
         client_cmd(0,"spk ^"vox/%s seconds until explosion^"",temp)
         }
      }
      else if (c4timer < 11){
         if (bemode&256){
         new temp[48]
         num_to_word(c4timer,temp,48)
         client_cmd(0,"spk ^"vox/%s^"",temp)
         }
      }
      if (defusing)
         client_print(defusing,print_center,"%d",c4timer)
   }
   else{
      remove_task(8038)
   }
}
public bomb_defused(){
   new bemode = get_bemode()
   if (bemode&256){
   client_cmd(0,"spk djeyl/laugh")
   }
   if (bemode&16){
      new name[32]
      get_user_name(defuser, name , 32)
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(0,"%s defused the bomb!",name)
      disable_c4()
   }
}
回复

使用道具 举报

 楼主| 发表于 2009-7-9 23:36:10 | 显示全部楼层 来自 中国–宁夏–银川
public bomb_failure(){
   new bemode = get_bemode()
   if (defuser){
      if (bemode&256){
      client_cmd(0,"spk djeyl/witch")
      }
      if (bemode&32){
         new name[32]
         get_user_name(defuser, name , 32)
         set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
         show_hudmessage(0,"%s  failed to defuse the bomb...",name)
      }
   }
}
public bomb_pickup(id){
   new bemode = get_bemode()
   if (bemode&64){
      new bplayers_t[32], numte
      get_players(bplayers_t,numte,"e","TERRORIST")
      new name[32]
      get_user_name(id, name , 32)
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(bplayers_t[0],"%s pick up the bomb...",name)
   }
}
public bomb_drop(){
   new bemode = get_bemode()
   if (bemode&128){
      new bplayers_t[32], numte
      get_players(bplayers_t,numte,"e","TERRORIST")
      new name[32]
      get_user_name(planter, name , 32)
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(bplayers_t[0],"%s dropped the bomb!!!",name)
   }
}






public he_kills(){
   new killer_id = read_data(1)
   new victim_id = read_data(2)
   new killer_name[32], victim_name[33]
   
   get_user_name(killer_id,killer_name,33)
   get_user_name(victim_id,victim_name,33)

   new hekmode[8]
   get_cvar_string("hekill_mode",hekmode,8)
   new hekmode_bit = read_flags(hekmode)

   if (hekmode_bit & 1) {
    if (victim_id != killer_id)
     {
   if (hekmode_bit & 4) {
     client_cmd(0,"spk djeyl/grenade")
   }
   set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
   show_hudmessage(0,he_messages[ random_num(0,HE_MESSAGES-1)],killer_name,victim_name)
     }
   }

   if (hekmode_bit & 2) {
    if (victim_id == killer_id)
     {
   if (hekmode_bit & 4) {
     client_cmd(0,"spk djeyl/witch")
   }
   set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
   show_hudmessage(0,hes_messages[ random_num(0,HE_SMESSAGES-1) ],victim_name)
     }
   }

}






public knife_kill(){

   new kniffmode[4]
   get_cvar_string("kniff_mode",kniffmode,4)
   new kniffmode_bit = read_flags(kniffmode)

   if (kniffmode_bit & 1) {
   new killer_id = read_data(1)
   new victim_id = read_data(2)
   new killer_name[33], victim_name[33]

   get_user_name(killer_id,killer_name,33)
   get_user_name(victim_id,victim_name,33)


   set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
   show_hudmessage(0,kniff_messages[ random_num(0,KNIFF_MESSAGES-1) ],killer_name,victim_name)
   }
   if (kniffmode_bit & 2) {
   client_cmd(0,"spk misc/humiliation")
   }
}


public roundend_msg(id){
   alone_ann = 0
   first = true
}

public death_msg(id){

   new lmmode[8]
   get_cvar_string("lastman_mode",lmmode,8)
   new lmmode_bit = read_flags(lmmode)

   new players_ct[32], players_t[32], ict, ite, last
   get_players(players_ct,ict,"ae","CT")   
   get_players(players_t,ite,"ae","TERRORIST")   
   if (ict==1&&ite==1){
      new name1[32], name2[32]
      get_user_name(players_ct[0],name1,32)
      get_user_name(players_t[0],name2,32)
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      if (lmmode_bit & 1){
         if (lmmode_bit & 2){
         show_hudmessage(0,"%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))
         }
         else {
         show_hudmessage(0,"%s vs. %s",name1,name2)
         }
         if (lmmode_bit & 4){
         client_cmd(0,"spk misc/maytheforce")
         }
      }
   }
   else {   
      if (ict==1&&ite>1&&alone_ann==0&&(lmmode_bit & 4)){
         last=players_ct[0]
         client_cmd(last,"spk misc/oneandonly")
      }
      else if (ite==1&&ict>1&&alone_ann==0&&(lmmode_bit & 4)){
         last=players_t[0]
         client_cmd(last,"spk misc/oneandonly")
      }
      else {
         return PLUGIN_CONTINUE
      }
      alone_ann = last
      new name[32]   
      get_user_name(last,name,32)

      if (lmmode_bit & 1){
      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      if (lmmode_bit & 2){
      show_hudmessage(0,last_messages_hp[ random_num(0,LAST_MESSAGES_HP-1) ],ite ,ict ,name,get_user_health(last))
      }
      else {
      show_hudmessage(0,last_messages_nohp[ random_num(0,LAST_MESSAGES_NOHP-1) ],ite ,ict ,name )
      }
   }
      if (lmmode_bit & 4){
      client_cmd(last,"spk misc/maytheforce")
      }
   }
   return PLUGIN_CONTINUE   
}


public hs(){
   new hsmode[4]
   get_cvar_string("hs_mode",hsmode,4)
   new hsmode_bit = read_flags(hsmode)
   if (hsmode_bit & 1){
      new killer_id = read_data(1)
      new victim_id = read_data(2)
      new victim_name[33]

      get_user_name(victim_id,victim_name,33)

      set_hudmessage(Orange[0], Orange[1], Orange[2], -1.0, 0.30, 0, 3.0, 3.0, 0.15, 0.15, 1)
      show_hudmessage(killer_id,"::HEADSHOT::^nYou oWnEd %s !!",victim_name)
   }
   if (hsmode_bit & 2){
      client_cmd(0,"spk misc/headshot")
   }
}

public plugin_precache()
{
    for (new i=0; i < MULTI_LEVELS; i++){
       precache_sound(multi_sounds)
    }
    for (new i=0; i < SPREE_LEVELS; i++){
      precache_sound(spree_sounds)
    }
    precache_sound( "djeyl/c4powa.wav")
    precache_sound( "djeyl/laugh.wav")
    precache_sound( "djeyl/grenade.wav")
    precache_sound( "djeyl/witch.wav")
    precache_sound( "misc/firstblood.wav")
    precache_sound( "misc/headshot.wav")
    precache_sound( "misc/humiliation.wav")
    precache_sound( "misc/maytheforce.wav")
    precache_sound( "misc/oneandonly.wav")
    return PLUGIN_CONTINUE
}



public plugin_init() {
   register_plugin("Ultimate sound","0.76","hephaistos@djeyl.net")
   register_event("DeathMsg","hs","a","3=1")
   register_event("DeathMsg","knife_kill","a","4&kni")
   register_event("DeathMsg","he_kills","a","4&gren")
   register_event("StatusIcon", "got_bomb", "be", "1=1", "1=2", "2=c4")
   register_event("SendAudio", "bomb_planted", "a", "2&%!MRAD_BOMBPL")
   register_event("SendAudio", "bomb_defused", "a", "2&%!MRAD_BOMBDEF")
   register_event("TextMsg", "bomb_failure", "a", "2&#Target_B")
   register_event("BarTime", "bdef_g", "be", "1=10", "1=5","1=3")
   register_event("BarTime", "bdef_l", "be", "1=0")
   register_event("TextMsg", "bomb_pickup", "bc", "2&#Got_bomb")
   register_event("TextMsg", "bomb_drop", "bc", "2&#Game_bomb_d")
   register_event("SendAudio", "disable_c4", "a", "2&%!MRAD_terwin","2&%!MRAD_ctwin","2&%!MRAD_rounddraw")
   register_event("TextMsg","disable_c4","a","2&#Game_C","2&#Game_w")
   register_event("DeathMsg", "death_event", "a")
   register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
   register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w")
   register_event("DeathMsg","death_msg","a")
   register_cvar("lastman_mode","abc")
   register_cvar("spree_mode","ab")
   register_cvar("multi_mode","ab")
   register_cvar("firstblood_mode","ab")
   register_cvar("bomb_mode","abcdefghi")
   register_cvar("hekill_mode","abc")
   register_cvar("kniff_mode","ab")
   register_cvar("hs_mode","ab")
   return PLUGIN_CONTINUE
}



上面是ultimate_sounds的源码,我想请高手帮我把First Blood分离出来,原来有个First Blood.sma,但不好用,杀完人没有hudmessage,也没有Sound.也没有messages,而这个文件我编译测试上面的功能全部都有,所以我想请点通的高手抽空帮我分离一下,在这先谢谢大家了.:)
回复

使用道具 举报

 楼主| 发表于 2009-7-10 20:06:32 | 显示全部楼层 来自 中国–宁夏–银川–西夏区
没有高手帮忙吗?:'(
回复

使用道具 举报

 楼主| 发表于 2009-7-10 21:52:25 | 显示全部楼层 来自 中国–宁夏–银川
为什么还是没人帮我解答?:'(
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表