Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chat.h"
- #define PlayerAmount 10
- // #define contestors 0 Teh fuck is this?
- static bool Countdownstart;
- // Player*pPlayer; Teh fuck is this??
- class PvP_Event_Announcer : public WorldScript
- {
- public:
- PvP_Event_Announcer() : WorldScript("PvP_Event_Announcer"){}
- void OnStartup()
- {
- Events.ScheduleEvent(COUNTDOWN_60,60000);
- Events.ExecuteEvent();
- }
- void OnUpdate(uint32 diff)
- {
- Events.Update(diff);
- while (uint32 eventId = Events.ExecuteEvent())
- {
- switch (eventId)
- {
- case COUNTDOWN_60:
- {
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is starting in 1 minute !");
- Events.ScheduleEvent(COUNTDOWN_30, 30000);
- }break;
- case COUNTDOWN_30:
- {
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is starting in 30 seconds, contestors be ready!");
- Events.ScheduleEvent(EVENT_START_60, 30000);
- }break;
- case EVENT_START_60:
- {
- Countdownstart = true;
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown has started, you have 1 minute to enter by typing: .pvpevent enter , be fast cause only 10 players can enter!");
- Events.ScheduleEvent(EVENT_START_30, 30000);
- }break;
- case EVENT_START_30:
- {
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is only 30 seconds more, enter fast if you still want to by typing : .pvpevent enter");
- Events.ScheduleEvent(EVENT_START, 30000);
- }break;
- case EVENT_START:
- {
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event has started !");
- // Events.ScheduleEvent(EVENT_END, 60000);
- }
- break;
- }
- }
- }
- private:
- EventMap Events;
- enum eEvents
- {
- COUNTDOWN_60 ,
- COUNTDOWN_30 ,
- EVENT_START_60 ,
- EVENT_START_30 ,
- EVENT_START
- };
- };
- struct Constestor_info
- {
- const char* Name;
- uint8 Level;
- uint32 Class;
- uint32 Race;
- };
- std::vector<struct Constestor_info> Contestors;
- class PvP_Event_Command : public CommandScript
- {
- public:
- PvP_Event_Command() : CommandScript("PvP_Event_Command") {}
- ChatCommand* GetCommands() const
- {
- static ChatCommand PVPEventSubCommandTable[] =
- {
- { "enter", SEC_PLAYER, false, &HandleEnterpvpcommand, "", NULL },
- { NULL, 0, false, NULL, "", NULL }
- };
- static ChatCommand CommandTable[] =
- {
- { "pvpevent", SEC_PLAYER, false, NULL, "", PVPEventSubCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- };
- return CommandTable;
- }
- static bool HandleEnterpvpcommand(ChatHandler* handler, const char* args)
- {
- WorldSession* Session = handler->GetSession();
- Player* pPlayer = Session->GetPlayer();
- if(!Countdownstart)
- Session->SendNotification("There is currently no countdown for this event going on");
- else if(Contestors.size() < PlayerAmount)
- {
- Session->SendAreaTriggerMessage("Thank you for entering %s, there is room for %u more players!",pPlayer->GetName(), PlayerAmount-Contestors.size()); // uint - uint may glitch.. test!
- Constestor_info temp = {pPlayer->GetName(), pPlayer->getLevel(), pPlayer->getClassMask(), pPlayer->getRaceMask()}; // getclass and getrace instead?
- Contestors.push_back(temp); // must use a temp variable, cant just push back an array like {1,2,3,4}
- }
- else
- Session->SendNotification("The maximum player amount for this event is already reached, please try another time");
- return true;
- }
- };
- void AddSC_PvP_Event()
- {
- new PvP_Event_Announcer;
- new PvP_Event_Command;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement