Jump to content

Recommended Posts

Posted (edited)

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

Edited by Devlin
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

 

Are you check my PM?

  • 2 weeks later...
Guest Elfocrash
Posted

if (player.getUptime() >= val*60*60*1000)

 

val stands for hours.

 

and for reseting the time, go at Logout.java and add this line:

 

player.setUptime(0);

 

By the way, dunno what project are you using. The codes that I wrote you are based on l2jfrozen methods.

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

Posted

This wont work on any kind of project ever unless you check in as a task.

Also the time of uptime is automaticaly reset on logout.

For sure it needs a task.

 

About the reset, I didn't know :P

Posted (edited)

A simple task with a counter linked to L2PcInstance can do the trick. Inside the run section you ++ the counter and make checks regarding it.

 

An exemple for monster derby track which I'm currently recoding for aCis, making checks every seconds to call events :

 

Called by

ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Announcement(), 0, 1000);

And running

	class Announcement implements Runnable
	{
		public Announcement()
		{
		}
		
		@Override
		public void run()
		{
			if (_finalCountdown >= 1200)
				_finalCountdown = 0;
			
			switch (_finalCountdown)
			{
				case 0:
					makeAnnouncement(SystemMessageId.MONSRACE_TICKETS_AVAILABLE_FOR_S1_RACE);
					break;
				
				case 30: // 30 sec
				case 60: // 1 min
					...
				
				case 1080: // 18 min
					makeAnnouncement(SystemMessageId.MONSRACE_RACE_START);
					break;
			}
			_finalCountdown += 1;
		}
	}

As you can see on my exemple, it runs the task every second, increasing _finalCountdown value and checking if that variable reached a particular number.

			if (_finalCountdown >= 1200)
				_finalCountdown = 0;

exists to make a cycle of 20min (reset to 0 when it happens).

 

Instead of 1000 (one second), you put 60000 (one minute) for scheduleGeneralAtFixedRate timer and then you can reward for case 30, 60, 120, etc (30min, 1hour, 2hours,..).

Edited by Tryskell
Guest
This topic is now closed to further replies.


  • Posts

    • 我们的 Telegram 频道 已达到 3000 名订阅者! 感谢大家对我们项目的支持与关注! 我们即将举办一场精彩的抽奖或比赛,专为您准备! 不要错过参与的机会 — 立即订阅:https://t.me/accsforyou_shop✅ 活跃链接: 数字商品商店(网站):前往 商店 Telegram 机器人:前往 用于购买 Telegram Stars 的机器人:前往 SMM 面板:前往 – 推广您的社交媒体账户。 我们向您展示当前的 促销与特别优惠,可用于购买我们平台的产品与服务: 1. 使用优惠码 OCTOBER2025(8% 折扣)在十月期间通过我们的网站或机器人购物!首次购买还可使用优惠码 SOCNET(15% 折扣)。 2. 获得 $1 商店余额或 10–20% 折扣 —— 只需在我们网站注册后在论坛留言:“SEND ME BONUS, MY USERNAME IS...”。 3. 首次试用 SMM 面板可获得 $1 奖励 —— 只需在我们网站(支持页面)提交标题为 “Get Trial Bonus” 的工单。 4. 每周在我们的 Telegram 频道和用于购买 Stars 的机器人中赠送 Telegram Stars!
    • 3000 subscribers in our Telegram channel! Thank you all for your support and interest in our project! Very soon, we’ll be hosting an exciting giveaway or contest just for you! Don’t miss the chance to take part — subscribe here: https://t.me/accsforyou_shop✅ Active Links: Digital goods store (Website): Go Store Telegram bot: Go Telegram bot for purchasing Telegram Stars: Go SMM Panel: Go – promote your social media accounts. We would like to present you with the current list of promotions and special offers for purchasing products and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website or Bot) during October! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — just post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly giveaways of Telegram Stars in our Telegram channel and in our Telegram bot for Star purchases!
    • 3000 subscribers in our Telegram channel! Thank you all for your support and interest in our project! Very soon, we’ll be hosting an exciting giveaway or contest just for you! Don’t miss the chance to take part — subscribe here: https://t.me/accsforyou_shop✅ Active Links: Digital goods store (Website): Go Store Telegram bot: Go Telegram bot for purchasing Telegram Stars: Go SMM Panel: Go – promote your social media accounts. We would like to present you with the current list of promotions and special offers for purchasing products and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website or Bot) during October! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — just post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly giveaways of Telegram Stars in our Telegram channel and in our Telegram bot for Star purchases!
    • 3000 subscribers in our Telegram channel! Thank you all for your support and interest in our project! Very soon, we’ll be hosting an exciting giveaway or contest just for you! Don’t miss the chance to take part — subscribe here: https://t.me/accsforyou_shop✅ Active Links: Digital goods store (Website): Go Store Telegram bot: Go Telegram bot for purchasing Telegram Stars: Go SMM Panel: Go – promote your social media accounts. We would like to present you with the current list of promotions and special offers for purchasing products and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website or Bot) during October! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — just post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly giveaways of Telegram Stars in our Telegram channel and in our Telegram bot for Star purchases!
    • 3000 subscribers in our Telegram channel! Thank you all for your support and interest in our project! Very soon, we’ll be hosting an exciting giveaway or contest just for you! Don’t miss the chance to take part — subscribe here: https://t.me/accsforyou_shop✅ Active Links: Digital goods store (Website): Go Store Telegram bot: Go Telegram bot for purchasing Telegram Stars: Go SMM Panel: Go – promote your social media accounts. We would like to present you with the current list of promotions and special offers for purchasing products and services from our platform: 1. Promo code OCTOBER2025 (8% discount) for purchases in our store (Website or Bot) during October! You can also use the first-time promo code SOCNET (15% discount). 2. Get $1 credited to your store balance or a 10–20% discount — just post your username after registration on our website using the following format: "SEND ME BONUS, MY USERNAME IS..." – post it in our forum thread! 3. Get $1 for your first SMM Panel trial — just open a support ticket titled “Get Trial Bonus” on our website (Support). 4. Weekly giveaways of Telegram Stars in our Telegram channel and in our Telegram bot for Star purchases!
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock