pastebin - collaborative debugging tool
eathena.kpaste.net RSS


VIP Status Checker
Posted by Anonymous on Wed 26th Oct 2011 08:27
raw | new post
modification of post by Anonymous (view diff)

  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.         mes "[ VIP Stats Checker]";
  11.         mes "We have "+getarraysize(.@account_id)+" "+((getarraysize(.@account_id)==1)?"VIP":"VIPs")+" in <ServerName>";
  12.         mes " ";
  13.         for (set .@i,0; .@i<getarraysize(.@account_id); set .@i,.@i+1) {
  14.                 if (.@online[.@i])
  15.                         mes (.@i+1)+". ^008000"+rid2name(.@account_id[.@i])+"^000000 - "+callsub(S_Time2Str,.@secs_left[.@i])+" left";
  16.                 else
  17.                         mes (.@i+1)+". ^FF0000"+.@name$[.@i]+"^000000 - "+callsub(S_Time2Str,.@secs_left[.@i])+" left";
  18.         }
  19.         close;
  20.  
  21. // converts seconds to d,h,m string
  22. S_Time2Str:
  23.         set .@seconds, getarg(0);
  24.         set .@seconds, .@seconds - set(.@days, .@seconds / 86400) * 86400;
  25.         set .@seconds, .@seconds - set(.@hours, .@seconds / 3600) * 3600;
  26.         set .@seconds, .@seconds - set(.@minutes, .@seconds / 60) * 60;
  27.         if (.@days)
  28.                 set .@string$, .@string$ + .@days + "d ";
  29.         if (.@hours)
  30.                 set .@string$, .@string$ + .@hours + "h ";
  31.         if (.@minutes)
  32.                 set .@string$, .@string$ + .@minutes + "m";
  33.         return .@string$;
  34. }

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