Results 1 to 3 of 3
  1. #1
    DadDelta's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Posts
    643
    Reputation
    18
    Thanks
    1,344

    Kill Sounds [By smallC]

    First, get player score:

    Code:
    namespace fb
    {
        class ClientPlayerScoreManager
        {
        public:
            PAD(0x4); //virtual pad
            eastl::list<fb::ClientPlayerScore *,eastl_arena_allocator> m_playerScores;  
    
            ClientPlayerScore* getScoreByPlayer(ClientPlayer* pPlayer)
            {
                typedef ClientPlayerScore* (__thiscall* tgetScoreByPlayer)(ClientPlayerScoreManager*, ClientPlayer*);
                tgetScoreByPlayer m_getScoreByPlayer = (tgetScoreByPlayer)(0x00FE1600); 
                return m_getScoreByPlayer(this,pPlayer);
            }
    
            static ClientPlayerScoreManager* Singleton(void)
            {
                return *(ClientPlayerScoreManager**)((*(DWORD*)0x02380B58) + 0x40); //Ptr for ClientPlayerScoreManager at 0x40 in GameContext
            }
        };
    
    
        struct PlayerScore
        {        
            __int32 m_rank;
            __int32 m_kills;
            __int32 m_deaths;
            __int32 m_score;
            __int32 m_globalScoreOrginal;       
            __int32 m_globalScoreUpdated;
            __int32 m_veteran;
            float m_time;
        };
    
        class ClientPlayerScore
        {
        public:
            char pad[0x148];
            PlayerScore m_score;
        };
    
    };

    directly include wav sound into project as ressource:
    Code:
    BOOL sndPlayResource(int ID)
    {
        BOOL bRtn;
        LPVOID lpRes;
        HANDLE hResInfo, hRes;
        // Find the WAVE resource.
        hResInfo = FindResource(hMod, MAKEINTRESOURCE(ID), "WAVE");
        if (hResInfo == NULL)
        {    
            return FALSE;
        }
        // Load the WAVE resource.
        hRes = LoadResource(hMod, (HRSRC)hResInfo);
        if (hRes == NULL)
        {        
            return FALSE;
        }    
    
        // Lock the WAVE resource and play it.
        lpRes = LockResource(hRes);
        if (lpRes != NULL) 
        {
            bRtn = sndPlaySound((LPCSTR)lpRes, SND_MEMORY | SND_ASYNC |
                SND_NODEFAULT);
            UnlockResource(hRes);
        }
        else
        {
            return false;
        }
    }
    and then:
    Code:
        fb::ClientPlayerScoreManager* pCPSM = fb::ClientPlayerScoreManager::Singleton();
        if (IsValid(pCPSM))
        {
            fb::ClientPlayerScore* pCPS = pCPSM->getScoreByPlayer(pLocalPlayer);
            if (IsValid(pCPS))
            {            
                static int m_streak = 0;
                static int m_deaths = pCPS->m_score.m_deaths;
                static int m_kills = pCPS->m_score.m_kills;
    
                if (pCPS->m_score.m_kills > m_kills)
                {
                    m_kills = pCPS->m_score.m_kills;
                    ++m_streak;
    
                    switch (m_streak)
                    {
                    case 1:
                        //NOSOUND
                        break;
                    case 2:
                        sndPlayResource(IDR_WAVE1); //double kill                
                        break;
                    case 3:
                        sndPlayResource(IDR_WAVE7); //triple kill
                        break;
                    case 4:
                        sndPlayResource(IDR_WAVE6); //multi kill
                        break;
                    case 5:
                        sndPlayResource(IDR_WAVE8); //ultra kill
                        break;
                    case 6:
                        sndPlayResource(IDR_WAVE5); //monster kill
                        break;
                    case 7:
                        sndPlayResource(IDR_WAVE4);  //killing spree
                        break;
                    case 8:
                        sndPlayResource(IDR_WAVE10); //wicked sick
                        break;
                    case 9:
                        sndPlayResource(IDR_WAVE3); //holy shit
                        break;
                    case 10:
                        sndPlayResource(IDR_WAVE9); //unstoppable
                        break;                
                    default:
                        sndPlayResource(IDR_WAVE2);  //godlike        
                        break;
                    }
                }
    
                if (pCPS->m_score.m_deaths > m_deaths)
                {
                    m_deaths = pCPS->m_score.m_deaths;
                    m_streak = 0;
                }
            }
        }
    Credits to smallC

  2. #2
    zahn123's Avatar
    Join Date
    Dec 2014
    Gender
    male
    Posts
    53
    Reputation
    10
    Thanks
    0
    My Mood
    Cheerful
    Will test this out later when i get home. Thx in advance

  3. #3
    leo_messi's Avatar
    Join Date
    Jan 2015
    Gender
    male
    Posts
    1
    Reputation
    10
    Thanks
    0
    can you tell me how or when to use/put this codes please

Similar Threads

  1. [RELEASE]NEW KILL SOUNDS (QUAKE)
    By Solify in forum Combat Arms Mods & Rez Modding
    Replies: 58
    Last Post: 12-06-2010, 04:40 PM
  2. [RELEASE]NEW KILL SOUNDS (male version)
    By Solify in forum Combat Arms Mods & Rez Modding
    Replies: 37
    Last Post: 04-21-2010, 01:40 AM
  3. [Release] New Crossfire Kill Sounds! Jump here.
    By sdefref in forum CrossFire Mods & Rez Modding
    Replies: 29
    Last Post: 02-18-2010, 05:09 AM
  4. New Killing sounds for Combat Arms!
    By ®Jack in forum Combat Arms Mod Discussion
    Replies: 4
    Last Post: 01-11-2010, 12:03 AM
  5. kill sounds
    By Joshcarr2006 in forum CrossFire Hacks & Cheats
    Replies: 38
    Last Post: 01-10-2010, 06:45 PM