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.

Life State Change

Stored Procedure: _OnLifeStateChanged

Parameters:

  • @CharID INT - Character ID
  • @State TINYINT - Character state

1 = Character state changed from dead to alive
2 = Character state changed from alive to dead

Let us send a text notification to the character using the _Char_SendTextNotification command to make sure that the trigger works correctly.

USE [vPlus]
GO
/****** Object:  StoredProcedure [dbo].[_OnLifeStateChanged]    Script Date: 1/9/2024 7:35:38 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:      <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_OnLifeStateChanged]
    @CharID INT,
    @State TINYINT
AS
BEGIN
    SET NOCOUNT ON;

    /*
        This procedure is called when the character life state changes.

        If @State = 1, the character became alive after death.
        This only happens through PvP resurrection or same-position resurrection.

        If @State = 2, the character died.
    */

    --------- Your code starts here --------
    -- Checking character state
    IF (@State = 1) -- Became alive
        EXEC _Char_SendTextNotification @CharID, 'Your character just became alive!', 1, 0, 0

    IF (@State = 2) -- Died
        EXEC _Char_SendTextNotification @CharID, 'Your character just died!', 1, 0, 0
END

Last updated: 9 January, 2024

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