Metin2 Daily Reward System
Merhaba Metin2 sunucu sahipleri ve geliştiricileri,
Sizlerle oyunculara her 24 saatte bir otomatik olarak ödül veren, metin2 daily reward system kolay ve etkili bir Günlük Ödül Sistemi paylaşmak istiyorum. Bu sistem sayesinde oyuncular, günlük girişlerinde belirlediğiniz eşyayı otomatik olarak alabilir.
Script Özeti ve İşleyişi:
- Ödül periyodu: 24 saat (86400 saniye). Oyuncu ödül aldıktan sonra tekrar aynı ödülü ancak 24 saat sonra alabilir.
- Ödül içeriği: VNUM 189 olan eşya, adet 1 olarak verilmektedir. (İsterseniz kodu düzenleyerek farklı eşya ve miktar belirleyebilirsiniz.)
- Ödül alma kontrolü: Oyuncunun en son ödül aldığı zaman kontrol edilerek, 24 saat geçmediyse ödül verilmez.
- Envanter kontrolü: Ödül verileceği zaman oyuncunun envanterinde yer olup olmadığı kontrol edilir. Envanter doluysa ödül verilmez.
- Ödül verildiğinde: Oyuncunun ödül alma zamanı güncellenir ve log kaydı tutulur.
- Kalan süre: Ödül alınana kadar kalan süre hesaplanıp gösterilebilir.
Kodun Öne Çıkan Fonksiyonları:
- get_reward_interval(): Ödül alma aralığını saniye olarak döner (86400 = 24 saat).
- get_reward_item(): Verilecek ödülün VNUM ve adetini döner.
- can_receive(): Ödül alınıp alınamayacağını kontrol eder.
- mark_reward(): Ödül alma zamanını günceller.
- give(): Ödülü verir, envanter kontrolü yapar, log kaydı tutar.
- time_remaining(): Ödül alınana kadar kalan süreyi saniye cinsinden verir.
- format_time(sec): Kalan saniyeyi saat, dakika, saniye formatında döner.
Kullanım ve Özelleştirme:
- Ödül eşyasını ve miktarını get_reward_item() fonksiyonunda değiştirebilirsiniz.
- Ödül alma süresini get_reward_interval() fonksiyonunda saniye cinsinden ayarlayabilirsiniz.
- Envanter limitlerini ve log detaylarını ihtiyacınıza göre düzenleyebilirsiniz.
EN:
Hello Metin2 server owners and developers,
I’d like to share with you a simple yet effective Daily Reward System that automatically grants players a reward every 24 hours. This system encourages players to log in daily by giving them a designated item as a reward.
Script Overview and Functionality:
- Reward Interval: 24 hours (86400 seconds). Players can only receive the reward once per day.
- Reward Item: Currently set to give 1 piece of the item with VNUM 189. (You can customize the item and quantity in the code.)
- Eligibility Check: The system checks the last time the player received the reward; if 24 hours have not passed, the reward will not be given.
- Inventory Check: Before giving the item, it ensures the player has enough inventory space. If the inventory is full, the reward is skipped.
- On Reward: The player’s reward timestamp is updated, and a system log is recorded.
- Time Remaining: You can calculate and display how much time is left before the next reward can be claimed.
Key Functions Explained:
- get_reward_interval(): Returns the cooldown time in seconds (default 86400 = 24 hours).
- get_reward_item(): Returns the item VNUM and quantity to be rewarded.
- can_receive(): Checks if the player is eligible to receive the reward.
- mark_reward(): Updates the last reward timestamp for the player.
- give(): Gives the reward after inventory check and logs the event.
- time_remaining(): Calculates how many seconds remain before the player can claim again.
- format_time(sec): Formats seconds into hours, minutes, and seconds.
Usage and Customization:
- Change the rewarded item and quantity by editing the get_reward_item() function.
- Adjust the reward cooldown by changing the value in get_reward_interval().
- Modify inventory limits or logging details as needed for your server.