• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Tutorial] Modifying some functions, ADMIN_BanUser AND ADMIN_UnbanUser

Joined
Apr 23, 2013
Messages
1,172
Reaction score
1,797
Hi, So for all RaGEZONE
I'm using the source: Doom V3


So remember, what it does, do not criticize, it is only to give an effect on your emulator is easy and simple.


Brief description for this tutorial:


"I was banned some players, and I came across the ADMN_BanUser function where is running for the command, and why not some modified?"


By default it will only "BAN" AccStatus = 200 in "UsersData" nothing more
What I i'm going is ban on "Accounts" remove "AcDEV" and let the count ban


Let's go tutorial!




Open you Navicat WarZ>dbo>Functions
Search for: ADMIN_BanUser


Search CODE
Code:
update UsersData set 
           AccountStatus=200, 
           BanReason=@BanReason, 
           BanTime=GETDATE(),
           BanCount=(BanCount+1),
           BanExpireDate='2030-1-1'
           where CustomerID=@in_CustomerID


below you will add


Code:
--- Set Acc to banned By LCCB
        update Accounts set 
            AccountStatus=200
            where CustomerID=@in_CustomerID




        -- Remove DEV By LCCB
        update Accounts set 
            IsDeveloper=0
            where CustomerID=@in_CustomerID




        -- Remove DEV By LCCB
        update UsersData set 
            IsDeveloper=0
            where CustomerID=@in_CustomerID




        -- Set account type to Survival By LCCB
        update UsersData set 
            AccountType=2
            where CustomerID=@in_CustomerID


your code will look something like this


ALTER PROCEDURE [dbo].[ADMIN_BanUser]
@in_CustomerID int,
@in_BanReason nvarchar(256),
@in_OptPermaBan int = 1, -- by default we now perma ban
@in_OptBanFromGameblocks int = 0 -- if this ban is coming from gameblocks system
AS
BEGIN
SET NOCOUNT ON;
if(LEN(@in_BanReason) < 4) begin
select 'GIVE PROPER REASON'
return
end




set @in_OptPermaBan = 1 -- always perma ban (workaround for bug on server that wasn't perma banning players)




declare @email varchar(128)
select @email=email from dbo.Accounts where CustomerID=@in_CustomerID




-- do not ban multiple times
declare @accountStatus int = 0
declare @accountType int = 0
declare @BanCount int = 0
declare @BanReason nvarchar(512)
select @accountStatus=AccountStatus, @accountType=AccountType,
@BanCount=BanCount,
@BanReason=BanReason
from UsersData where CustomerID=@in_CustomerID
if @accountStatus = 200 or @accountStatus = 201 and @in_OptPermaBan=0)) begin
select 0 as ResultCode, 'already banned' as ResultMsg, @email as 'email'
return
end


-- do not allow gameblocks to ban russian players, they will only kick them from US\EU servers
--if(@in_OptBanFromGameblocks=1 AND @accountType>=50 AND @accountType<=59)) begin
-- select 0 as ResultCode, 'cannot ban USSR player' as ResultMsg
-- return
--end






-- clear his login session
update dbo.LoginSessions set SessionID=0 where CustomerID=@in_CustomerID


-- set his all alive chars to respawned mode
update dbo.UsersChars set Alive=2 where CustomerID=@in_CustomerID and Alive=1




if(@BanReason is null) set @BanReason = @in_BanReason
else set @BanReason = @in_BanReason + ', ' + @BanReason




-- guest ban, permament
if @accountType = 3) begin
set @BanReason = '[GUEST_BAN] ' + @BanReason
set @BanCount = 99;
end


-- ban
if(@BanCount > 0 or @in_OptPermaBan=1)
begin
insert into dbo.DBG_BanLog values (@in_CustomerID, GETDATE(), 2000, @in_BanReason)




update UsersData set
AccountStatus=200,
BanReason=@BanReason,
BanTime=GETDATE(),
BanCount=(BanCount+1),
BanExpireDate='2030-1-1'
where CustomerID=@in_CustomerID




--- Set Acc to banned By LCCB
update Accounts set
AccountStatus=200
where CustomerID=@in_CustomerID




-- Remove DEV By LCCB
update Accounts set
IsDeveloper=0
where CustomerID=@in_CustomerID




-- Remove DEV By LCCB
update UsersData set
IsDeveloper=0
where CustomerID=@in_CustomerID




-- Set account type to Survival By LCCB
update UsersData set
AccountType=2
where CustomerID=@in_CustomerID


select 0 as ResultCode, 'Permanent BAN' as ResultMsg, @email as 'email', @BanReason as 'BanReason'




-- change leadership of clan if customer had chars who was clan leaders
exec WZ_ClanFN_OnCustomerBanned @in_CustomerID




return
end
else
begin
declare @Bantime int = 72




insert into dbo.DBG_BanLog values (@in_CustomerID, GETDATE(), @Bantime, @in_BanReason)




update UsersData set
AccountStatus=201,
BanReason=@BanReason,
BanTime=GETDATE(),
BanCount=(BanCount+1),
BanExpireDate=DATEADD(hour, @Bantime, GETDATE())
where CustomerID=@in_CustomerID




select 0 as ResultCode, 'temporary ban' as ResultMsg, @email as 'email', @BanReason as 'BanReason'
return
end
END


now we do when the account was banned continue counting

Open Functions>ADMIN_UnbanUser


it is simpler than it seems


Search: UPDATE [dbo].[UsersData]
and modify
Code:
,[BanCount] = 0
ADD: --
Code:
--,[BanCount] = 0


and add to low


Code:
UPDATE Accounts set

Code:
           AccountStatus=100
           where CustomerID=@in_CustomerID




look something like this




ALTER PROCEDURE [dbo].[ADMIN_UnbanUser]
@in_CustomerID int,
@in_UnbanReason nvarchar(256)
AS
BEGIN
SET NOCOUNT ON;


if(LEN(@in_UnbanReason) < 4) begin
select 'GIVE PROPER REASON'
return
end




-- do not update ban reason, to be able to see later that he was unbanned previously
UPDATE [dbo].[UsersData]
SET [AccountStatus] = 100
,[BanTime] = null
--,[BanCount] = 0
,[BanExpireDate] = null
WHERE [CustomerID]=@in_CustomerID




UPDATE Accounts set
AccountStatus=100
where CustomerID=@in_CustomerID




-- log unban as well
insert into dbo.DBG_BanLog values (@in_CustomerID, GETDATE(), -1, @in_UnbanReason)




select 0 as ResultCode


END


Credits: For me and who did Infestation
I'm sorry for bad English
 
Last edited:
Harro
Joined
Mar 29, 2013
Messages
754
Reaction score
284
Nice simple tutorial someone will find a use out of this thanks for the share.
 
Back
Top