[ Request ] Player welcome script

It would be nice if someone shares such a script i found one on ac-web but it was for ArcEmu if it’s going to help here it is ;3



[CODE][B]

#include “StdAfx.h”

#include “Setup.h”

#ifdef WIN32

#pragma warning(disable:4305) // warning C4305: ‘argument’ : truncation from ‘double’ to ‘float’

#endif

void OnFirstEnterWorld(Player * pPlayer)

{

char message[500];

sprintf(message, “[WELCOMEBOT] Welcome our new player, %s to the server!”, pPlayer->GetName());

sWorld.SendWorldWideScreenText(message);

}

void SetupOnFirstEnterWorld(ScriptMgr * mgr)

{

mgr->register_hook(SERVER_HOOK_EVENT_ON_FIRST_ENTER_WORLD, OnFirstEnterWorld);

}

[/B][/CODE]

It basicly should globaly announce the name of a new player that has joined the server /emoticons/default_smile.png .

Topic title corrected. /emoticons/default_wink.png

Thank you Athena!

[CODE]

#include “ScriptPCH.h”

class motd_message_player : public PlayerScript

{

public:

motd_message_player() : PlayerScript(“motd_message_player”) { }

void OnLogin(Player * player)

{

char msg[250];

snprintf(msg, 250, "|cffff0000[Infusion]|r We welcome the champion|cffff0000 %s|r back! ", player->GetName()); // The message

sWorld->SendGlobalText(msg, NULL);

}

};

void AddSC_motd_message()

{

new motd_message_player;

}[/CODE]

Here you go /emoticons/default_smile.png

Thank you man but is there a way to change it to show only the new characters that login to be shown?

It shows message everytime someone login to server

that how PlayerStart.String is working:


    //Show cinematic at the first time that player login

    if (!pCurrChar->getCinematic())

    {

	    pCurrChar->setCinematic(1);

	    if (ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(pCurrChar->getClass()))

	    {

            ...

            // send new char string if not empty

		    if (!sWorld->GetNewCharString().empty())

			    chH.PSendSysMessage("%s", sWorld->GetNewCharString().c_str());

	    }

    }

try:

[CODE]#include “ScriptPCH.h”

class motd_create_player_message : public PlayerScript

{

public:

motd_create_player_message() : PlayerScript(“motd_create_player_message”) { }

void OnPlayerCreate(Player * player)

{

char msg[250];

snprintf(msg, 250, “|cffff0000[WELCOMEBOT] |r Welcome our new player, |cffff0000%s|r to the server!”, player->GetName());

sWorld->SendGlobalText(msg, NULL);

}

};

void AddSC_motd_message()

{

new motd_create_player_message;

}[/CODE]

dont work


#include "ScriptPCH.h"

class motd_message_player : public PlayerScript

{

   public:

  motd_message_player() : PlayerScript("motd_message_player") { }

void OnLogin(Player * player)

{

   if(player->HasAtLoginFlag(AT_LOGIN_FIRST))

   {

  char msg[250];

  snprintf(msg, 250, "|cffff0000[Infusion]|r We welcome the champion|cffff0000 %s|r back! ", player->GetName());  // The message

  sWorld->SendGlobalText(msg, NULL);

  }

}

};

void AddSC_motd_message()

{

new motd_message_player;

}