Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class login_event : public PlayerScript
- {
- public:
- login_event () : PlayerScript("login_event ") { }
- void OnLogin(Player* player)
- {
- if(player->GetTotalPlayedTime() < 10)
- {
- //main auras player start with (chat starts in 2 seconds so it doesn't interfere with the player logging
- player->m_Events.AddEvent(new customEvent(player), player->m_Events.CalculateTime(2000));
- player->AddAura(auraID, player); //makes player start with an aura on (change ID with auraID)
- player->AddAura(auraID, player); //read above
- player->SetMovement(MOVE_ROOT); //freezes player in place
- }
- else
- {
- player->RemoveAurasDueToSpell(auraID); //since player isn't new, don't add the auras as mentioned above
- player->RemoveAurasDueToSpell(auraID); //read above
- player->SetMovement(MOVE_UNROOT); //makes player able to walk
- }
- }
- struct loginEventMain : public BasicEvent
- {
- loginEventMain(Player* _player) : player(_player), _event(0) {}
- bool Execute(uint64 /*time*/, uint32 /*diff*/)
- {
- Creature* creature = player->FindNearestCreature(creatureID, 40.0f, true); //replace creatureID with the id of the creature you want to talk
- switch(_event++)
- {
- if(!creature)
- return true;
- case 0:
- creature->MonsterSay(("Hello, "+player->GetName+". My name is test.").c_str(), LANG_UNIVERSAL, player->GetGUID());
- creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); //talk emote
- player->m_Events.AddEvent(this, player->m_Events.CalculateTime(4000)); //wait 4 seconds for the next speech
- break;
- case 1:
- creature->MonsterSay("INSERT TEXT HERE", LANG_UNIVERSAL, player->GetGUID());
- creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); //emote
- player->m_Events.AddEvent(this, player->m_Events.CalculateTime(4000)); //4 second wait
- break;
- case 2:
- creature->MonsterSay("INSERT TEXT HERE", LANG_UNIVERSAL, player->GetGUID());
- creature->HandleEmoteCommand(EMOTE_ONESHOT_TALK); //emote
- player->m_Events.AddEvent(this, player->m_Events.CalculateTime(4000)); //4 second wait
- break;
- case 3:
- //add your own event here
- break;
- case 4:
- //add your own here
- break;
- case 5:
- player->SetMovement(MOVE_UNROOT); //makes the player able to move (if you add an aura in the above, makesure you remove it from the player)
- break; //you can make more events if needed :)
- default:
- return true; //no events anymore
- }
- return false; // don't destroy event
- }
- Player* player;
- uint32 _event;
- };
- };
- void AddSC_login_event()
- {
- new login_event();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement