Advertisement
Rochet2

Timed script

Jun 28th, 2012
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include "ScriptPCH.h"
  2.  
  3. #define Delay 60000 // 60 seconds
  4.  
  5. class TimedTest : public WorldScript
  6. {
  7. public:
  8.     TimedTest() : WorldScript("TimedTest")
  9.     {
  10.         Time = 0; // initialize Time, cant check else
  11.     }
  12.  
  13.     void OnUpdate(uint32 diff)
  14.     {
  15.         if(Time >= Delay) // Check if time has passed delay
  16.         {
  17.             sWorld->SendServerMessage(SERVER_MSG_STRING, "Test");
  18.             Time = 0; // reset time
  19.         }
  20.         else
  21.             Time += diff; // Update Time
  22.     }
  23. private:
  24.     uint32 Time;
  25. };
  26.  
  27. void AddSC_TimedTest()
  28. {
  29.     new TimedTest();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement