Jump to content

Play A Default Sound To All Players On The Server


Guest nighthunter

Recommended Posts

hello

i have this script from a other forum, it sould play a sound to all players:

//Play sound
bool ChatHandler::HandlePlaySoundCommand(const char* args)
{
       // USAGE: .playsound #soundid
       // #soundid - ID decimal number from SoundEntries.dbc (1 column)
       // this file have about 5000 sounds.
       // In this realisation only caller can hear this sound.
       if( *args )
       {
               int dwSoundId = atoi((char*)args);
               if( dwSoundId >= 0 )
               {
                       WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8);
                       data << uint32(dwSoundId) << m_session->GetPlayer()->GetGUID();
                       sWorld.SendGlobalMessage(&data,true);

                       sLog.outDebug("Player %s use command .playsound with #soundid=%u", m_session->GetPlayer()->GetName(), dwSoundId);
                       PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
                       return true;
               }
       }

       SendSysMessage(LANG_BAD_VALUE);
       return false;
}

but where do i have to add it? and do i have to change/add something in my DB? commands?

greetings

Link to comment
Share on other sites

here you have .patch file.. apply it to Source code of mangos, which you download from SVN, then compile.

Index: src/game/Chat.cpp
===================================================================
--- src/game/Chat.cpp        (revision 6292)
+++ src/game/Chat.cpp        (working copy)
@@ -465,8 +465,9 @@
                { "movegens",             SEC_ADMINISTRATOR,    &ChatHandler::HandleMovegensCommand,                        "", NULL },
                { "cometome",             SEC_ADMINISTRATOR,    &ChatHandler::HandleComeToMeCommand,                        "", NULL },
                { "damage",                 SEC_ADMINISTRATOR,    &ChatHandler::HandleDamageCommand,                            "", NULL },
+                { "playsound"                SEC_ADMINISTRATOR,    &ChatHandler::HandlePlaySoundCommand,                     "", NULL },

-                { NULL,                         0,                                    NULL,                                                                                     "", NULL }
+                { NULL,                         0,                                    NULL,                                                                                     "", NULL }
        };

        if(load_command_table)
Index: src/game/Chat.h
===================================================================
--- src/game/Chat.h        (revision 6292)
+++ src/game/Chat.h        (working copy)
@@ -350,6 +350,7 @@
                bool HandleCastSelfCommand(const char *args);
                bool HandleCastTargetCommand(const char *args);
                bool HandleComeToMeCommand(const char *args);
+                bool HandlePlaySoundCommand(const char *args);

                //! Development Commands
                bool HandleSetValue(const char* args);
Index: src/game/Level3.cpp
===================================================================
--- src/game/Level3.cpp        (revision 6292)
+++ src/game/Level3.cpp        (working copy)
@@ -4872,3 +4872,29 @@

        return true;
}
+
+//Play sound
+bool ChatHandler::HandlePlaySoundCommand(const char* args)
+{
+        // USAGE: .playsound #soundid
+        // #soundid - ID decimal number from SoundEntries.dbc (1 column)
+        // this file have about 5000 sounds.
+        // In this realisation only caller can hear this sound.
+        if( *args )
+        {
+                int dwSoundId = atoi((char*)args);
+                if( dwSoundId >= 0 )
+                {
+                        WorldPacket data(SMSG_PLAY_OBJECT_SOUND,4+8);
+                        data << uint32(dwSoundId) << m_session->GetPlayer()->GetGUID();
+                        sWorld.SendGlobalMessage(&data,true);
+
+                        sLog.outDebug("Player %s use command .playsound with #soundid=%u", m_session->GetPlayer()->GetName(), dwSoundId);
+                        PSendSysMessage(LANG_YOU_HEAR_SOUND, dwSoundId);
+                        return true;
+                }
+        }
+
+        SendSysMessage(LANG_BAD_VALUE);
+        return false;
+}
\\ No newline at end of file

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use