[FIX] [_RegisterAutomatedPunishment]

Results 1 to 3 of 3
  1. #1
    Valued Member Wismo is offline
    MemberRank
    Oct 2011 Join Date
    103Posts

    ! [FIX] [_RegisterAutomatedPunishment]

    Hello,

    here is my fix for the RegisterAutomatedPunishment procedure.

    What will it fix?
    Prevents that players can unblock themselve when they type in the password 3 times incorrect.


    Procedure:
    Code:
    USE [SRO_VT_ACCOUNT]
    GO
    /****** Object:  StoredProcedure [dbo].[_RegisterAutomatedPunishment]    Script Date: 03/23/2012 00:10:37 ******/
    SET ANSI_NULLS OFF
    GO
    SET QUOTED_IDENTIFIER OFF
    GO
    
    ALTER PROCEDURE [dbo].[_RegisterAutomatedPunishment]
        @Account    VARCHAR(128),    --This is "strUserID"
        @Type          TINYINT,
        @Executor    VARCHAR(128),
        @Guide        VARCHAR(512),
        @Description    VARCHAR(1024),
        @BlockTimeElapse    INT
    AS
        ------------------------------------------------------------------------------------
        -- novice with deepdark
        -- depend only on db time.. we dont have to sync the time between DB and GlobalManager for accuracy
        DECLARE @BlockStartTime    VARCHAR(128)
        DECLARE @BlockEndTime    VARCHAR(128)
    
        SET @BlockStartTime     = getdate()
        SET @BlockEndTime    = dateadd( mi, @BlockTimeElapse, @BlockStartTime)
        ------------------------------------------------------------------------------------
    
        DECLARE @UserJID INT
        SET @UserJID = 0
    
        -- Get UserJID from provided @Account.
        SELECT @UserJID = JID FROM TB_User WITH (NOLOCK) WHERE strUserID = @Account
        IF @@ERROR <> 0 OR @UserJID = 0
        BEGIN
            SELECT -1
            RETURN
        END
        
        DECLARE    @return_value int
        -- Check if user is blocked before and execute proper SP.  ---- Query fixed by Wismo
        IF( EXISTS ( SELECT UserJID FROM _BlockedUser WITH (NOLOCK) WHERE UserJID = @UserJID AND Type = @Type and timeEnd < getdate()))
        BEGIN
            DECLARE @SerialNo INT
            SET @SerialNo = 0
            SELECT @SerialNo = SerialNo FROM _Punishment WITH (NOLOCK) WHERE UserJID = @UserJID
            EXEC    @return_value = [dbo].[_UpdatePunishment] @SerialNo, @UserJID, @Type, @Executor,0, '', '', '', @Guide, @Description, @BlockStartTime, @BlockStartTime, @BlockEndTime, @BlockStartTime
        END
        
        ELSE 
        BEGIN
            EXEC    @return_value = [dbo].[_RegisterPunishment] @UserJID, @Type, @Executor,0, '', '', '', @Guide, @Description, @BlockStartTime, @BlockStartTime, @BlockEndTime, @BlockStartTime
        END
    
    
        SELECT @UserJID
    Thank you,
    Wismo (DuckRoad - This is madness!)


  2. #2
    Valued Member SuperHer0 is offline
    MemberRank
    Nov 2011 Join Date
    128Posts

    Re: [FIX] [_RegisterAutomatedPunishment]

    Ty Very Good

  3. #3
    beq $v0, $0, 0x80000000 megaman963 is offline
    MemberRank
    Sep 2011 Join Date
    r3000 - MIPSLocation
    198Posts

    Re: [FIX] [_RegisterAutomatedPunishment]

    Thanks for sharing :)



Advertisement