Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Tutorial] One Account per HardwarID

Junior Spellweaver
Joined
Jun 22, 2014
Messages
175
Reaction score
87
Based on @zombizinho 's tutorial for one account per IP.
Only for new DNC source.

a) Open your Navicat and connect to your server.
b) Double Click on WarZ
c) Double Click on dbo
d) Double Click on functions
e) Open WZ_Account_Create

Search for:
@in_IP varchar(64),
Under it add:
@in_HardwareID varchar(14),

Now Search:
-- validate that email is unique if exists (SELECT CustomerID from Accounts WHERE email=@in_Email) begin
select 2 as ResultCode, 'Email already in use' as ResultMsg;
return;
end
Under it add:
if exists (SELECT CustomerID from HWID_Log WHERE HardwareID=@in_HardwareID) begin
select 2 as ResultCode, 'HWID is already registered' as ResultMsg;
return;
end

Credits: zombizinho & Me
 
Last edited:
Junior Spellweaver
Joined
Jun 22, 2014
Messages
175
Reaction score
87
Mhm Yuri :) Works well for me :)

[If you use DNC new source =)]
 
Junior Spellweaver
Joined
Jun 22, 2014
Messages
175
Reaction score
87
Yuri, the database always logs the last hardwareID.

Look =)
UNEXPECT - [Tutorial] One Account per HardwarID - RaGEZONE Forums
 
Experienced Elementalist
Joined
Oct 23, 2013
Messages
289
Reaction score
29
All new users also cant create new accounts on ragezone community editon 2014
 
Newbie Spellweaver
Joined
Jul 29, 2014
Messages
65
Reaction score
2
my code

Code:
-- ----------------------------
-- Procedure structure for [WZ_ACCOUNT_CREATE]
-- ----------------------------

ALTER PROCEDURE [dbo].[WZ_ACCOUNT_CREATE]
    @in_IP varchar(64),
  @in_HardwareID varchar(14), 
    @in_Email varchar(128),
    @in_Password varchar(64),
    @in_ReferralID int,
    @in_SerialKey varchar(128),
    @in_SerialEmail varchar(128)
AS
BEGIN
    SET NOCOUNT ON;
    
    --
    -- NOTE: add new ResultCodes to updater CUpdater::CreateAccThreadEntry
    --
    

-- check for serial key
    --declare [USER=363813]KEY[/USER]ResultCode int = 99
    --declare [USER=363813]KEY[/USER]CustomerID int = 99
    --declare [USER=777683]Keyser[/USER]ialType int = 99
    --exec [BreezeNet].[dbo].[BN_WarZ_SerialGetInfo]
        --    @in_SerialKey,
        --    @in_SerialEmail,
        --    [USER=363813]KEY[/USER]ResultCode out,
        --    [USER=363813]KEY[/USER]CustomerID out,
        --    [USER=777683]Keyser[/USER]ialType out
                                
    --if [USER=363813]KEY[/USER]ResultCode <> 0 or [USER=363813]KEY[/USER]CustomerID > 0) begin
    --    select 3 as ResultCode, 'Serial not valid' as ResultMsg;
    --    return
    --end
    declare [USER=777683]Keyser[/USER]ialType int = 0 -- Legend Package

-- check if that account was created and refunded before (status 999)
    declare [USER=18171]ReF[/USER]undCustomerID int = 0
    select [USER=18171]ReF[/USER]undCustomerID=CustomerID from Accounts WHERE email=@in_Email and AccountStatus=999
    if [USER=18171]ReF[/USER]undCustomerID > 0) begin
        -- change email to some unique one so it can be used again.
        declare [USER=27358]date[/USER]Time varchar(128)
        set [USER=27358]date[/USER]Time = REPLACE(CONVERT(VARCHAR, GETDATE(),111),'/','') + REPLACE(CONVERT(VARCHAR, GETDATE(),108),':','')
        declare [USER=18171]ReF[/USER]undedEmail varchar(128) = '(' + [USER=27358]date[/USER]Time + ') ' + @in_Email
        update Accounts set email [USER=18171]ReF[/USER]undedEmail where CustomerID [USER=18171]ReF[/USER]undCustomerID
    end
    
