pastebin - collaborative debugging tool
eathena.kpaste.net RSS


VIP Status Checker
Posted by Anonymous on Wed 26th Oct 2011 07:33
raw | new post
view followups (newest first): VIP Status Checker by Anonymous

  1. prontera,155,88,0       script   VIP Stats Checker      910,{
  2.         query_sql "SELECT `char`.account_id,`name`,SUM(online) AS online, " +
  3.                   "`value`-UNIX_TIMESTAMP() AS secs_left " +
  4.                   "FROM global_reg_value LEFT JOIN `char` ON global_reg_value.account_id=`char`.account_id " +
  5.                   "WHERE global_reg_value.str='#VIP_expire' AND CAST(`value` AS UNSIGNED) > UNIX_TIMESTAMP() " +
  6.                   "GROUP BY `char`.account_id " +
  7.                   "ORDER BY CAST(`value` AS SIGNED) ASC LIMIT 128",
  8.                   .@account_id, .@name$, .@online, .@secs_left;
  9.        
  10.        
  11.         mes "[ VIP Stats Checker]";
  12.         mes "We have "+getarraysize(.@account_id)+" "+((getarraysize(.@account_id)==1)?"VIP":"VIPs")+" in <ServerName>";
  13.         mes " ";
  14.        
  15.         for (set .@i,0; .@i<getarraysize(.@account_id); set .@i,.@i+1) {
  16.                 if (.@online[.@i])
  17.                         mes (.@i+1)+". ^008000"+rid2name(.@account_id[.@i])+"^000000 - "+callsub(S_Time2Str,.@secs_left[.@i])+" left";
  18.                 else
  19.                         mes (.@i+1)+". ^FF0000"+.@name$[.@i]+"^000000 - "+callsub(S_Time2Str,.@secs_left[.@i])+" left";
  20.         }
  21.         close;
  22.  
  23. // converts seconds to d,h,m,s string
  24. S_Time2Str:
  25.         set .@Time_Left, getarg(0);
  26.        
  27.         set .@Days, .@Time_Left / 86400;
  28.         set .@Time_Left, .@Time_Left - (.@Days * 86400);
  29.         set .@Hours, .@Time_Left / 3600;
  30.         set .@Time_Left, .@Time_Left - (.@Hours * 3600);
  31.         set .@Minutes, .@Time_Left / 60;
  32.         set .@Time_Left, .@Time_Left - (.@Minutes * 60);
  33.        
  34.         if( .@Days > 0 )
  35.                 set .@Time$, .@Time$ + .@Days + "d ";
  36.         if( .@Hours > 0 )
  37.                 set .@Time$, .@Time$ + .@Hours + "h ";
  38.         if( .@Minutes > 0 )
  39.                 set .@Time$, .@Time$ + .@Minutes + "m";
  40.        
  41.         return .@Time$;
  42. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at