Hello and welcome to WoWEmulation!
Today we are sharing a c++ script for trinity core. This script will announce new players to the entire server upon logging in for the first time. This can be a useful feature for welcoming new members to the community and making them feel more included.
#include "ScriptPCH.h"
#include "chat.h"
#include "World.h"
class newPlayer : public PlayerScript
{
public:
newPlayer() : PlayerScript("newPlayer") {}
void OnLogin(Player* player, bool firstLogin)
{
if (firstLogin == true) {
std::ostringstream ss;
ss << "|cff54b5ffWelcome|r " << ChatHandler(player->GetSession()).GetNameLink() << " |cff54b5ffto our server!|r";
sWorld->SendServerMessage(SERVER_MSG_STRING, ss.str().c_str());
}
}
};
void AddSC_newPlayer()
{
new newPlayer();
}
If you are not sure how to add a custom c++ script to your TrinityCore Source. You can visit the following link for more information: LIN