-- validate that email is unique
    if exists (SELECT CustomerID from Accounts WHERE email=@in_Email) begin
        select 2 as ResultCode, 'Email already in use' as ResultMsg;
        return;
    end

if exists (SELECT CustomerID from HWID_Log WHERE HardwareID=@in_HardwareID) begin
select 2 as ResultCode, 'HWID is already registered' as ResultMsg;
return;
end 
    
-- create user
    declare [USER=858930]MD5[/USER]FromPwd varchar(100)
    exec FN_CreateMD5Password @in_Password, [USER=858930]MD5[/USER]FromPwd OUTPUT
    INSERT INTO Accounts ( 
        email,
        MD5Password,
        dateregistered,
        ReferralID,
        lastlogindate,
        lastloginIP
    ) VALUES (
        @in_EMail,
        [USER=858930]MD5[/USER]FromPwd,
        GETDATE(),
        @in_ReferralID,
        GETDATE(),
        @in_IP
    )

    -- get new CustomerID
    declare [USER=25895]Custom[/USER]erID int
    SELECT [USER=25895]Custom[/USER]erID=CustomerID from Accounts where email=@in_Email

-- create all needed user tables
    INSERT INTO UsersData (
        CustomerID,
        AccountType,
        dateregistered
    ) VALUES (
        [USER=25895]Custom[/USER]erID,
        [USER=777683]Keyser[/USER]ialType,
        GETDATE()
    )
    
    -- guest accounts have 48hrs play time (sync with WZ_ACCOUNT_APPLYKEY also)
    if [USER=777683]Keyser[/USER]ialType = 3) begin
        declare [USER=27358]date[/USER]ActiveUntil datetime = DATEADD(hour, 48, GETDATE())
        update UsersData set DateActiveUntil [USER=27358]date[/USER]ActiveUntil where CustomerID [USER=25895]Custom[/USER]erID
    end
    
-- register CustomerID in BreezeNet
    exec [BreezeNet].[dbo].[BN_WarZ_SerialSetCustomerID] @in_SerialKey, [USER=25895]Custom[/USER]erID

-- default items and bonuses for account types

    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 20174, 2000 -- hero: regular guy

    -- CBT TEST HEROES
    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 20182, 2000
    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 20184, 2000

    -- 10 of each
    --declare @i int = 0
    --while(@i < 10) begin
    --    set @i = @i + 1

    --    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 101306, 2000 -- Flashlight
    --    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 101261, 2000 -- Bandages
    --    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 101296, 2000 -- Can of Soda
    --    exec FN_AddItemToUser [USER=25895]Custom[/USER]erID, 101289, 2000 -- Granola Bar
    --end

-- BONUSES for packages - do not forget to sync them with [WZ_ACCOUNT_APPLYKEY]
    if [USER=777683]Keyser[/USER]ialType = 0) begin
        -- legend package, 30$ 1GC=142
        update UsersData set GamePoints=(GamePoints+4260) where CustomerID [USER=25895]Custom[/USER]erID
    end

    if [USER=777683]Keyser[/USER]ialType = 1) begin
        -- pioneer package, 15$ 1GC=142
        update UsersData set GamePoints=(GamePoints+2139) where CustomerID [USER=25895]Custom[/USER]erID
    end
    
    -- success
    select 0 as ResultCode
    select [USER=25895]Custom[/USER]erID as CustomerID, [USER=777683]Keyser[/USER]ialType as 'AccountType'

    return
END

error: O_API: failed with error code 5 SQL Select Failed: Die Prozedur oder Funktion 'WZ_ACCOUNT_CREATE' erwartet den @in_HardwareID-Parameter, der nicht bereitgestellt wurde.
 
Last edited by a moderator:
Newbie Spellweaver
Joined
Oct 8, 2014
Messages
52
Reaction score
18
error: O_API: failed with error code 5 SQL Select Failed: Die Prozedur oder Funktion 'WZ_ACCOUNT_CREATE' erwartet den @in_HardwareID-Parameter, der nicht bereitgestellt wurde.

Add this in api_AccRegister.aspx.cs
sqcmd.Parameters.AddWithValue("@in_HardwareID", 0);
 
Back
Top