custom sounds knife

Тема в разделе "Запросы", создана пользователем vaxa, 23 июн 2015.

  1. vaxa

    vaxa Rock Rulet!

    Сообщения:
    859
    Симпатии:
    102
    Здравствуйте,требуется плагин который заменяет удары звука ножа.
    Игра cs:go

    Логика плагина такова,звук заменяет по порядку,как закончился список звуков кастомных идет к началу списка кастомных и заменяет по очереди.

    Тобишь будет как так:

    PHP:
    #######Стандартные################## 
    sound/weapons/knife/knife_hit_01.wav 
    sound
    /weapons/knife/knife_hit_02.wav 
    sound
    /weapons/knife/knife_hit_03.wav 
    sound
    /weapons/knife/knife_hit_04.wav 
    sound
    /weapons/knife/knife_hit_05.wav 
    sound
    /weapons/knife/knife_hit1.wav 
    sound
    /weapons/knife/knife_hit2.wav 
    sound
    /weapons/knife/knife_hit3.wav 
    sound
    /weapons/knife/knife_hit4.wav 
    sound
    /weapons/knife/knife_stab.wav 
    sound
    /weapons/knife/knife_hitwall1.wav 
    sound
    /weapons/knife/knife_hitwall2.wav 
    sound
    /weapons/knife/knife_hitwall3.wav 
    sound
    /weapons/knife/knife_hitwall4.wav 


    #######Кастомные################## 
    sound/music/zombie/claw_hit_flesh_1.mp3 
    sound
    /music/zombie/claw_hit_flesh_2.mp3 
    sound
    /music/zombie/claw_hit_flesh_3.mp3 
    sound
    /music/zombie/claw_hit_flesh_4.mp3 
    sound
    /music/zombie/zombie_slice_1.mp3 
    sound
    /music/zombie/zombie_slice_2.mp3 
    sound
    /music/zombie/zombie_slice_3.mp3 
    sound
    /music/zombie/zombie_slice_4.mp3 
    sound
    /music/zombie/zombie_slice_5.mp3 
    sound
    /music/zombie/zombie_slice_6.mp3  

    PHP:
    sound/weapons/knife/knife_hit_01.wav =>sound/music/zombie/claw_hit_flesh_1.mp3  
    sound
    /weapons/knife/knife_hit_02.wav  =>sound/music/zombie/claw_hit_flesh_2.mp3  
    sound
    /weapons/knife/knife_hit_03.wav  =>sound/music/zombie/claw_hit_flesh_3.mp3  
    sound
    /weapons/knife/knife_hit_04.wav  =>sound/music/zombie/claw_hit_flesh_4.mp3  
    sound
    /weapons/knife/knife_hit_05.wav  =>sound/music/zombie/zombie_slice_1.mp3  
    sound
    /weapons/knife/knife_hit1.wav    =>sound/music/zombie/zombie_slice_2.mp3  
    sound
    /weapons/knife/knife_hit2.wav  =>sound/music/zombie/zombie_slice_3.mp3  
    sound
    /weapons/knife/knife_hit3.wav  =>sound/music/zombie/zombie_slice_4.mp3 
    sound
    /weapons/knife/knife_hit4.wav =>sound/music/zombie/zombie_slice_5.mp3 
    sound
    /weapons/knife/knife_stab.wav  =>sound/music/zombie/zombie_slice_6.mp3 
    sound
    /weapons/knife/knife_hitwall1.wav  =>sound/music/zombie/claw_hit_flesh_1.mp3 
    sound
    /weapons/knife/knife_hitwall2.wav =>sound/music/zombie/claw_hit_flesh_2.mp3  
    sound
    /weapons/knife/knife_hitwall3.wav =>sound/music/zombie/claw_hit_flesh_3.mp3 
    sound
    /weapons/knife/knife_hitwall4.wav =>sound/music/zombie/claw_hit_flesh_4.mp3
     
  2. White Wolf

    White Wolf [] (int _n) -> double { return (_n % 2) == 0;}); Супер-модератор

    Сообщения:
    1.191
    Симпатии:
    418
    Я бы реализовал это вот так.
    PHP:
    #include <sourcemod>
    #include <emitsoundany>

    char OriginalKnifeSounds[][] = 
    {
        
    "sound/weapons/knife/knife_hit_01.wav",
        
    "sound/weapons/knife/knife_hit_02.wav",
        
    "sound/weapons/knife/knife_hit_03.wav",
        
    "sound/weapons/knife/knife_hit_04.wav",
        
    "sound/weapons/knife/knife_hit_05.wav",
        
    "sound/weapons/knife/knife_hit1.wav",
        
    "sound/weapons/knife/knife_hit2.wav",
        
    "sound/weapons/knife/knife_hit3.wav",
        
    "sound/weapons/knife/knife_hit4.wav",
        
    "sound/weapons/knife/knife_stab.wav",
        
    "sound/weapons/knife/knife_hitwall1.wav",
        
    "sound/weapons/knife/knife_hitwall2.wav",
        
    "sound/weapons/knife/knife_hitwall3.wav",
        
    "sound/weapons/knife/knife_hitwall4.wav"
    }

    char ReplaceKnifeSounds[][] = 
    {
        
    "music/zombie/claw_hit_flesh_1.mp3",
        
    "music/zombie/claw_hit_flesh_2.mp3",
        
    "music/zombie/claw_hit_flesh_3.mp3",
        
    "music/zombie/claw_hit_flesh_4.mp3",
        
    "music/zombie/zombie_slice_1.mp3",
        
    "music/zombie/zombie_slice_2.mp3",
        
    "music/zombie/zombie_slice_3.mp3",
        
    "music/zombie/zombie_slice_4.mp3",
        
    "music/zombie/zombie_slice_5.mp3",
        
    "music/zombie/zombie_slice_6.mp3",
        
    "music/zombie/claw_hit_flesh_1.mp3",
        
    "music/zombie/claw_hit_flesh_2.mp3",
        
    "music/zombie/claw_hit_flesh_3.mp3",
        
    "music/zombie/claw_hit_flesh_4.mp3"
    }

    public 
    void OnPluginStart()
    {
        
    AddNormalSoundHook(SoundHook);
    }

    public 
    void OnMapStart()
    {
        
    char buffer[PLATFORM_MAX_PATH];
        for (
    int i 015i++)
        {
            
    PrecacheSoundAny(ReplaceKnifeSounds[i]);
            
    Format(buffersizeof(buffer), "sound/%s"ReplaceKnifeSounds[i]);
            
    AddFileToDownloadsTable(buffer);
        }
    }

    public 
    Action SoundHook(int clients[64], int &numClientschar sample[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flags)
    {
        for (
    int i 015i++)
        {
            if (
    StrContains(sampleOriginalKnifeSounds[i]) > -1)
            {
                
    Format(samplePLATFORM_MAX_PATH"sound/%s"OriginalKnifeSounds[i]);
                
    EmitSoundToClientAny(entitysampleSOUND_FROM_LOCAL_PLAYERSNDCHAN_WEAPON);
                return 
    Plugin_Changed;
            }
        }
        return 
    Plugin_Continue;
    }
     

    Вложения:

    vaxa нравится это.
  3. vaxa

    vaxa Rock Rulet!

    Сообщения:
    859
    Симпатии:
    102
    White Wolf,
    L 06/24/2015 - 15:36:55: [SM] Plugin encountered error 15: Array index is out of bounds
    L 06/24/2015 - 15:36:55: [SM] Displaying call stack trace for plugin "custom_sounds.smx":
    L 06/24/2015 - 15:36:55: [SM] [0] Line 60, C:\Users\admin\Desktop\ \scripting\custom_sounds.sp::SoundHook()
    L 06/24/2015 - 15:36:56: [SM] Plugin encountered error 15: Array index is out of bounds
    L 06/24/2015 - 15:36:56: [SM] Displaying call stack trace for plugin "custom_sounds.smx":
    L 06/24/2015 - 15:36:56: [SM] [0] Line 60, C:\Users\admin\Desktop\ \scripting\custom_sounds.sp::SoundHook()
    L 06/24/2015 - 15:36:56: [SM] Plugin encountered error 15: Array index is out of bounds
    L 06/24/2015 - 15:36:56: [SM] Displaying call stack trace for plugin "custom_sounds.smx":
    L 06/24/2015 - 15:36:56: [SM] [0] Line 60, C:\Users\admin\Desktop\ \scripting\custom_sounds.sp::SoundHook()
    L 06/24/2015 - 15:36:56: [SM] Plugin encountered error 15: Array index is out of bounds
    L 06/24/2015 - 15:36:56: [SM] Displaying call stack trace for plugin "custom_sounds.smx":
    L 06/24/2015 - 15:36:56: [SM] [0] Line 60, C:\Users\admin\Desktop\ \scripting\custom_sounds.sp::SoundHook
    Не робит
     
  4. White Wolf

    White Wolf [] (int _n) -> double { return (_n % 2) == 0;}); Супер-модератор

    Сообщения:
    1.191
    Симпатии:
    418
    Попробуй это:
    PHP:
    #include <sourcemod>
    #include <emitsoundany>

    char OriginalKnifeSounds[14][] = 
    {
        
    "sound/weapons/knife/knife_hit_01.wav",
        
    "sound/weapons/knife/knife_hit_02.wav",
        
    "sound/weapons/knife/knife_hit_03.wav",
        
    "sound/weapons/knife/knife_hit_04.wav",
        
    "sound/weapons/knife/knife_hit_05.wav",
        
    "sound/weapons/knife/knife_hit1.wav",
        
    "sound/weapons/knife/knife_hit2.wav",
        
    "sound/weapons/knife/knife_hit3.wav",
        
    "sound/weapons/knife/knife_hit4.wav",
        
    "sound/weapons/knife/knife_stab.wav",
        
    "sound/weapons/knife/knife_hitwall1.wav",
        
    "sound/weapons/knife/knife_hitwall2.wav",
        
    "sound/weapons/knife/knife_hitwall3.wav",
        
    "sound/weapons/knife/knife_hitwall4.wav"
    }

    char ReplaceKnifeSounds[14][] = 
    {
        
    "music/zombie/claw_hit_flesh_1.mp3",
        
    "music/zombie/claw_hit_flesh_2.mp3",
        
    "music/zombie/claw_hit_flesh_3.mp3",
        
    "music/zombie/claw_hit_flesh_4.mp3",
        
    "music/zombie/zombie_slice_1.mp3",
        
    "music/zombie/zombie_slice_2.mp3",
        
    "music/zombie/zombie_slice_3.mp3",
        
    "music/zombie/zombie_slice_4.mp3",
        
    "music/zombie/zombie_slice_5.mp3",
        
    "music/zombie/zombie_slice_6.mp3",
        
    "music/zombie/claw_hit_flesh_1.mp3",
        
    "music/zombie/claw_hit_flesh_2.mp3",
        
    "music/zombie/claw_hit_flesh_3.mp3",
        
    "music/zombie/claw_hit_flesh_4.mp3"
    }

    public 
    void OnPluginStart()
    {
        
    AddNormalSoundHook(SoundHook);
    }

    public 
    void OnMapStart()
    {
        
    char buffer[PLATFORM_MAX_PATH];
        for (
    int i 014i++)
        {
            
    PrecacheSoundAny(ReplaceKnifeSounds[i]);
            
    Format(buffersizeof(buffer), "sound/%s"ReplaceKnifeSounds[i]);
            
    AddFileToDownloadsTable(buffer);
        }
    }

    public 
    Action SoundHook(int clients[64], int &numClientschar sample[PLATFORM_MAX_PATH], int &entityint &channelfloat &volumeint &levelint &pitchint &flags)
    {
        for (
    int i 014i++)
        {
            if (
    StrEqual(sampleOriginalKnifeSounds[i], false))
            {
                
    Format(samplesizeof(sample), "sound/%s"OriginalKnifeSounds[i]);
                
    EmitSoundToClientAny(entitysampleSOUND_FROM_LOCAL_PLAYERSNDCHAN_WEAPON);
                return 
    Plugin_Changed;
            }
        }
        return 
    Plugin_Continue;
    }
     
  5. vaxa

    vaxa Rock Rulet!

    Сообщения:
    859
    Симпатии:
    102
    White Wolf, не робит =(
     
  6. AlmazON

    AlmazON деревянный © yand3xmail

    Сообщения:
    4.521
    Симпатии:
    1.971
    Звук ножа нельзя убрать через этот натив.
    Параметры не были изменены, правильнее return Plugin_Stop;.