Wise
02-07-16, 03:19 AM
Today I like to share a small script I made, while being bored programming class.
Its a simple function that welcomes new players on login to the world, then greets existing players on return to the world.
/*
* @script made by Sylica
* @project name: Project Firestorm
*/
#include "ScriptMgr.h"
#include "Player.h"
#include "Chat.h"
class welcome_player_message : public PlayerScript
{
public:
welcome_player_message() : PlayerScript("welcome_player_message") { }
void OnLogin(Player* player, bool firstLogin) override
{
std::ostringstream message;
if (firstLogin)
{
message << "|cff3ADF00Please welcome " << player->GetName() << " to our server!|r";
sWorld->SendGlobalText(message.str().c_str(), nullptr);
}
else
{
message << "|cff3ADF00Glade to see you back " << player->GetName() << "!|r";
ChatHandler(player->GetSession()).PSendSysMessage(message.str().c_str( ));
}
}
};
void AddSC_onlogin_announcer()
{
new welcome_player_message();
}
Credits : Sylica
Its a simple function that welcomes new players on login to the world, then greets existing players on return to the world.
/*
* @script made by Sylica
* @project name: Project Firestorm
*/
#include "ScriptMgr.h"
#include "Player.h"
#include "Chat.h"
class welcome_player_message : public PlayerScript
{
public:
welcome_player_message() : PlayerScript("welcome_player_message") { }
void OnLogin(Player* player, bool firstLogin) override
{
std::ostringstream message;
if (firstLogin)
{
message << "|cff3ADF00Please welcome " << player->GetName() << " to our server!|r";
sWorld->SendGlobalText(message.str().c_str(), nullptr);
}
else
{
message << "|cff3ADF00Glade to see you back " << player->GetName() << "!|r";
ChatHandler(player->GetSession()).PSendSysMessage(message.str().c_str( ));
}
}
};
void AddSC_onlogin_announcer()
{
new welcome_player_message();
}
Credits : Sylica