Jump to content
  • 0

Please help me modify and add something to this script


mightyryan

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  69
  • Reputation:   2
  • Joined:  10/03/12
  • Last Seen:  

Hi, I am planning for a VIP item and I found this script from eathena created by Brian

http://pastebin.com/vKVWQLqL

Please help me, modify it by changing the time counts from second to Days and Hours left because the script is currently in seconds(expiration)

and Is it also possible to make an SQL table for this like if someone will use it, and it will record directly to the table with their expiration time?

Thank you

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

vip_rental.txt

You can convert Unixtime to "days hours minutes" like this:

dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);

The script saves their expire time in a permanent account variable: #VIP_expire

Here's the SQL query to view that info:

SELECT `char`.`name`, TIME_FORMAT(SEC_TO_TIME(CAST(`value` AS UNSIGNED) - UNIX_TIMESTAMP()),'%Hh %Im') AS 'VIP time left' 
FROM `char` LEFT JOIN global_reg_value ON `char`.account_id=global_reg_value.account_id 
WHERE global_reg_value.`str`='#VIP_expire' ORDER BY CAST(global_reg_value.`value` AS UNSIGNED) ASC;

name      VIP time left  
--------  ---------------
TestChar  23h 11m        

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  69
  • Reputation:   2
  • Joined:  10/03/12
  • Last Seen:  

Thanks it works!, is it also possible to add SC_expboost and SC_Drop time and will end if the vip will disapear? because what I am doing is a added the sc_expboost and drop to the item_db of the specific item.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

In vip_rental.txt, add these +lines:

Index: vip_rental.txt
===================================================================
--- vip_rental.txt    (revision 15)
+++ vip_rental.txt    (working copy)
@@ -31,6 +31,8 @@
        // timer in future
        dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
        atcommand "@adjgmlvl 1 "+strcharinfo(0);
+        sc_start SC_EXPBOOST, -1,25; // 25 means increase exp by 25%
+        sc_start SC_ITEMBOOST,-1,200; // I think 200 means increase drop rates by 2x
OnVIPcheck:
        if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
            addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnVIPend";
@@ -42,6 +44,8 @@
    // else, their VIP has ended
OnVIPend:
    atcommand "@adjgmlvl 0 "+strcharinfo(0);
+    sc_end SC_EXPBOOST;
+    sc_end SC_ITEMBOOST;
    set #VIP_expire, 0;
    dispbottom "Your VIP Rental has expired.";
    end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  69
  • Reputation:   2
  • Joined:  10/03/12
  • Last Seen:  

thank you so much! it works

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...