Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- std::vector<Player*> Players;
- bool BgRunning = false;
- class TEST : public CreatureScript
- {
- public:
- TEST() : CreatureScript("TEST") {}
- bool OnGossipHello(Player* player, Creature* creature)
- {
- // blah blah
- }
- bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 uiAction)
- {
- switch(uiAction)
- {
- case GOSSIP_ACTION_INFO_DEF+1:
- {
- if(BgRunning)
- {
- player->GetSession()->SendNotification("BG is already running");
- return true;
- }
- Players.push_back(player); // add player to the list
- if (Players.size() >= 5)
- {
- for (auto it = Players.begin() ; it < Players.end(); it++ )
- {
- if(!(*it)->IsInWorld())
- Players.erase(it);
- }
- if (Players.size() >= 5)
- for (auto it = Players.begin() ; it < Players.end(); it++ )
- {
- (*it)->TeleportTo(0, 0.0, 0.0, 0.0, 0.0);
- BgRunning = true;
- }
- }
- }
- }
- return true;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement