Cooldown in java file

  • Автор темы Автор темы Horyon
  • Дата начала Дата начала

Horyon

Знающий
Участник
Сообщения
220
Розыгрыши
0
Решения
4
Репутация
53
Реакции
78
Баллы
423
Хроники
  1. Shadow of the Kamael
Исходники
Присутствуют
Сборка
L2jMobius Master class ch3
Hey guys... I'm trying to make a NPC. So far everything is working like i desire.

But in some i need a test, "IF(weekly)".

A test to check if player already take this week. I know somewhere have a control for weeklys instances, etc. Maybe with some tip i can use it in here, idk.

Ty for any help
 

Create a playerVariable with current time on first talk with NPC.

Create a condition with checking Variable + 604800000 > System.currentTimeMillis()
{
enter your code.
}
 
Hey guys... I'm trying to make a NPC. So far everything is working like i desire.

But in some i need a test, "IF(weekly)".

A test to check if player already take this week. I know somewhere have a control for weeklys instances, etc. Maybe with some tip i can use it in here, idk.

Ty for any help

Instead of using that, you can save the COMPLETION TIME as a player variable (in the database), which will be restored every time a player enters the game, or on EnterWorld. Then, whenever a player speaks to the NPC or whatever, you add a check that compares the current time with the COMPLETION time and if the difference is less than ?ONE WEEK?, it sends an ACTION_FAILED packet with some message or a CANNOT_ENTER html.
 
Назад
Сверху Снизу