Hello & Welcome to our community. Is this your first visit? Register
Follow us on
Follow us on Facebook Follow us on Twitter Watch us on YouTube


MMOCoin

Likes Likes:  0
Results 1 to 6 of 6

Thread: Auto Announcer

  1. #1
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    18
    Reputation
    188

    Auto Announcer


    Register to remove this ad
    This is an auto announcer

    Works on both Ascent and Mangos

    Announcer.cpp
    Code:
            //***This script was released under CodeCraft and cannot be redistrubted without giving credits**
            //Title of Script: Anouncer v2
            //Description of Script: Sends a worldwide announcement in timed intervals.
            //Author: Daikenkaiking
            //Credits: Supalosa for his xml script that I learned some functions from.
    
            #include "StdAfx.h"
            #include "Setup.h"
    
            //Configure these as you wish
            #define BREAKTIME 300000      //The amount of seconds * 1000 you want to wait in between messages
            #define HEADERSTR "[Announcer]"   //The string to place in front of the message
    
            //Define and create variables
            uint32 ann_next_id = 0;
    
            class Announcement
            {
               public:
                  void Run();
            };
    
            void Announcement::Run()
            {
               // Variable Defines
               char query[255];
               char display_str[255];
               string body;
               uint32 id, next_id;
    
               if(ann_next_id == 0)
               {
                  sprintf(query, "SELECT * FROM announcer_txt ORDER BY RAND() LIMIT 1");
               } else {
                  sprintf(query, "SELECT * FROM announcer_txt WHERE id = %i", ann_next_id);
               }
               QueryResult * result = WorldDatabase.Query(query);
    
               //Uh oh!
               if(!result)
               {
                  ShowMsg("Something went wrong or there is no data to display!");
                  ann_next_id = 0;
                  return;
               }
    
               //Lets get the data, and set everyting up
               Field * fields = result->Fetch();
               id = fields[0].GetUInt32();
               body = fields[1].GetString();
               next_id = fields[2].GetUInt32();
    
               //We may need to set next id, and set last id
               if(next_id != 0)
                  ann_next_id = next_id;
               else
                  ann_next_id = 0;
    
               //Lets format the String to display and then display it!
               sprintf(display_str, "%s %s", HEADERSTR, body.c_str());
               sWorld.SendWorldText(display_str);
    
               //to prevent overscope and leaking
               WorldDatabase.FreeQueryResult(result);
            }
    
            void ShowMsg(char * errmsg)
            {
               char errstr[255];
               sprintf(errstr, "\nAnnouncer v2: %s", errmsg);
               sLog.outString(errstr);
            }
    
            void SetupAnnouncer(ScriptMgr * mgr)
            {
               Announcement Announcer;
               //If all is good, set up the timer event and lets roll!
               if(BREAKTIME >= 1000)
               {
                  TimedEvent * te = TimedEvent::Allocate(&Announcer, new CallbackP0<Announcement>(&Announcer, &Announcement::Run), 1, BREAKTIME, 0);
                  sWorld.event_AddEvent(te);
                  ShowMsg("Announcer has been started!");
               } else {
                  //Someone has their time set under 1 second. ;P
                  ShowMsg("Announcer has been disabled.  Please insure you have the config set right!");
               }
    
            }
    Setup.h
    Code:
    void SetupAnnouncer(ScriptMgr * mgr);
    void ShowMsg(char * errmsg);
    Add to Char Table
    Code:
    CREATE TABLE `announcer_txt` (
      `id` int(3) NOT NULL auto_increment,
      `body` tinytext NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;



    › See More: Auto Announcer

  2. #2
    Sergeant

    Join Date
    Jul 2008
    Location
    In Earth
    Posts
    84
    Post Thanks / Like
    Rep Power
    16
    Reputation
    11
    can u make a setup.cpp +Repx1

  3. #3
    Founder
    Apple's Avatar
    Join Date
    Jul 2008
    Location
    HeaveN
    Posts
    15,916
    Post Thanks / Like
    Rep Power
    10
    Reputation
    295
    btw , i am already using it on my server forgot to give u +REp , so +Rep now





  4. #4
    Beginner

    Join Date
    Aug 2008
    Posts
    10
    Post Thanks / Like
    Rep Power
    16
    Reputation
    1
    1>..\src\Announcer\Announcer.cpp(42) : error C3861: 'ShowMsg': identifier not found

    I guess most of these scripts are outdated...

    Edit!! Didn't see the box underneath.

  5. #5
    Scout
    Synthetic's Avatar
    Join Date
    Aug 2008
    Posts
    25
    Post Thanks / Like
    Rep Power
    16
    Reputation
    13
    Hmm, mate this script is very big i must say. U should check out the lua announcer that i've made Anyways its nice and works perfect.

  6. #6
    Contributor
    StickyIcky's Avatar
    Join Date
    Jul 2008
    Location
    127.0.0.1
    Posts
    747
    Post Thanks / Like
    Rep Power
    18
    Reputation
    188

    Register to remove this ad
    This one works perfect too...and its made from Daikaikenking...a great C++ scripter




  7. Related Threads - Scroll Down after related threads if you are only interested to view replies for above post/thread

 

 

Visitors found this page by searching for:

Mangos Auto announcer

auto announcer

how i can make auto announcer on Ascent

wow auto announcer

C for Trinity auto announcer

auto annoncer mangos

Codecraft forum scripts

Trinity Autoannouncer

codecraft forum script

C Auto Announcer Trinity

lua timmed announcer

woe auto announcer script

как добавить autoannouncer in wow mangos

skript auto announcer

SEO Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -5. The time now is 05:22 PM.
Powered by vBulletin® Copyright ©2000-2024, Jelsoft Enterprises Ltd.
See More links by ForumSetup.net. Feedback Buttons provided by Advanced Post Thanks / Like (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
vBulletin Licensed to: MMOPro.org