Advertisement
Guest User

MVPTimer

a guest
Feb 8th, 2014
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.01 KB | None | 0 0
  1. -   script  MVPTimer    -1,{
  2. OnInit:
  3.     // Mvp ids
  4.     setarray $MVP_id[0],id1,id2,id3;
  5.     // Mvp maps NO GAT's!
  6.     setarray $MVP_maps$[0],"map1","map2","map3";
  7.     // Respawn time (HOURS)
  8.     setarray $MVP_tm[0],tm1,tm2,tm3;
  9.     initnpctimer;
  10.     // IT SHOULD FALL HERE! _NO_ end;
  11.     OnTimer3600: // After a hour
  12.         for( set .@i,0; .@i < getarraysize($MVP_id); set .@i, .@i+1 )
  13.         {
  14.             set .@time, $MVP_tm[.@i]*3600; // Conversion to seconds so we can use gettimetick
  15.  
  16.             if( ($MVP_last_respawn[.@i] + .@time) > gettimetick(2) || $MVP_alive[.@i] == 1 )
  17.                 continue; // Time has yet to pass
  18.  
  19.             monster $MVP_maps$[.@i],0,0,"--ja--",$MVP_id[.@i],1;
  20.             // Defines last respawn
  21.             set $MVP_last_respawn[.@i], gettimetick(2);
  22.             set $MVP_alive[.@i], 1;
  23.         }
  24.         setnpctimer 0;
  25.         end;
  26.  
  27. OnNPCKillEvent:
  28.         if( getmonsterinfo(killedrid, MOB_MVPEXP) > 0 ) // To minimize overhead
  29.         {
  30.             for( set .@i,0; .@i < getarraysize($MVP_id); set .@i, .@i+1 )
  31.             {
  32.                 if( killedrid == $MVP_id[.@i] )
  33.                     set $MVP_alive[.@i], 0;
  34.             }
  35.         }
  36.         end;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement