- Katılım
- 6 Mayıs 2022
- Mesajlar
- 45,967
Bu vereceğim kodları sql nize ekleyerek panelinizden item kitleme yapabilirsiniz.
Bu sql kodları sayesinde item kitlemeyi sorunsuz yapabilirsiniz.
Sql Kod item kitleme Aşağıda bulabilirsiniz
Bu kodları sırayla SQL nize girin item kitleme sorunsuz çalışmaktadır.
KOD 1 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemSealOnPos]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemSealOnPos]
GO
CREATE PROCEDURE [dbo].[ItemSealOnPos] (@strUserID varchar(30), @ItemNum int,@ItemPos int )
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNumCheck int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0 and @ItemNum > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNumCheck = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum = @ItemNumCheck
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked = 0
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
print 'Kilit basarili'
return
END
END
END
END
END
print 'Kilit basarisiz'
return
END
[/HIDE-THANKS]
KOD 2 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemUnSealOnPos]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemUnSealOnPos]
GO
CREATE PROCEDURE [dbo].[ItemUnSealOnPos] (@strUserID varchar(30), @ItemNum int,@ItemPos int )
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNumCheck int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0 and @ItemNum > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNumCheck = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum = @ItemNumCheck
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked > 0
BEGIN
delete from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
print 'UnKilit basarili'
return
END
END
END
END
END
print 'UnKilit basarisiz'
return
END
GO
KOD 3 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FetchUserItems]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[FetchUserItems]
GO
CREATE PROCEDURE [dbo].[FetchUserItems] (@strUserID varchar(30))
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int,@ItemPos as int,@ItemStack as int,@ItemDuration as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0
BEGIN
delete from ListUserItems where strUserID=@strUserID
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @ItemPos = 0
SET @i = (((@ItemPos + 1) * 8) - 7)
while 401 > @i
BEGIN
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
SET @ItemDuration = cast(cast(cast( substring(@InventoryItems, @i+5, 1) as varbinary(1))+cast(substring(@InventoryItems, @i+4, 1) as varbinary(1)) as varbinary(2)) as smallint)
SET @ItemStack = cast(cast(cast( substring(@InventoryItems, @i+7, 1) as varbinary(1))+cast(substring(@InventoryItems, @i+6, 1) as varbinary(1)) as varbinary(2)) as smallint)
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
INSERT INTO ListUserItems (strUserID,ItemPos,ItemNum,ItemSerial,ItemStack,It emDuration,ItemSealed) values (@strUserID,@ItemPos,@ItemNum,@ItemSerial,@ItemSta ck,@ItemDuration,@IsAlreadyLocked)
SET @ItemPos = @ItemPos + 1
SET @i = (((@ItemPos + 1) * 8) - 7)
END
END
select * from ListUserItems where strUserID=@strUserID order by ItemPos
return
END
print 'Item listing fail'
return
END
GO
KOD 4:
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemSealInventory]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemSealInventory]
GO
CREATE PROCEDURE [dbo].[ItemSealInventory] (@strUserID varchar(30))
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int,@ItemPos as int,@ItemStack as int,@ItemDuration as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @ItemPos = 0
SET @i = (((@ItemPos + 1) * 8) - 7)
while 401 > @i
BEGIN
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if (@IsAlreadyLocked = 0) and (@ItemNum > 0) and (@ItemSerial > 0)
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
END
SET @ItemPos = @ItemPos + 1
SET @i = (((@ItemPos + 1) * 8) - 7)
END
END
print 'Inventory lock success'
return
END
print 'Inventory lock failed'
return
END
GO
KOD 5 :
CREATE PROCEDURE [dbo].[ItemKilitlePanel] (@strUserID varchar(30), @ItemPos int )AS
BEGIN
SET NOCOUNT ON;
SET @strUserID = ltrim(rtrim(@strUserID))
print 'Islem basladi'
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
print 'Kullanici kontrol ediliyor'
if (@IsRealUser > 0)
BEGIN
print 'Kulanici bulundu'
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum > 0
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked = 0
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
print 'Kilit basarili'
return
END
if @IsAlreadyLocked > 0
BEGIN
delete from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
print 'UnKilit basarili'
return
END
END
END
END
END
return
END
GO
Şimdi iste Tablolarımıza geçelim
TABLO 1 :
Konu link görüntülemek için konuya cevap yazmalısınız.
Item Kilitleme 1299 İçin Procedur ve PHP Dosyası Geliştirme Rehberi
Knight Online özel sunucularında (pserver) geliştirme yapan geliştiriciler için önemli konulardan birisi, item kilitleme sistemleridir. Özellikle 1299 item numarası gibi belirli eşyaların kullanımını sınırlamak istendiğinde özel prosedürler yazmak oldukça faydalıdır. Bu makalede, item kilitleme işlemi için kullanılacak olan .procedur ve .php dosyalarının nasıl oluşturulacağını detaylıca ele alacağız.
Procedur Nedir?
Procedur, Knight Online özel sunucularında veritabanı seviyesinde çalışan özel SQL prosedürleridir. Genellikle oyuncu envanterindeki itemler üzerinde değişiklik yapmak, kontrol etmek veya kilitlemek için kullanılır. Bu prosedürler, sunucu tarafında çalışan temel yapı taşlarından birisidir.
1299 Numaralı Item Nedir?
1299 numaralı item, Knight Online'da genellikle bir tür özel aksesuardır. Bu item, geliştiriciler tarafından özel sunucularda sınırlı kullanım veya özel özellikler için tercih edilir. Bu nedenle, bu itemin kilidi açılmadan veya yanlış kullanılmaması için özel kontroller yapılmalıdır.
Procedur Dosyası Oluşturma
CREATE PROCEDURE komutu ile başlayan bu dosya, genellikle item.bin dosyasında tanımlanan item numaraları üzerinden çalışır. Aşağıda örnek bir item kilitleme prosedürü görülmektedir:
PHP Tarafında Kontrol
PHP tarafında, bu işlemi tetiklemek için bir fonksiyon yazmak gerekir. Bu fonksiyon, oyuncu oyun içi bir komut veya buton ile tetiklenir. Örnek bir PHP kod parçası şu şekildedir:
Güvenlik ve Performans
SQL injection gibi güvenlik açıklarını önlemek için parametreli sorgular kullanmak önemlidir. Ayrıca, bu tür işlemler sunucu performansını etkileyebileceğinden, sıklıkla çağrılan prosedürlerin optimize edilmiş olması gerekir.
Knight Lobby
Knight Lobby olarak, Knight Online özel sunucu geliştiricileri için sürekli yeni kaynaklar, scriptler ve rehberler hazırlıyoruz. Sitemizde KO development, KO emulator, item.bin düzenlemeleri ve diğer tüm gelişmeler hakkında bilgi bulabilirsiniz.
Sonuç
Item kilitleme işlemi, özel sunucularda güvenliği ve dengeyi sağlamak açısından hayati öneme sahiptir. 1299 numaralı item gibi özel eşyaların kontrolü, hem oyun içi dengeyi korur hem de hile kullanımını engeller. Bu tür işlemleri doğru bir şekilde uygulamak, sunucu sahipleri için büyük avantaj sağlar.
Guide to Creating Procedur and PHP File for Item Locking with ID 1299
One of the important topics for developers working on Knight Online private servers is the item locking system. When specific items like item number 1299 need to be restricted from use, writing custom procedures becomes crucial. In this article, we will detail how to create both the .procedur and .php files required for the item locking process.
What is a Procedur?
Procedur refers to custom SQL procedures that run at the database level within Knight Online private servers. These are commonly used to modify, check, or lock items within a player's inventory. Such procedures are one of the fundamental building blocks on the server side.
What is Item Number 1299?
Item 1299 in Knight Online typically represents a special kind of accessory. Developers often use this item on private servers for limited usage or special features. Therefore, it requires special checks to ensure it is not unlocked or misused.
Creating the Procedur File
This file begins with the CREATE PROCEDURE command and operates based on item numbers defined in the item.bin file. Below is an example of an item locking procedure:
Control via PHP
To trigger this operation on the PHP side, a function must be written. This function can be triggered by a player through an in-game command or button. An example PHP code snippet is as follows:
Security and Performance
It's essential to use parameterized queries to prevent security vulnerabilities like SQL injection. Additionally, since such operations may affect server performance, frequently called procedures should be optimized.
Knight Lobby
As Knight Lobby, we continuously provide new resources, scripts, and guides for Knight Online private server developers. You can find information on KO development, KO emulator, item.bin modifications, and more on our site.
Conclusion
Item locking is vital for maintaining balance and security in private servers. Controlling items like item number 1299 helps preserve in-game balance and prevents cheating. Properly implementing these processes offers significant advantages to server owners.
Bu sql kodları sayesinde item kitlemeyi sorunsuz yapabilirsiniz.
Sql Kod item kitleme Aşağıda bulabilirsiniz
Bu kodları sırayla SQL nize girin item kitleme sorunsuz çalışmaktadır.
KOD 1 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemSealOnPos]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemSealOnPos]
GO
CREATE PROCEDURE [dbo].[ItemSealOnPos] (@strUserID varchar(30), @ItemNum int,@ItemPos int )
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNumCheck int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0 and @ItemNum > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNumCheck = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum = @ItemNumCheck
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked = 0
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
print 'Kilit basarili'
return
END
END
END
END
END
print 'Kilit basarisiz'
return
END
[/HIDE-THANKS]
KOD 2 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemUnSealOnPos]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemUnSealOnPos]
GO
CREATE PROCEDURE [dbo].[ItemUnSealOnPos] (@strUserID varchar(30), @ItemNum int,@ItemPos int )
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNumCheck int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0 and @ItemNum > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNumCheck = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum = @ItemNumCheck
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked > 0
BEGIN
delete from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
print 'UnKilit basarili'
return
END
END
END
END
END
print 'UnKilit basarisiz'
return
END
GO
KOD 3 :
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[FetchUserItems]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[FetchUserItems]
GO
CREATE PROCEDURE [dbo].[FetchUserItems] (@strUserID varchar(30))
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int,@ItemPos as int,@ItemStack as int,@ItemDuration as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0
BEGIN
delete from ListUserItems where strUserID=@strUserID
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @ItemPos = 0
SET @i = (((@ItemPos + 1) * 8) - 7)
while 401 > @i
BEGIN
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
SET @ItemDuration = cast(cast(cast( substring(@InventoryItems, @i+5, 1) as varbinary(1))+cast(substring(@InventoryItems, @i+4, 1) as varbinary(1)) as varbinary(2)) as smallint)
SET @ItemStack = cast(cast(cast( substring(@InventoryItems, @i+7, 1) as varbinary(1))+cast(substring(@InventoryItems, @i+6, 1) as varbinary(1)) as varbinary(2)) as smallint)
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
INSERT INTO ListUserItems (strUserID,ItemPos,ItemNum,ItemSerial,ItemStack,It emDuration,ItemSealed) values (@strUserID,@ItemPos,@ItemNum,@ItemSerial,@ItemSta ck,@ItemDuration,@IsAlreadyLocked)
SET @ItemPos = @ItemPos + 1
SET @i = (((@ItemPos + 1) * 8) - 7)
END
END
select * from ListUserItems where strUserID=@strUserID order by ItemPos
return
END
print 'Item listing fail'
return
END
GO
KOD 4:
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ItemSealInventory]') AND type in (N'P', N'PC'))DROP PROCEDURE [dbo].[ItemSealInventory]
GO
CREATE PROCEDURE [dbo].[ItemSealInventory] (@strUserID varchar(30))
AS
BEGIN
SET NOCOUNT ON;
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int,@ItemPos as int,@ItemStack as int,@ItemDuration as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
if @IsRealUser > 0
BEGIN
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @ItemPos = 0
SET @i = (((@ItemPos + 1) * 8) - 7)
while 401 > @i
BEGIN
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if (@IsAlreadyLocked = 0) and (@ItemNum > 0) and (@ItemSerial > 0)
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
END
SET @ItemPos = @ItemPos + 1
SET @i = (((@ItemPos + 1) * 8) - 7)
END
END
print 'Inventory lock success'
return
END
print 'Inventory lock failed'
return
END
GO
KOD 5 :
CREATE PROCEDURE [dbo].[ItemKilitlePanel] (@strUserID varchar(30), @ItemPos int )AS
BEGIN
SET NOCOUNT ON;
SET @strUserID = ltrim(rtrim(@strUserID))
print 'Islem basladi'
DECLARE @ItemNum int,@ItemSerial bigint,@IsRealUser smallint,@InventoryItems varchar(400),@InventorySerials varchar(400),@i as int,@IsAlreadyLocked as int
select top 1 @IsRealUser=COUNT(strUserID) from USERDATA where strUserId=@strUserID
print 'Kullanici kontrol ediliyor'
if (@IsRealUser > 0)
BEGIN
print 'Kulanici bulundu'
select @InventoryItems=strItem,@InventorySerials=strSeria l from USERDATA where strUserId=@strUserID
if (@InventoryItems is not null) and (@InventorySerials is not null)
BEGIN
SET @i = (((@ItemPos + 1) * 8) - 7)
SET @ItemNum = cast(cast(substring(cast(substring(@InventoryItems , @i,4) as varbinary(4)), 4, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 3, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 2, 1)+substring(cast(substring(@InventoryItems, @i,4) as varbinary(4)), 1, 1) as varbinary(4)) as int)
if @ItemNum > 0
BEGIN
SET @ItemSerial = cast(cast(substring(cast(substring(@InventorySeria ls, @i,8) as varbinary(8)), 8, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 7, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 6, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 5, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 4, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 3, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 2, 1)+substring(cast(substring(@InventorySerials, @i,8) as varbinary(8)), 1, 1) as varbinary(8)) as bigint)
if @ItemSerial <> 0
BEGIN
select top 1 @IsAlreadyLocked = COUNT(strUserID) from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
if @IsAlreadyLocked = 0
BEGIN
INSERT INTO User_LockedItems (strUserID,ItemSerial,ItemNum) values (@strUserID,@ItemSerial,@ItemNum)
print 'Kilit basarili'
return
END
if @IsAlreadyLocked > 0
BEGIN
delete from User_LockedItems where strUserID = @strUserID and ItemSerial = @ItemSerial and ItemNum = @ItemNum
print 'UnKilit basarili'
return
END
END
END
END
END
return
END
GO
Şimdi iste Tablolarımıza geçelim
TABLO 1 :
Konu link görüntülemek için konuya cevap yazmalısınız.
Item Kilitleme 1299 İçin Procedur ve PHP Dosyası Geliştirme Rehberi
Knight Online özel sunucularında (pserver) geliştirme yapan geliştiriciler için önemli konulardan birisi, item kilitleme sistemleridir. Özellikle 1299 item numarası gibi belirli eşyaların kullanımını sınırlamak istendiğinde özel prosedürler yazmak oldukça faydalıdır. Bu makalede, item kilitleme işlemi için kullanılacak olan .procedur ve .php dosyalarının nasıl oluşturulacağını detaylıca ele alacağız.
Procedur Nedir?
Procedur, Knight Online özel sunucularında veritabanı seviyesinde çalışan özel SQL prosedürleridir. Genellikle oyuncu envanterindeki itemler üzerinde değişiklik yapmak, kontrol etmek veya kilitlemek için kullanılır. Bu prosedürler, sunucu tarafında çalışan temel yapı taşlarından birisidir.
1299 Numaralı Item Nedir?
1299 numaralı item, Knight Online'da genellikle bir tür özel aksesuardır. Bu item, geliştiriciler tarafından özel sunucularda sınırlı kullanım veya özel özellikler için tercih edilir. Bu nedenle, bu itemin kilidi açılmadan veya yanlış kullanılmaması için özel kontroller yapılmalıdır.
Procedur Dosyası Oluşturma
CREATE PROCEDURE komutu ile başlayan bu dosya, genellikle item.bin dosyasında tanımlanan item numaraları üzerinden çalışır. Aşağıda örnek bir item kilitleme prosedürü görülmektedir:
Kod:
[B]CREATE PROCEDURE[/B] LockItem1299([BR][/BR]IN itemID INT,[BR][/BR]IN playerID INT[BR][/BR])[BR][/BR][B]BEGIN[/B][BR][/BR][B]UPDATE[/B] CharacterInventory[BR][/BR][B]SET[/B] IsLocked = 1[BR][/BR][B]WHERE[/B] ItemNumber = itemID[BR][/BR][B]AND[/B] OwnerID = playerID;[BR][/BR][B]END[/B]
PHP Tarafında Kontrol
PHP tarafında, bu işlemi tetiklemek için bir fonksiyon yazmak gerekir. Bu fonksiyon, oyuncu oyun içi bir komut veya buton ile tetiklenir. Örnek bir PHP kod parçası şu şekildedir:
Kod:
[B]function[/B] lockItem1299([extract_itex]playerID, [/extract_itex]itemID) {[BR][/BR][B]global[/B] [extract_itex]dbConnection;[BR][/BR][/extract_itex]sql = [I]'CALL LockItem1299(?, ?)'[/I];[BR][/BR][B][extract_itex]stmt[/B] = [extract_itex]dbConnection->prepare([/extract_itex]sql);[BR][/BR][extract_itex]stmt->bind_param(Ii', [/extract_itex]itemID, [extract_itex]playerID);[BR][/BR][/extract_itex]stmt->execute();[BR][/BR]}
Güvenlik ve Performans
SQL injection gibi güvenlik açıklarını önlemek için parametreli sorgular kullanmak önemlidir. Ayrıca, bu tür işlemler sunucu performansını etkileyebileceğinden, sıklıkla çağrılan prosedürlerin optimize edilmiş olması gerekir.
Knight Lobby
Knight Lobby olarak, Knight Online özel sunucu geliştiricileri için sürekli yeni kaynaklar, scriptler ve rehberler hazırlıyoruz. Sitemizde KO development, KO emulator, item.bin düzenlemeleri ve diğer tüm gelişmeler hakkında bilgi bulabilirsiniz.
Sonuç
Item kilitleme işlemi, özel sunucularda güvenliği ve dengeyi sağlamak açısından hayati öneme sahiptir. 1299 numaralı item gibi özel eşyaların kontrolü, hem oyun içi dengeyi korur hem de hile kullanımını engeller. Bu tür işlemleri doğru bir şekilde uygulamak, sunucu sahipleri için büyük avantaj sağlar.
Guide to Creating Procedur and PHP File for Item Locking with ID 1299
One of the important topics for developers working on Knight Online private servers is the item locking system. When specific items like item number 1299 need to be restricted from use, writing custom procedures becomes crucial. In this article, we will detail how to create both the .procedur and .php files required for the item locking process.
What is a Procedur?
Procedur refers to custom SQL procedures that run at the database level within Knight Online private servers. These are commonly used to modify, check, or lock items within a player's inventory. Such procedures are one of the fundamental building blocks on the server side.
What is Item Number 1299?
Item 1299 in Knight Online typically represents a special kind of accessory. Developers often use this item on private servers for limited usage or special features. Therefore, it requires special checks to ensure it is not unlocked or misused.
Creating the Procedur File
This file begins with the CREATE PROCEDURE command and operates based on item numbers defined in the item.bin file. Below is an example of an item locking procedure:
Kod:
[B]CREATE PROCEDURE[/B] LockItem1299([BR][/BR]IN itemID INT,[BR][/BR]IN playerID INT[BR][/BR])[BR][/BR][B]BEGIN[/B][BR][/BR][B]UPDATE[/B] CharacterInventory[BR][/BR][B]SET[/B] IsLocked = 1[BR][/BR][B]WHERE[/B] ItemNumber = itemID[BR][/BR][B]AND[/B] OwnerID = playerID;[BR][/BR][B]END[/B]
Control via PHP
To trigger this operation on the PHP side, a function must be written. This function can be triggered by a player through an in-game command or button. An example PHP code snippet is as follows:
Kod:
[B]function[/B] lockItem1299([extract_itex]playerID, [/extract_itex]itemID) {[BR][/BR][B]global[/B] [extract_itex]dbConnection;[BR][/BR][/extract_itex]sql = [I]'CALL LockItem1299(?, ?)'[/I];[BR][/BR][B][extract_itex]stmt[/B] = [/extract_itex]dbConnection->prepare([extract_itex]sql);[BR][/BR][/extract_itex]stmt->bind_param('Ii', [extract_itex]itemID,[/extract_itex]playerID);[BR][/BR][extract_itex]stmt->execute();[BR][/BR]}
Security and Performance
It's essential to use parameterized queries to prevent security vulnerabilities like SQL injection. Additionally, since such operations may affect server performance, frequently called procedures should be optimized.
Knight Lobby
As Knight Lobby, we continuously provide new resources, scripts, and guides for Knight Online private server developers. You can find information on KO development, KO emulator, item.bin modifications, and more on our site.
Conclusion
Item locking is vital for maintaining balance and security in private servers. Controlling items like item number 1299 helps preserve in-game balance and prevents cheating. Properly implementing these processes offers significant advantages to server owners.
