Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ScriptPCH.h"
- #include "Chat.h"
- #define PlayerAmount 10
- static bool Countdownstart;
- static uint32 playeroom = PlayerAmount;
- class PvP_Event_Announcer : public WorldScript
- {
- public:
- PvP_Event_Announcer() : WorldScript("PvP_Event_Announcer"){}
- void OnStartup()
- {
- Events.ScheduleEvent(COUNTDOWN_60, 10000);
- }
- 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|c00FFFFFFThe 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|c00FFFFFFThe 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|c00FFFFFFThe 1 versus 1 PvP event countdown has started, you have 1 minute to enter by typing: .enterpvp , 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|c00FFFFFFThe 1 versus 1 PvP event countdown is only 30 seconds more, enter fast if you still want to by typing : .enterpvp");
- Events.ScheduleEvent(EVENT_START, 30000);
- break;
- }
- case EVENT_START:
- {
- sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|c00FFFFFFThe 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,
- };
- };
- 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(playeroom-- > 0)
- {
- Session->SendAreaTriggerMessage("Thank you for entering, there is room for %u more players!", playeroom);
- // add pPlayer to some list or something
- }
- 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