[C++] EP Kuponu Sistemi

  • Konbuyu başlatan Konbuyu başlatan Admin
  • Başlangıç tarihi Başlangıç tarihi
  • Cevaplar Cevaplar 0
  • Görüntüleme Görüntüleme 62

Admin

Metin2Lobby
Yönetici
Founder
Katılım
6 Mayıs 2022
Mesajlar
52,647
Ticaret : 1 / 0 / 0
Merhaba Arkadaşlar,

mysql_query veya mysql_query10 komutları sıkıntı çıkartıyor diyenlere net çözüm c++ ep kuponu sistemi.
Kodlama bana ait değil tabi ki, çok uğraş verdim araştırırken sonunda çözüme kavuştum sizinle de paylaşmak istedim.

1.Aşama:
db/src de ClientManagar.cpp açılıp aratılır;

Kod:
sprintf(szQuery, "update account set `cash` = `cash` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
Buradaki cash yerine coins yazıp kaydediyoruz.
Sonuç:

Kod:
sprintf(szQuery, "update account set `coins` = `coins` + %d where id = %d limit 1", packet->dwAmount, packet->dwAID);
Ardından db mizi build edip db dosyasını gerekli yere atıyoruz.
ayrac.png
2.Aşama
Quest oluşturacağız bunun için quest bölümüne charge_coins.lua veya ep_kuponu.lua (size kalmış) isminde bir dosya açıyoruz ;

[CHARGE=8]
Kod:
quest charge_cash_by_voucher begin     state start begin         function charge(amount, charge_type)             if charge_type == nil then                 charge_type = "coins"             end             if 0 < amount then                 -- syntax : pc.charge_cash(amount, charge_type)                 -- warning:     1. 'charge_type' : "cash"(default) | "mileage"                 --            2. 'amount' must be positive number.                 local result = pc.charge_cash(amount, charge_type)                 if true == result then                     local item_id = item.get_id()                     char_log(item_id, "CHARGE_CASH_BY_VOUCHER", amount)                     syschat("Hesabina "..amount.."  Ejderha Parasi aktarildi.")                     local flag_name = "total_" .. charge_type                     pc.setqf(flag_name, pc.getqf(flag_name) + amount)                     item.remove()                 end             end             return false         end         when 80014.use or 80015.use or 80016.use or 80017.use begin             local amount = item.get_value(0)             charge_cash_by_voucher.charge(amount, "coins")         end     end end
[/CHARGE] -->
içine yapıştırıyoruz, questte herhangi bir değişiklik yapmanıza gerek yok ve kaydedip ./qc çekiyoruz.

Son olarak reboot atıp deneyebilirsiniz.



Bir teşekkür yeterli iyi kullanımlar :)
C++ ile Metin2 EP Kupon Sistemi Geliştirme Rehberi

Metin2 özel sunucularında oyuncuların özel ödüller kazanabilmesi için EP (Event Point) kupon sistemi oldukça yaygın kullanılır. Bu sistem sayesinde sunucu sahipleri turnuvalar, kampanyalar veya özel aktiviteler ile oyunculara bonuslar sağlayabilir. Bu yazıda, C++ tabanlı bir Metin2 sunucusunda nasıl bir EP kuponu sistemi geliştirileceğini adım adım inceleyeceğiz.

EP Kupon Sistemi Nedir?
EP kuponları, oyuncuların belirli bir kodu girerek oyun içi ödüller almasını sağlayan sistemdir. Bu kodlar genellikle sınırlı sayıda kullanılabilir, belirli bir süre geçerlidir veya özel ödüller içerir. Oyuncular bu kodları sosyal medya yarışmaları, özel etkinlikler ya da satın alma işlemleri ile elde edebilirler.

C++ ile Kodlama Gereksinimleri
Sistemi entegre edebilmek için game server tarafında C++ bilgisi oldukça önemlidir. Metin2 özel sunucularında game core üzerinde değişiklik yapabilmek için hem client hem de server tarafında bilgi sahibi olunması gerekir. Özellikle auth ve game sunucuları arasında veri aktarımı için db core bilgisi de gerekir.

Veritabanı Yapısı
EP kuponları için bir veritabanı tablosu oluşturmak gerekir. Bu tablo genellikle DB sunucusuna entegre edilir. Örnek tablo yapısı şu şekildedir:

- coupon_code (varchar(32), unique)
- reward_item_id (int)
- reward_count (int)
- use_limit (int)
- used_count (int)
- expiration_date (datetime)

