By completing this guide, you should be able to trigger adding team kills to the counter and build your own custom systems.
Stored Procedure: _BattleLogTeam_AddKill
Parameters:
@GroupID INT - Group ID
@TeamType TINYINT - PvP team cape color type
@Name VARCHAR(129) - Column 1 name
@Points INT - Points
Let's add points to the selected team counter and send a global text notification using _Command_Global_SendTextNotification to ensure that the trigger works fine for us.
USE [vPlus]
GO
/****** Object: StoredProcedure [dbo].[_BattleLogTeam_AddKill] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[_BattleLogTeam_AddKill]
@GroupID INT,
@TeamType TINYINT,
@Name VARCHAR(129),
@Points INT
AS
BEGIN
SET NOCOUNT ON;
/*
This procedure is used to add points to a custom team counter.
If the team already exists in the counter data,
the points will be updated.
If the team does not exist yet, a new record
will be inserted.
*/
--------- Your code starts here --------
UPDATE _BattleLogTeamData
SET Points += @Points
WHERE GroupID = @GroupID
AND TeamType = @TeamType
AND Name = @Name;
IF (@@ROWCOUNT = 0)
BEGIN
INSERT INTO _BattleLogTeamData
(GroupID, TeamType, Name, Points)
VALUES
(@GroupID, @TeamType, @Name, @Points);
END
DECLARE @Message VARCHAR(255) = @Name + ' has earned ' + CAST(@Points AS VARCHAR(16)) + ' points';
EXEC _Command_Global_SendTextNotification @Message, 1, 0, 1;
END
The selected team will receive points in the custom team counter, and a global notification will be sent when the procedure is executed.