Server owners or SQL coders, please help

Results 1 to 1 of 1
  1. #1
    Apprentice romaz is offline
    MemberRank
    May 2013 Join Date
    19Posts

    idea Server owners or SQL coders, please help

    I need help from warinc server owners of coders.
    I use RUS WarInc client, and he calling GNABalance function.
    Here is from CLIENT source:
    Code:
    int CClientUserProfile::ApiGNAGetBalance(){
        if(!RUS_CLIENT)
            r3dError("ApiGNAUpdateBalance");
            
        CWOBackendReq req(this, "api_GNAGetBalance.aspx");
        if(!req.Issue())
        {
            r3dOutToLog("GNAUpdateBalance FAILED, code: %d\n", req.resultCode_);
            return req.resultCode_;
        }
    
    
        int balance = 0;
        int nargs = sscanf(req.bodyStr_, "%d" , &balance);
        if(nargs != 1)
        {
            r3dError("wrong answer for GNAUpdateBalance");
            return 9;
        }
        
        ProfileData.Stats.GamePoints = balance;
        return 0;
    }

    Here is from WO_GNAGetBalance function:
    Code:
    ALTER PROCEDURE [dbo].[WO_GNAGetBalance]
        @in_CustomerID int
    AS
    BEGIN
        SET NOCOUNT ON;
    
    
        -- gna service id for warinc
        declare @serviceId bigint = 300005010000000000
    
    
        -- get points for that customer
        declare @GNAUserId bigint
        select CustomerID from LoginID where CustomerID=@in_CustomerID
        if (@@RowCount = 0) begin
            select 6 as ResultCode, 'no CustomerID' as ResultMsg
            return
        end
        declare @AuthId varchar(40)
        set @AuthId = convert(varchar(32), @CustomerID)
    
    
        -- get balance from gamenet
        DECLARE @o_Balance money;
        DECLARE @o_Error int;
    
    
        SET @o_Balance = NULL;
        SET @o_Error = NULL;
        EXEC dblink_api.billing.dbo.usp_GetBalance 
            @i_ServiceId = @serviceId,
            @i_AuthType = 'user_id',
            @i_AuthId = @AuthId,
            @o_Balance = @o_Balance out,
            @o_Error = @o_Error out;
        if(@o_Error > 0) begin
            select 6 as ResultCode, 'can not get balance' as ResultMsg
            return
        end
        
        -- convert NULL to 0
        if(@o_Balance is NULL) set @o_Balance = 0
    
    
        declare @Balance int = convert(int, @o_Balance)
        select 0 as ResultCode
        select @Balance as 'GNABalance'
    
    
    END
    But it getting error, see r3dlog
    000018.231| WO_API: failed with error code 5 ResultCode not set
    000018.231| GetProfile FAILED, code: 5

    SQL function need recode from using GameNet DB to getting balance from LoginID -> GamePoints, and then getting this to client as @Balance.

    Enyone can help?

    P.S If we'll fix this problem I make tutorial to fixing all problems as Server or Loading Game Data.
    Last edited by romaz; 23-03-14 at 03:09 AM.




Advertisement