Stored Procedure: _OnCharRevive
Parameters:
@CharID INT- Character ID@CharName16 VARCHAR(64)- Character name@WorldID SMALLINT- Game world ID@RegionID SMALLINT- Region ID
Let us send a text notification to the character using the _Char_SendTextNotification command and block the character from reviving outside Jangan South Gate to make sure that the trigger works correctly.
USE [vPlus]
GO
/****** Object: StoredProcedure [dbo].[_OnCharRevive] Script Date: 1/9/2024 7:03:25 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author: Muhab>
-- Create date: <Create Date: 2021-08-08>
-- Description: <Description: >
-- =============================================
ALTER PROCEDURE [dbo].[_OnCharRevive]
@CharID INT,
@CharName16 VARCHAR(64),
@WorldID SMALLINT,
@RegionID SMALLINT
AS
BEGIN
SET NOCOUNT ON;
/*
You can disallow players from reviving for your own reasons through this procedure.
You will have to send your own notification in case of failure.
If you want to add a cooldown for reviving after death, it is preferred to use the ReviveDelay column
in the vPlus.._RefRegion table.
Notification example:
EXEC _AddNotificationByCharID @CharID, 'You are not allowed to revive at the moment.', 0, 1;
RETURN 1; -- Allows the player to revive.
RETURN 0; -- Disallows the player from reviving.
*/
--------- Your code starts here --------
-- Checking if the player is reviving outside Jangan South Gate
IF (@WorldID = 1 AND @RegionID = 24744)
BEGIN
EXEC _Char_SendTextNotification @CharID, 'You are not allowed to revive your character in the current area!', 1, 0, 0
RETURN 0;
END
RETURN 1;
END