Advertisement
Guest User

df

a guest
Jul 3rd, 2012
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2. #include "Chat.h"
  3. #define PlayerAmount 10
  4. #define contestors 0
  5. static bool Countdownstart;
  6. static uint32 playeroom = PlayerAmount;
  7. Player*pPlayer;
  8. struct Constestor_info
  9. {
  10. std::string Name;
  11. uint32 Level;
  12. uint32 Class;
  13. uint32 Race;
  14. };
  15.  
  16.  
  17. class PvP_Event_Announcer : public WorldScript
  18. {
  19. public:
  20. PvP_Event_Announcer() : WorldScript("PvP_Event_Announcer"){}
  21.  
  22. void OnStartup()
  23. {
  24. Events.ScheduleEvent(COUNTDOWN_60,60000);
  25. Events.ExecuteEvent();
  26.  
  27. }
  28.  
  29. void OnUpdate(uint32 diff)
  30. {
  31. Events.Update(diff);
  32. while (uint32 eventId = Events.ExecuteEvent())
  33. {
  34. switch (eventId)
  35. {
  36. case COUNTDOWN_60:
  37. {
  38. sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event countdown is starting in 1 minute !");
  39. Events.ScheduleEvent(COUNTDOWN_30, 30000);
  40.  
  41. }break;
  42. case COUNTDOWN_30:
  43. {
  44. 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!");
  45. Events.ScheduleEvent(EVENT_START_60, 30000);
  46.  
  47. }break;
  48. case EVENT_START_60:
  49. {
  50. Countdownstart = true;
  51. 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!");
  52. Events.ScheduleEvent(EVENT_START_30, 30000);
  53.  
  54. }break;
  55. case EVENT_START_30:
  56. {
  57. 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");
  58. Events.ScheduleEvent(EVENT_START, 30000);
  59.  
  60. }break;
  61. case EVENT_START:
  62. {
  63. sWorld->SendServerMessage(SERVER_MSG_STRING, "|cffffcc00[PvP Event Announcer]:|r|cFF8B0000The 1 versus 1 PvP event has started !");
  64.  
  65. // Events.ScheduleEvent(EVENT_END, 60000);
  66.  
  67. }
  68. break;
  69. }
  70. }
  71. }
  72.  
  73. private:
  74. EventMap Events;
  75.  
  76. enum eEvents
  77. {
  78. COUNTDOWN_60 ,
  79. COUNTDOWN_30 ,
  80. EVENT_START_60 ,
  81. EVENT_START_30 ,
  82. EVENT_START
  83. };
  84.  
  85. };
  86.  
  87.  
  88.  
  89. class PvP_Event_Command : public CommandScript
  90. {
  91. public:
  92. PvP_Event_Command() : CommandScript("PvP_Event_Command") {}
  93.  
  94. ChatCommand* GetCommands() const
  95. {
  96. static ChatCommand PVPEventSubCommandTable[] =
  97. {
  98. { "enter", SEC_PLAYER, false, &HandleEnterpvpcommand, "", NULL },
  99. { NULL, 0, false, NULL, "", NULL }
  100. };
  101.  
  102. static ChatCommand CommandTable[] =
  103. {
  104. { "pvpevent", SEC_PLAYER, false, NULL, "", PVPEventSubCommandTable },
  105. { NULL, 0, false, NULL, "", NULL }
  106. };
  107. return CommandTable;
  108. }
  109.  
  110. static bool HandleEnterpvpcommand(ChatHandler* handler, const char* args)
  111. {
  112. contestors + 1;
  113. WorldSession* Session = handler->GetSession();
  114. Player* pPlayer = Session->GetPlayer();
  115. if(!Countdownstart)
  116. Session->SendNotification("There is currently no countdown for this event going on");
  117. else if(playeroom-- > 0)
  118. {
  119. Session->SendAreaTriggerMessage("Thank you for entering %s, there is room for %u more players!",pPlayer->GetName(), playeroom);
  120.  
  121. }
  122. else
  123. Session->SendNotification("The maximum player amount for this event is already reached, please try another time");
  124. return true;
  125. }
  126. };
  127.  
  128. void AddSC_PvP_Event()
  129. {
  130. new PvP_Event_Announcer;
  131. new PvP_Event_Command;
  132. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement