PDA

View Full Version : [Release] Colored Auto Announcer


DrakeFish
10-10-2008, 07:50 PM
This is an Auto Announcer that can announce colored messages.
Credits for the Auto Announcer script go to the guy who made it
Credits for adding colors go to me

Add this to your Character Database:
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;


Setup.cpp:
#include "StdAfx.h"
#include "Setup.h"
#include <scriptSetup.h>

extern "C" SCRIPT_DECL uint32 _exp_get_script_type()
{
return SCRIPT_TYPE_MISC;
}

extern "C" SCRIPT_DECL void _exp_script_register(ScriptMgr* mgr)
{
SetupAnnouncer(mgr);
}

#ifdef WIN32

BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}

#endif


Setup.h:
#pragma once

void SetupAnnouncer(ScriptMgr * mgr);
void ShowMsg(char * errmsg);


Announcer.cpp:
#include "StdAfx.h"

//Configure these as you wish
#define BREAKTIME 600000 //The amount of seconds * 1000 you want to wait in between messages
#define HEADERSTR "[Staff]" //The string to place in front of the message
#define HEADERCOLOR MSG_COLOR_GREEN //The color of the string in front of the message (Example: MSG_COLOR_RED)
#define TEXTCOLOR MSG_COLOR_LIGHTBLUE //The color of the text (Example: MSG_COLOR_LIGHTBLUE)
class Announcement
{
public:
void Run();
};

void Announcement::Run()
{

char sZprava[500];

QueryResult * result = CharacterDatabase.Query("SELECT * FROM announcer_txt ORDER BY id ASC");
if(result)
{
do {
sprintf(sZprava, "%s%s %s%s", HEADERCOLOR, HEADERSTR, TEXTCOLOR, result->Fetch()[1].GetString());
sWorld.SendWorldText(sZprava);

}while(result->NextRow());
delete 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);
} else {
//Someone has their time set under 1 second.;P
ShowMsg("Announcer has been disabled. Please insure you have the config set right!");
}

}


All the colors:
MSG_COLOR_LIGHTRED
MSG_COLOR_LIGHTBLUE
MSG_COLOR_BLUE
MSG_COLOR_GREEN
MSG_COLOR_RED
MSG_COLOR_GOLD
MSG_COLOR_GREY
MSG_COLOR_WHITE
MSG_COLOR_SUBWHITE
MSG_COLOR_MAGENTA
MSG_COLOR_YELLOW
MSG_COLOR_CYAN


Have fun!


NOTE: not tested with ascent yet but works fine with ArcEmu

Chroem
10-11-2008, 01:00 PM
Nice job DrakeFish! ;)

Ignorant
10-11-2008, 01:16 PM
well i dont know crap about c++ :(

spgm
10-11-2008, 01:20 PM
where do U put these I know only how to compile but not how to add new scripts, I have been searching for a good tut and I am still looking :)

Artilles
10-11-2008, 01:28 PM
Save the text doc as .lua then put it in your script folder

CodeDemon
10-11-2008, 01:38 PM
Umm artilles this C++ script not LUA lol

DrakeFish
10-11-2008, 04:49 PM
lol :P Yea it's C++ you need to compile it with Microsoft Visual C++
Well if anyone like it he could +rep me :D

darkgabou15
10-14-2008, 03:07 AM
Bump

makaveli1025
10-14-2008, 12:49 PM
cool nice job drakefish +rep :)

Terrorblade
10-14-2008, 01:12 PM
ها ها ها أنا الآن هو الإرهابية التراسل الفوري الذهاب لتفجير لكم! هل حصلت المملوكة لل! that is my answer and yes ima terrorist :p

DrakeFish
10-14-2008, 08:14 PM
lol well ty for reps guys :D

Terrorblade
10-15-2008, 12:56 PM
the lang i posted in was abraic (not sure on spelling) so u can translate to with google translator lol

DrakeFish
10-17-2008, 03:22 AM
Bump

ekaros
10-17-2008, 06:06 AM
Darouge..ها ها ها سوف أعمل على قتلك العنة لك :P

