Merhaba arkadaşlar :l04:
bu sıkıntıyı bende çektiğimden dolayı forumda aradım düzgün bir açıklama bulamadım sonra sorunu çözdüm ve sizlerle paylaşmak istedim
ilk önce şunu söyleyim mysql_query10 yada msyql_query olarak questlerde oluyor ve o questlerin eklediğimizde serverde o quest çalışmıyor
mesela oyun içi sıralama questinde bu mevcut
şimdi nasıl mysql_query10 etkin edicez onu anlatmaya başlıyorum
bu sorun quest_functions dosyasında mysql_query10 kodu ve questing.lua dosyasında mysql_query10 fonksiyonunu ekli olmadığı için oluyor.
Filezillada /usr/game/share/locale/turkey/quest klasöründeki quest_functions ve questing.lua dosyalarında mysql_query10 kodunu arattık eğer yoksa :
quest_functions u açtık ve en alta yeni bir satır ekledik ve mysql_query10 yaz ve kaydet.
questing.lua dosyasına da şunları en altına ekle :
şimdi servere reboot et ve artık kullanmaya başla
şunu da söliyim mesela oyun içi sıralama questin de mysql_query yazıyorsa siz onu şöle yapın mysql_query10
elinde sıralama questi olmayanlar için quest :
KONUYA YORUM ATARAK DESTEK OLAN ARKADAŞLARA AYRICA +rep VERİCEM.
alıntıda bulduğum arkadaşı da yazıyım ondan alıntı yaptım fakat konusundan değil soru cevap bölümündeki yorumundan !
mysql_query Kodu Neden Questlerimde Çalışmıyor?
Metin2 quest sistemlerinde en sık karşılaşılan sorunlardan birisi mysql_query fonksiyonunun doğru şekilde çalışmadığı durumlardır.
Birçok geliştirici, kendi Metin2 sunucularında veritabanı bağlantısı kurarak kullanıcılar için dinamik quest sistemleri oluşturmak ister.
Ancak bu işlem sırasında bazı teknik hatalarla karşılaşabilirler.
mysql_query Nedir?
mysql_query, eski PHP tabanlı sistemlerde veritabanına SQL sorgusu göndermek için kullanılan bir fonksiyondur.
Ancak Metin2 quest sistemleri genellikle Lua dilinde yazılmıştır ve doğrudan MySQL bağlantısı kurmaz.
Quest dosyalarınızda bu fonksiyonu kullanmaya çalıştığınızda, sistem bu komutu tanımayacaktır.
Neden mysql_query Questlerde Çalışmaz?
1. Metin2 quest sistemi doğrudan veritabanı bağlantısı kuramaz.
2. Lua dili içinde mysql_query fonksiyonu tanımlı değildir.
3. Sunucu tarafında özel eklentiler olmadan MySQL erişimi mümkün değildir.
Doğru Yöntem Nedir?
MySQL veritabanı işlemlerini Metin2 quest sisteminde yapabilmek için bazı özel yapılandırmalar yapılmalıdır.
Sunucu Tarafında MySQL Entegrasyonu
Metin2 sunucu motoruna özel olarak geliştirilmiş eklentiler (örneğin C++ tabanlı MySQL destekli core modifikasyonları) kullanılmalıdır.
Bu sayede Lua tarafında özel fonksiyonlar tanımlanarak veritabanı işlemleri yapılabilir.
Lua İçinde Veritabanı Fonksiyonları
Özel sunucu yapılandırmalarında, geliştiriciler db_query, db_fetch, db_execute gibi özel Lua fonksiyonları kullanabilirler.
Bu fonksiyonlar, doğrudan MySQL bağlantısı kurulmuş sunucularda çalışır.
mysql_query Kullanımı Hakkında Yanlış Anlaşılmalar
Bazı geliştiriciler, mysql_query gibi PHP fonksiyonlarını doğrudan quest sistemine entegre edebileceklerini düşünürler.
Bu büyük bir yanılgıdır çünkü Metin2 Lua ortamı, PHP gibi web tabanlı sistemlerle aynı yapıya sahip değildir.
Hata Ayıklama (Debug) Yöntemleri
Quest sistemlerinde veritabanı bağlantısı kurarken, log dosyalarını kontrol etmek önemlidir.
Sunucu konsolunda hata mesajlarını takip ederek, hangi noktada sorun oluştuğunu tespit edebilirsiniz.
Metin2 Quest Sistemlerinde Alternatifler
1. Flag sistemlerini kullanarak kullanıcı bazlı veri saklama.
2. Timer ve state yönetimi ile quest süreçlerini yönlendirme.
3. Özel item veya NPC ile quest tetiklemeleri yapma.
Geliştiricilere Öneriler
Metin2 quest geliştirme konusunda yeniyseniz, öncelikle Lua diline ve Metin2 quest yapısına hakim olmalısınız.
Ayrıca, veritabanı işlemleri gerektiren sistemler için profesyonel sunucu desteği almanız önemlidir.
Sonuç
mysql_query fonksiyonu doğrudan Metin2 quest sistemlerinde kullanılamaz.
Veritabanı bağlantısı kurmak istiyorsanız, sunucu tarafında gerekli entegrasyonları yaptırmalısınız.
Aksi halde questleriniz beklemediğiniz hatalar verebilir.
Daha fazla bilgi ve örnek quest dosyaları için Metin2Lobby'yi ziyaret edin.
Why Does mysql_query Not Work in My Quests?
One of the most common issues encountered in Metin2 quest systems is the failure of mysql_query function to work properly.
Many developers want to create dynamic quest systems for users by connecting to databases on their own Metin2 servers.
However, they may encounter some technical errors during this process.
What Is mysql_query?
mysql_query is a function used in older PHP-based systems to send SQL queries to a database.
However, Metin2 quest systems are generally written in Lua and do not directly connect to MySQL databases.
When you try to use this function in your quest files, the system will not recognize it.
Why Doesn't mysql_query Work in Quests?
1. The Metin2 quest system cannot establish direct database connections.
2. The mysql_query function is not defined within the Lua language.
3. MySQL access is not possible without special additions on the server side.
What Is the Correct Method?
To perform MySQL database operations in Metin2 quest systems, certain custom configurations must be made.
MySQL Integration on Server Side
Custom additions specifically developed for the Metin2 server engine (e.g., C++ based MySQL-enabled core modifications) must be used.
This way, special functions like db_query, db_fetch, db_execute can be defined and used in Lua.
Database Functions Within Lua
In custom server configurations, developers can use special Lua functions such as db_query, db_fetch, db_execute.
These functions operate on servers with direct MySQL connections established.
Misconceptions About mysql_query Usage
Some developers think they can integrate PHP functions like mysql_query directly into the quest system.
This is a major misconception because the Metin2 Lua environment does not have the same structure as web-based systems like PHP.
Debugging Methods
When establishing database connections in quest systems, checking log files is important.
By monitoring error messages in the server console, you can identify where the problem occurs.
Alternatives in Metin2 Quest Systems
1. Storing user-based data using flag systems.
2. Directing quest processes with timers and state management.
3. Triggering quests using custom items or NPCs.
Suggestions for Developers
If you are new to Metin2 quest development, you should first become proficient in the Lua language and the Metin2 quest structure.
Additionally, for systems requiring database operations, obtaining professional server support is essential.
Conclusion
The mysql_query function cannot be used directly in Metin2 quest systems.
If you want to establish database connections, you must implement the necessary integrations on the server side.
Otherwise, your quests may produce unexpected errors.
Visit Metin2Lobby for more information and sample quest files.
bu sıkıntıyı bende çektiğimden dolayı forumda aradım düzgün bir açıklama bulamadım sonra sorunu çözdüm ve sizlerle paylaşmak istedim
ilk önce şunu söyleyim mysql_query10 yada msyql_query olarak questlerde oluyor ve o questlerin eklediğimizde serverde o quest çalışmıyor
mesela oyun içi sıralama questinde bu mevcut
şimdi nasıl mysql_query10 etkin edicez onu anlatmaya başlıyorum
bu sorun quest_functions dosyasında mysql_query10 kodu ve questing.lua dosyasında mysql_query10 fonksiyonunu ekli olmadığı için oluyor.
Filezillada /usr/game/share/locale/turkey/quest klasöründeki quest_functions ve questing.lua dosyalarında mysql_query10 kodunu arattık eğer yoksa :
quest_functions u açtık ve en alta yeni bir satır ekledik ve mysql_query10 yaz ve kaydet.
questing.lua dosyasına da şunları en altına ekle :
Kod:
[COLOR=#0000BB][FONT=monospace]mysql_query10 [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= function([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]query[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) if [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]not pre then local rt [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]io[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]open[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'CONFIG'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'r'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]):[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]read[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'*all'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]pre[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]_[/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]string[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]gsub[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]rt[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'.+PLAYER_SQL:%s(%S+)%s(%S+)%s(%S+)%s(%S+).+'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'-h%1 -u%2 -p%3 -D%4'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]end math[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]randomseed[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]os[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]time[/FONT][/COLOR][COLOR=#007700][FONT=monospace]()) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]local fi[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'mysql_data_'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]math[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]random[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]10[/FONT][/COLOR][COLOR=#007700][FONT=monospace]^[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]9[/FONT][/COLOR][COLOR=#007700][FONT=monospace])+[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]math[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]random[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]2[/FONT][/COLOR][COLOR=#007700][FONT=monospace]^[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]4[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]2[/FONT][/COLOR][COLOR=#007700][FONT=monospace]^[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]10[/FONT][/COLOR][COLOR=#007700][FONT=monospace]),{},{} --[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]os[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]execute[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'mysql '[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]pre[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' --e='[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]string[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]format[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'%q'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]query[/FONT][/COLOR][COLOR=#007700][FONT=monospace])..[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' > '[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]fi[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) -- [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]für MySQL51 os[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]execute[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'mysql '[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]pre[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' -e'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]string[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]format[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'%q'[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]query[/FONT][/COLOR][COLOR=#007700][FONT=monospace])..[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]' > '[/FONT][/COLOR][COLOR=#007700][FONT=monospace]..[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]fi[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) -- [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]für MySQL55 [/FONT][/COLOR][COLOR=#007700][FONT=monospace]for [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]av in io[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]open[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]fi[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'r'[/FONT][/COLOR][COLOR=#007700][FONT=monospace]):[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]lines[/FONT][/COLOR][COLOR=#007700][FONT=monospace]() do [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]table[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]insert[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]split[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]av[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'\t'[/FONT][/COLOR][COLOR=#007700][FONT=monospace])) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]end[/FONT][/COLOR][COLOR=#007700][FONT=monospace]; [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]os[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]remove[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]fi[/FONT][/COLOR][COLOR=#007700][FONT=monospace]); for [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i [/FONT][/COLOR][COLOR=#007700][FONT=monospace]= [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]2[/FONT][/COLOR][COLOR=#007700][FONT=monospace], [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]table[/FONT][/COLOR][COLOR=#007700][FONT=monospace].[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]getn[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) do [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]table[/FONT][/COLOR][COLOR=#007700][FONT=monospace].foreach([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace]],function([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a[/FONT][/COLOR][COLOR=#007700][FONT=monospace],[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]b[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace]-[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace]-[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] or {} [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace]-[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]tostring[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]b[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) or [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]b [/FONT][/COLOR][COLOR=#007700][FONT=monospace]or [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'NULL' [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]]] = [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]]] or {} [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]t[/FONT][/COLOR][COLOR=#007700][FONT=monospace][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]a[/FONT][/COLOR][COLOR=#007700][FONT=monospace]]][[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]i[/FONT][/COLOR][COLOR=#007700][FONT=monospace]-[/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]1[/FONT][/COLOR][COLOR=#007700][FONT=monospace]] = [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]tostring[/FONT][/COLOR][COLOR=#007700][FONT=monospace]([/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]b[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) or [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]b [/FONT][/COLOR][COLOR=#007700][FONT=monospace]or [/FONT][/COLOR][COLOR=#DD0000][FONT=monospace]'NULL' [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]end[/FONT][/COLOR][COLOR=#007700][FONT=monospace]) [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]end [/FONT][/COLOR][COLOR=#007700][FONT=monospace]return [/FONT][/COLOR][COLOR=#0000BB][FONT=monospace]out end [/FONT][/COLOR]
şimdi servere reboot et ve artık kullanmaya başla
şunu da söliyim mesela oyun içi sıralama questin de mysql_query yazıyorsa siz onu şöle yapın mysql_query10
elinde sıralama questi olmayanlar için quest :
Kod:
[COLOR=#000080]quest sirala begin state start begin when 20092.chat." Karakter Sıralaması " begin local rangliste = mysql_query10("SELECT * FROM player.player WHERE player.name NOT LIKE '[%]%' ORDER BY player.level DESC, player.exp DESC") say_title(" Sıralama ") say(" 1. İsim: "..rangliste.name[1].." Level: "..rangliste.level[1].." Exp: "..rangliste.exp[1].." ") say(" 2. İsim: "..rangliste.name[2].." Level: "..rangliste.level[2].." Exp: "..rangliste.exp[2].." ") say(" 3. İsim: "..rangliste.name[3].." Level: "..rangliste.level[3].." Exp: "..rangliste.exp[3].." ") say(" 4. İsim: "..rangliste.name[4].." Level: "..rangliste.level[4].." Exp: "..rangliste.exp[4].." ") say(" 5. İsim: "..rangliste.name[5].." Level: "..rangliste.level[5].." Exp: "..rangliste.exp[5].." ") say(" 6. İsim: "..rangliste.name[6].." Level: "..rangliste.level[6].." Exp: "..rangliste.exp[6].." ") say(" 7. İsim: "..rangliste.name[7].." Level: "..rangliste.level[7].." Exp: "..rangliste.exp[7].." ") say(" 8. İsim: "..rangliste.name[8].." Level: "..rangliste.level[8].." Exp: "..rangliste.exp[8].." ") say(" 9. İsim: "..rangliste.name[9].." Level: "..rangliste.level[9].." Exp: "..rangliste.exp[9].." ") say(" 10. İsim: "..rangliste.name[10].." Level: "..rangliste.level[10].." Exp: "..rangliste.exp[10].." ") say(" 11. İsim: "..rangliste.name[11].." Level: "..rangliste.level[11].." Exp: "..rangliste.exp[11].." ") say(" 12. İsim: "..rangliste.name[12].." Level: "..rangliste.level[12].." Exp: "..rangliste.exp[12].." ") end end end[/COLOR]
KONUYA YORUM ATARAK DESTEK OLAN ARKADAŞLARA AYRICA +rep VERİCEM.
alıntıda bulduğum arkadaşı da yazıyım ondan alıntı yaptım fakat konusundan değil soru cevap bölümündeki yorumundan !
Ziyaretçiler için gizlenmiş link,görmek için üye olmalısınız!
Giriş yap veya üye ol.
mysql_query Kodu Neden Questlerimde Çalışmıyor?
Metin2 quest sistemlerinde en sık karşılaşılan sorunlardan birisi mysql_query fonksiyonunun doğru şekilde çalışmadığı durumlardır.
Birçok geliştirici, kendi Metin2 sunucularında veritabanı bağlantısı kurarak kullanıcılar için dinamik quest sistemleri oluşturmak ister.
Ancak bu işlem sırasında bazı teknik hatalarla karşılaşabilirler.
mysql_query Nedir?
mysql_query, eski PHP tabanlı sistemlerde veritabanına SQL sorgusu göndermek için kullanılan bir fonksiyondur.
Ancak Metin2 quest sistemleri genellikle Lua dilinde yazılmıştır ve doğrudan MySQL bağlantısı kurmaz.
Quest dosyalarınızda bu fonksiyonu kullanmaya çalıştığınızda, sistem bu komutu tanımayacaktır.
Neden mysql_query Questlerde Çalışmaz?
1. Metin2 quest sistemi doğrudan veritabanı bağlantısı kuramaz.
2. Lua dili içinde mysql_query fonksiyonu tanımlı değildir.
3. Sunucu tarafında özel eklentiler olmadan MySQL erişimi mümkün değildir.
Doğru Yöntem Nedir?
MySQL veritabanı işlemlerini Metin2 quest sisteminde yapabilmek için bazı özel yapılandırmalar yapılmalıdır.
Sunucu Tarafında MySQL Entegrasyonu
Metin2 sunucu motoruna özel olarak geliştirilmiş eklentiler (örneğin C++ tabanlı MySQL destekli core modifikasyonları) kullanılmalıdır.
Bu sayede Lua tarafında özel fonksiyonlar tanımlanarak veritabanı işlemleri yapılabilir.
Lua İçinde Veritabanı Fonksiyonları
Özel sunucu yapılandırmalarında, geliştiriciler db_query, db_fetch, db_execute gibi özel Lua fonksiyonları kullanabilirler.
Bu fonksiyonlar, doğrudan MySQL bağlantısı kurulmuş sunucularda çalışır.
mysql_query Kullanımı Hakkında Yanlış Anlaşılmalar
Bazı geliştiriciler, mysql_query gibi PHP fonksiyonlarını doğrudan quest sistemine entegre edebileceklerini düşünürler.
Bu büyük bir yanılgıdır çünkü Metin2 Lua ortamı, PHP gibi web tabanlı sistemlerle aynı yapıya sahip değildir.
Hata Ayıklama (Debug) Yöntemleri
Quest sistemlerinde veritabanı bağlantısı kurarken, log dosyalarını kontrol etmek önemlidir.
Sunucu konsolunda hata mesajlarını takip ederek, hangi noktada sorun oluştuğunu tespit edebilirsiniz.
Metin2 Quest Sistemlerinde Alternatifler
1. Flag sistemlerini kullanarak kullanıcı bazlı veri saklama.
2. Timer ve state yönetimi ile quest süreçlerini yönlendirme.
3. Özel item veya NPC ile quest tetiklemeleri yapma.
Geliştiricilere Öneriler
Metin2 quest geliştirme konusunda yeniyseniz, öncelikle Lua diline ve Metin2 quest yapısına hakim olmalısınız.
Ayrıca, veritabanı işlemleri gerektiren sistemler için profesyonel sunucu desteği almanız önemlidir.
Sonuç
mysql_query fonksiyonu doğrudan Metin2 quest sistemlerinde kullanılamaz.
Veritabanı bağlantısı kurmak istiyorsanız, sunucu tarafında gerekli entegrasyonları yaptırmalısınız.
Aksi halde questleriniz beklemediğiniz hatalar verebilir.
Daha fazla bilgi ve örnek quest dosyaları için Metin2Lobby'yi ziyaret edin.
Why Does mysql_query Not Work in My Quests?
One of the most common issues encountered in Metin2 quest systems is the failure of mysql_query function to work properly.
Many developers want to create dynamic quest systems for users by connecting to databases on their own Metin2 servers.
However, they may encounter some technical errors during this process.
What Is mysql_query?
mysql_query is a function used in older PHP-based systems to send SQL queries to a database.
However, Metin2 quest systems are generally written in Lua and do not directly connect to MySQL databases.
When you try to use this function in your quest files, the system will not recognize it.
Why Doesn't mysql_query Work in Quests?
1. The Metin2 quest system cannot establish direct database connections.
2. The mysql_query function is not defined within the Lua language.
3. MySQL access is not possible without special additions on the server side.
What Is the Correct Method?
To perform MySQL database operations in Metin2 quest systems, certain custom configurations must be made.
MySQL Integration on Server Side
Custom additions specifically developed for the Metin2 server engine (e.g., C++ based MySQL-enabled core modifications) must be used.
This way, special functions like db_query, db_fetch, db_execute can be defined and used in Lua.
Database Functions Within Lua
In custom server configurations, developers can use special Lua functions such as db_query, db_fetch, db_execute.
These functions operate on servers with direct MySQL connections established.
Misconceptions About mysql_query Usage
Some developers think they can integrate PHP functions like mysql_query directly into the quest system.
This is a major misconception because the Metin2 Lua environment does not have the same structure as web-based systems like PHP.
Debugging Methods
When establishing database connections in quest systems, checking log files is important.
By monitoring error messages in the server console, you can identify where the problem occurs.
Alternatives in Metin2 Quest Systems
1. Storing user-based data using flag systems.
2. Directing quest processes with timers and state management.
3. Triggering quests using custom items or NPCs.
Suggestions for Developers
If you are new to Metin2 quest development, you should first become proficient in the Lua language and the Metin2 quest structure.
Additionally, for systems requiring database operations, obtaining professional server support is essential.
Conclusion
The mysql_query function cannot be used directly in Metin2 quest systems.
If you want to establish database connections, you must implement the necessary integrations on the server side.
Otherwise, your quests may produce unexpected errors.
Visit Metin2Lobby for more information and sample quest files.