Sunucu Tarafında Uygulama
Kupon kodu girildiğinde sunucu önce bu kodun geçerli olup olmadığını kontrol eder. Ardından kuponun kullanım hakkını, süresini ve oyuncunun daha önce kullanıp kullanmadığını denetler. Bu işlemler C++ ile yazılmış fonksiyonlar aracılığıyla gerçekleştirilir. Örneğin:

int CheckCoupon(const char* code, DWORD pid);
bool UseCoupon(const char* code, DWORD pid);

Client Tarafı Entegrasyonu[/BR][/BR]Oyuncu arayüzüne bir kupon kodu girişi eklemek için uiscript veya Python GUI kullanılır. Py Root üzerinden bir pencere tasarlanır ve buradan girilen kod game server tarafına gönderilir. Bu işlem sırasında pack dosyaları güncellenmelidir.

Kodların Güvenliği[/BR][/BR]Kupon sistemlerinde güvenlik oldukça önemlidir. Kodlar rastgele oluşturulmalı ve tahmin edilemez olmalıdır. Ayrıca her kuponun tekil kullanım hakkı olmalı ve çoğaltılması engellenmelidir. Sunucu tarafında hash kontrolleri yapılmalıdır.

Sistem Avantajları[/BR][/BR]EP kupon sistemleri, oyuncu sadakati artırmak, etkinliklere katılım teşviki sağlamak ve sunucu gelirini artırmak için idealdir. C++ ile geliştirilen sistemler hızlı ve güvenlidir, bu nedenle Metin2 özel sunucularında tercih edilir.

Sonuç[/BR][/BR]C++ kullanarak Metin2 özel sunucularında bir EP kupon sistemi geliştirmek, hem teknik beceriler gerektirir hem de oyuncu deneyimini artırır. Bu sistem, doğru yapılandırıldığında sunucunuzun popülaritesini ve oynanabilirliğini ciddi anlamda artırabilir.


Developing an EP Coupon System with C++ for Metin2

In Metin2 private servers, the EP (Event Point) coupon system is widely used to allow players to earn special rewards. This system enables server owners to provide bonuses through tournaments, campaigns, or special events. In this article, we will examine step-by-step how to develop an EP coupon system on a C++ based Metin2 server.

What Is an EP Coupon System?
EP coupons are codes that allow players to claim in-game rewards by entering them. These codes often have limited uses, are valid for a specific duration, or contain special rewards. Players can obtain these codes from social media contests, special events, or purchase actions.

Coding Requirements with C++[/BR][/BR]To integrate the system, knowledge of C++ is essential on the game server side. Developing on Metin2 private servers requires understanding both client and server sides, especially when modifying the game core. Knowledge of db core is also necessary for data transfer between auth and game servers.

Database Structure
A database table must be created for EP coupons. This table is typically integrated into the DB server. An example structure is as follows:

- coupon_code (varchar(32), unique)
- reward_item_id (int)
- reward_count (int)
- use_limit (int)
- used_count (int)
- expiration_date (datetime)

Server-Side Implementation
When a coupon code is entered, the server first checks its validity. Then it verifies the usage limit, expiration date, and whether the player has already used the code. These operations are performed via functions written in C++. For example:

int CheckCoupon(const char* code, DWORD pid);
bool UseCoupon(const char* code, DWORD pid);

Client-Side Integration[/BR][/BR]To add a coupon entry interface to the player UI, uiscript or Python GUI is used. A window is designed via Py Root, and the entered code is sent to the game server. During this process, pack files must be updated.

Security of Codes[/BR][/BR]Security is crucial in coupon systems. Codes should be randomly generated and unpredictable. Each coupon must have a unique usage right, and duplication should be prevented. Hash checks should be implemented on the server side.

Advantages of the System[/BR][/BR]EP coupon systems are ideal for increasing player loyalty, encouraging participation in events, and boosting server revenue. Systems developed with C++ are fast and secure, making them preferred choices for Metin2 private servers.

Conclusion[/BR][/BR]Developing an EP coupon system for Metin2 private servers using C++ requires both technical skills and enhances player experience. When properly configured, this system can significantly increase your server's popularity and playability.
 

Şuan Bu Konuyu Görüntüleyen Kullanıcılar (Toplam : 0, Üye : 0, Misafir : 0)

Benzer konular

Geri
Üst Alt