Ayın Serverı
DeathKO | v1453 Fire Drake | Official Açılış: 12 HAZİRAN - 21:00 GMT+3
12 gün 5 saat önce açıldı
Server'a Göz At
[PAYLAŞIM] Otomatik Irk seçim , 2 Irk'ta eşit olsun...
Merhaba, ihtiyaç olduğunu düşündüğüm koddur paylaşmak istedim bu sebeple serverlarda ırk eşitsizliği gibi sorunlar yaşanmaz daha eğlenceli bir oyun çıkarmak adına kullanabilirsiniz Kendi yaptıgım bir kod değildir alıntıdır sadece ihtiyacınız olur dıye paylaşıyorum iyi forumlar 🙂
CREATE PROCEDURE [dbo].[ACCOUNT_LOGIN]@AccountID varchar(21),
@Password varchar(13),
@nRet smallint OUTPUT
AS
DECLARE @pwd varchar(32), @Authority int, @count int, @Nation int, @CharNum int,@Statu int,@Faruk int
SET @Statu = 1
BEGIN
--
SELECT @pwd = strPasswd, @Authority = strAuthority FROM TB_USER WHERE strAccountID = @AccountID
--
--
IF @@ROWCOUNT = 0
BEGIN
SET @nRet = 0
RETURN
END
--
--
IF @Authority = 255
BEGIN
SET @nRet = 0
RETURN
END
--
--
ELSE IF @pwd IS NULL
BEGIN
SET @nRet = 0
RETURN
END
--
--
SELECT @Nation = bNation, @CharNum = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
SELECT @Faruk = COUNT(strAccountID) FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
--
IF @Statu = 1
BEGIN
IF @Faruk > 0
BEGIN
SET @nRet = @Nation + 1
RETURN
END
ELSE
BEGIN
DECLARE @K int,@H int,@CountAccount int
SELECT @K = count(strAccountID) FROM ACCOUNT_CHAR WHERE bNation = 1
SELECT @H = count(strAccountID) FROM ACCOUNT_CHAR WHERE bNation = 2
IF @K < @H --Karus az
BEGIN
INSERT INTO ACCOUNT_CHAR (strAccountID, bNation ) VALUES (@AccountID, 1)
INSERT INTO WAREHOUSE ( strAccountID ) VALUES (@AccountID)
SET @nRet = 2
RETURN
END
IF @H < @K --Human az
BEGIN
INSERT INTO ACCOUNT_CHAR (strAccountID, bNation ) VALUES (@AccountID, 2)
INSERT INTO WAREHOUSE ( strAccountID ) VALUES (@AccountID)
SET @nRet = 3
RETURN
END
IF @H = @K --Irklar Eşit Kendisi Seçsin
BEGIN
SET @nRet = 1
RETURN
END
END
END
ELSE
BEGIN
--
IF @Nation = 0 OR @CharNum = 0
BEGIN
SET @nRet = 1
END
--
ELSE
--
BEGIN
SET @nRet = @Nation + 1
END
--
END
END
Kayıt: 2026
Mesaj: 0
İtibar: 0
Cevap yazabilmek için giriş yapmalısınız.