[Help] how to fix 0 Health or -15 Health after dead (dnc 2014)

Results 1 to 8 of 8
  1. #1
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    [Help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    i has a problem

    after i dead my Health value is 0 or -10

    then re login game but i will dead again and all item drop (double drop + dead)
    Last edited by DNC; 07-07-14 at 10:06 AM.


  2. #2
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    after dead Health = 0

  3. #3
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,493Posts

    Re: [help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    I have not seen this issue @javaz97
    Have you added any custom code or snippets into the source?
    I would highly suspect that there is, based on your description.
    I'd start with what you added and see what modified my work.

  4. #4
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    my revive

    Code:
    USE [WarZ]
    GO
    /****** Object:  StoredProcedure [dbo].[WZ_CharRevive]    Script Date: 07/07/2014 14:30:28 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    
    -- ----------------------------
    -- Procedure structure for [dbo].[WZ_CharRevive]
    -- ----------------------------
    
    ALTER PROCEDURE [dbo].[WZ_CharRevive]
        @in_CustomerID int,
        @in_CharID int,
        @in_Health int
    AS
    BEGIN
        SET NOCOUNT ON;
    
        -- validate CharID/CustomerID pair
        declare @CustomerID int = 0
        select @CustomerID=CustomerID from UsersChars where CharID=@in_CharID
        if(@@ROWCOUNT = 0 or @CustomerID <> @in_CustomerID) begin
            select 6 as ResultCode, 'bad charid' as ResultMsg
            return
        end
    
        -- get developer flag
        declare @IsDeveloper int = 0
        select @IsDeveloper=IsDeveloper from UsersData where CustomerID=@in_CustomerID
    
    
        -- note that revive timer is 1hrs, change in WZ_GetAccountInfo1 as well
        declare @sectorevive int
        declare @alive int = 0
        declare @iSPRemium int
    
    	SELECT @iSPRemium=isPremium FROM UsersData WHERE CustomerID=@in_CustomerID
    
    	-- check premium account
        if @iSPRemium = 1)
        begin
    		select
    		 @sectorevive=DATEDIFF (second, GETUTCDATE (), DATEADD (second, 600, DeathUtcTime)),
    		 @alive=Alive
    		from UsersChars where CharID=@in_CharID
    	end
    
    	else
    	begin
    		select
    		 @sectorevive=DATEDIFF (second, GETUTCDATE (), DATEADD (second, 900, DeathUtcTime)),
    		 @alive=Alive
    		from UsersChars where CharID=@in_CharID
    	end
    
    
        -- prevent fast teleporting if we're not dead
        if  @alive <> 0) begin
            select 6 as ResultCode, 'character is not dead' as ResultMsg
            return
        end
    
        -- do not allow early revive, give 2min grace
    
    	if @sectorevive < 30)
    	begin
    		select 0 as ResultCode
    		update UsersChars set
    			Alive=2,
    			Health=@in_Health,
    			Food=0,
    			Water=0,
    			Toxic=0,
    			GameFlags=1,
    			GroupID=0,
    			bleeding=0,
    			legfall=0
    		where CharID=@in_CharID
            return
        end
    
    	else
    		declare @GamePoints int
    		SELECT @GamePoints=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID
    
    
    	-- Revive Price
    	declare @RevivePrice int
    	set @RevivePrice = 40 -- 40 is price
    
        if @GamePoints < @RevivePrice) begin
            select 7 as ResultCode, 'Not Enough GP' as ResultMsg
            return
        end
    
    	if @GamePoints >= @RevivePrice) begin
    		update UsersData set GamePoints=(GamePoints @RevivePrice) WHERE CustomerID=@in_CustomerID
    	end
    
        select 0 as ResultCode
    
    	-- revive
    	update UsersChars set
    		Alive=2,
    		Health=@in_Health,
    		Food=0,
    		Water=0,
    		Toxic=0,
    		GameFlags=1,
    		GroupID=0,
    		bleeding=0,
    		legfall=0
    	where CharID=@in_CharID
    
        select 0 as ResultCode
    END

  5. #5
    Custom Title Enabled GigaToni is offline
    MemberRank
    Aug 2009 Join Date
    GER / FRLocation
    2,329Posts

    Re: [help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    replace this:
    -- revive
    update UsersChars set
    Alive=2,
    Health=@in_Health,
    Food=0,
    Water=0,
    Toxic=0,
    GameFlags=1,
    GroupID=0,
    bleeding=0,
    legfall=0
    where CharID=@in_CharID

    with:
    -- revive
    update UsersChars set
    Alive=2,
    Health=100,
    Food=0,
    Water=0,
    Toxic=0,
    GameFlags=1,
    GroupID=0,
    bleeding=0,
    legfall=0
    where CharID=@in_CharID

  6. #6
    Developer DNC is offline
    DeveloperRank
    Oct 2011 Join Date
    2,493Posts

    Re: [help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    Don't do it in the procedure.

    Go back to the code and fix the issue, where it was created.
    @In_Health doesn't necessarily mean the "set" value of 100 HP. It means what was the value sent to the procedure from the source code.
    IE: How much health are we telling the procedure default is. Which could change in future updates as well.
    So go back to the source and modify it where it makes sense and follows proper coding techniques. ;0)

    Also, changing the procedure here will result in its being changed, if updates get applied.

    ***
    Not in the API code either, but in the server side implementation. WarZ_Server.sln
    Make the changes there.
    Last edited by DNC; 07-07-14 at 10:08 AM.

  7. #7
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [Help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    thank you.

    - - - Updated - - -

    code by allright

    Code:
    ALTER PROCEDURE [dbo].[WZ_CharRevive]
    	@in_CustomerID int,
    	@in_CharID int,
    	@in_Health int
    AS
    BEGIN
    	SET NOCOUNT ON;
    	
    	-- validate CharID/CustomerID pair
    	declare @CustomerID int = 0
    	select @CustomerID=CustomerID from UsersChars where CharID=@in_CharID
    	if(@@ROWCOUNT = 0 or @CustomerID <> @in_CustomerID) begin
    		select 6 as ResultCode, 'bad charid' as ResultMsg
    		return
    	end
    
    	-- get developer flag
    	declare @IsDeveloper int = 0
    	select @IsDeveloper=IsDeveloper from UsersData where CustomerID=@in_CustomerID
    
    	-- note that revive timer is 1hrs, change in WZ_GetAccountInfo1 as well
    	declare @sectorevive int
    	declare @alive int = 0
    	select 
    	 @sectorevive=DATEDIFF (second, GETUTCDATE (), DATEADD (second, 900, DeathUtcTime)),
    	 @alive=Alive
    	from UsersChars where CharID=@in_CharID
    
    	-- prevent fast teleporting if we're not dead
    	if @alive <> 0) begin
    		select 6 as ResultCode, 'character is not dead' as ResultMsg
    		return
    	end
    
    	-- do not allow early revive, give 2min grace
    	--if @sectorevive > 120 and @IsDeveloper = 0) begin
    	--	select 6 as ResultCode, 'too early' as ResultMsg
    	--	return
    	--end
    
    	-- Revive Char Early
    	if @sectorevive > 40) begin
    		-- get points for that customer
    		declare @GamePoints int
    		declare @RevivePrice int
    		set @RevivePrice = 40
    		SELECT @GamePoints=GamePoints FROM UsersData WHERE CustomerID=@in_CustomerID
    		if (@@RowCount = 0) begin
    			select 6 as ResultCode, 'No CustomerID' as ResultMsg
    			return
    		end
    
    		-- check if enough money
    		if @GamePoints < @RevivePrice) begin
    			select 6 as ResultCode, 'Not Enough GD' as ResultMsg
    			return
    		end
    
    		-- perform actual transaction
    		set @GamePoints = @GamePoints @RevivePrice;
    		UPDATE UsersData SET GamePoints @GamePoints where CustomerID=@in_CustomerID
    
    		-- update transaction detail
    		--INSERT INTO FinancialTransactions
    		--	VALUES (@in_CustomerID, 'INGAME', 2002, GETDATE(), 
    		--		 @RevivePrice, '1', 'APPROVED', '0')
    	end
    
    	-- revive
    	update UsersChars set
    		Alive=2,
    		Health=@in_Health, -- AomBESkillSystem : Health value from api.
    		Food=0,
    		Water=0,
    		Toxic=0,
    		GameFlags=1,
    		legfall=0,
    		bleeding=0
    	where CharID=@in_CharID
    
    	select 0 as ResultCode
    END

  8. #8
    Alpha Member javaz97 is offline
    MemberRank
    May 2006 Join Date
    HellLocation
    1,537Posts

    Re: [Help] how to fix 0 Health or -15 Health after dead (dnc 2014)

    pic in game




Advertisement