Cookies


Vsroplus only uses the cookies it needs to keep you signed in and remember your language. No ads, no tracking.

Got it

Need to learn more? Privacy policy

Our guides are in English for now.

Job Leave Request

By completing this guide, you should be able to trigger character job league leave requests to function and build your own custom systems.

Stored Procedure: _OnJobLeaveRequest
Parameters:

@CharID INT - Character ID
@CharName16 VARCHAR(64) - Character name
@JobType TINYINT - Job type

Let's block leaving the merchant job league for a specific character and send a text notification using _Char_SendTextNotification to ensure that the trigger works fine for us.

USE [vPlus]
GO

/****** Object: StoredProcedure [dbo].[_OnJobLeaveRequest] Script Date: 1/11/2024 2:51:37 AM ******/

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================

ALTER PROCEDURE [dbo].[_OnJobLeaveRequest]
    @CharID INT,
    @CharName16 VARCHAR(64),
    @JobType TINYINT
AS
BEGIN
    SET NOCOUNT ON;

    /*
        This procedure is executed when a player tries
        to leave their job league.

        You can cancel the request based on your own restrictions
        and send an error message to the player.
    */

    --------- Your code starts here --------

    -- Checking the character name and the job league ID
    IF (@JobType = 1 AND @CharName16 = 'character_name')
    BEGIN
        EXEC _Char_SendTextNotification @CharID, 'You cannot leave the merchant job league at the moment, come back later!', 1, 0, 0;

        RETURN 0; -- Block the leaving request
    END

    -- RETURN 0; -- Invalid
    RETURN 1; -- Valid
END

Last updated: 11 January, 2024

An error has occurred. This application may no longer respond until reloaded. Reload 🗙