Jump to content
  • 0

Timer making it 30 days?


PewN

Question


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

how can i make it 30 days?


function script F_VIPstart {
set .@ticks, getarg(0, "15"); // getarg(0) = ticks (seconds)
if (.@ticks <= 0) {
debugmes "F_VIPstart - tried to set a timer in the past";
end;
}
// set a variable, #VIP_expire, as the Unixtime when this expires
set #VIP_expire, gettimetick(2) + .@ticks;
// add a timer with that tick (in case they stay logged in that long)
if (.@ticks < 2147483) { // prevent overflow error
addtimer .@ticks *1000, "vip_rental::OnVIPend";
} else {
addtimer 2147483, "vip_rental::OnVIPcheck";
}
// change them to GM level 1
atcommand "@adjgroup 1 "+strcharinfo(0);
dispbottom "You now have access to VIP commands!";
return;
}

- script vip_rental -1,{
OnPCLoginEvent:
if (#VIP_expire > gettimetick(2)) {
// timer in future
dispbottom "VIP Rental : expires in " + callfunc("Time2Str",#VIP_expire);
atcommand "@adjgroup 1 "+strcharinfo(0);
}
OnVIPcheck:
if (#VIP_expire > gettimetick(2)) {
if ((#VIP_expire - gettimetick(2)) < 2147483) { // prevent overflow error
addtimer (#VIP_expire - gettimetick(2)) *1000, strnpcinfo(3)+"::OnVIPend";
} else {
addtimer 2147483, strnpcinfo(3)+"::OnVIPcheck";
}
} else if (#VIP_expire) {
// timer already expired
doevent strnpcinfo(3)+"::OnVIPend";
}
end;

OnVIPend:
// change them to GM level 0
atcommand "@adjgroup 0 "+strcharinfo(0);
set #VIP_expire, 0; // clear timer
dispbottom "Your VIP Rental has expired.";
end;
}

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites

2 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:  

http://www.eathena.ws/board/index.php?act=findpost&pid=1386316

Usage:

{ callfunc "F_VIPstart", <ticks>; }

ticks = how long their VIP will last, in seconds.

(this can be used in an item script or NPC)

Examples:

  • 1 day = 86400
  • 7 days = 604800
  • 14 days = 1209600

30 days = 2592000 seconds, so the item script would be:

{ callfunc "F_VIPstart", 2592000; }

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  209
  • Topics Per Day:  0.05
  • Content Count:  892
  • Reputation:   27
  • Joined:  12/09/11
  • Last Seen:  

http://www.eathena.w...ost&pid=1386316

Usage:

{ callfunc "F_VIPstart", <ticks>; }

ticks = how long their VIP will last, in seconds.

(this can be used in an item script or NPC)

Examples:

  • 1 day = 86400
  • 7 days = 604800
  • 14 days = 1209600

30 days = 2592000 seconds, so the item script would be:

{ callfunc "F_VIPstart", 2592000; }

thx a lot for this script and your help to me :D i found this code by checking all Admin Profile hehehe

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...