DrakeFish
10-18-2008, 12:43 PM
Bump Bump :D

zenathor
10-18-2008, 06:39 PM
nice +rep

Hasbro
10-18-2008, 07:03 PM
nice!!

DrakeFish
10-19-2008, 04:17 PM
Bump!

Isometimesneedhelp
10-19-2008, 05:45 PM
ها ها ها أنا الآن هو الإرهابية التراسل الفوري الذهاب لتفجير لكم! هل حصلت المملوكة لل! that is my answer and yes ima terrorist :p

He said:
Ha Ha Ha I am now is the terrorist IM going to bomb you! Have there been owned Ll!

I dont understand it but i guess terrorists talk in there own way...

DrakeFish
10-21-2008, 11:55 AM
I knew it I googled it :P

richdude121
10-22-2008, 12:03 AM
I know the basics my c++ but now i have the setup.h setup.cpp and the announcer.cpp now to i start a project or debug i can't remember and ++++++rep i needed this. and th efist code do you want that into the char DB under logon?

DrakeFish
10-22-2008, 12:09 AM
Character DB (logon DB) logon and char are the same :P

richdude121
10-22-2008, 01:14 AM
oh i see what you mean now how do i compile it.. remember i'm not pro at c++

DrakeFish
10-22-2008, 01:17 AM
Well there is many tutorials. http://www.ac-web.org/forum/tutorials/35689-how-compile-dll-aka-custom-c-script.html
This one may help you.

richdude121
10-22-2008, 01:27 AM
thank you. but thats for an npc how did YOU do it that will help XD

DrakeFish
10-22-2008, 01:30 AM
Np ;)

richdude121
10-22-2008, 01:36 AM
no no no i do not get it how did you complie it because the build is grey??

DrakeFish
10-22-2008, 01:38 AM
Erm.. what do you mean?

richdude121
10-22-2008, 01:43 AM
ok ok look

http://i516.photobucket.com/albums/u330/richdude212/buildnotworking.jpg

DrakeFish
10-22-2008, 01:51 AM
You made it a project? Lol
You need to create a project then include those files in it.

richdude121
10-22-2008, 02:15 AM
ok i select release it askes do i want to build it yes or no. now if i click yes it has errors i click next then it asked to "Please specify the name of the executable file to be used for the debug session? what do i do?? then where do i find the script in my files?

DrakeFish
10-22-2008, 11:44 AM
You need to have the arcemu revision too.. you should take a big tut so you can know how it works.

richdude121
10-22-2008, 08:08 PM
I have arceum.. ok what i need is Where do i find the dll file after i complied and i get errors like so

1>------ Build started: Project: anouncer, Configuration: Release Win32 ------
1>Compiling...
1>anouncer.cpp
1>c:\users\richy\documents\visual studio 2008\projects\announcer\anouncer\anouncer.h(3) : error C2065: 'ScriptMgr' : undeclared identifier
1>c:\users\richy\documents\visual studio 2008\projects\announcer\anouncer\anouncer.h(3) : error C2065: 'mgr' : undeclared identifier
1>c:\users\richy\documents\visual studio 2008\projects\announcer\anouncer\anouncer.h(3) : error C2182: 'SetupAnnouncer' : illegal use of type 'void'
1>c:\users\richy\documents\visual studio 2008\projects\announcer\anouncer\anouncer.h(3) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://c:\Users\richy\Documents\Visual Studio 2008\Projects\announcer\anouncer\Release\BuildLog. htm"
1>anouncer - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

So whats up wit it?

DrakeFish
10-23-2008, 01:34 AM
Answerd on MSN ^^

wowprivatserver
04-11-2009, 03:34 PM
Nice Drake, ++++++++++++++rep if i could because already done before, but if you would have made a tutorial on how to add it or just give a link to a tut it would be awsome would have given you alot of +rep

eatos
10-07-2009, 09:24 PM
can some1 mod the breaktime of msg when i set to 5 min it dont work