figure I would release this from my last server being I no longer have a server up and running I basically learn how to do this off the dp per kill sql I found here when I started I didn't know anything about sql but started to learn it pretty quick and im sure there is a better way to do what I did but I new to sql so. but anyways here it is hope it works for you as it did for me on my 5.4 server.....
Part 1 of 2
USE [PS_GameData]
GO
/****** Object: Trigger [dbo].[PointsForKills] Script Date: 1/9/2015 12:12:32 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/* Built By [ADM]Alcatraz 2014 */
ALTER trigger [dbo].[PointsForKills]
on [PS_GameData].[dbo].[Chars]
after update
as
IF (UPDATE (k1))
begin
declare @oldk1 int
declare @newk1 int
declare @MaxK1 int
declare @NewUserUID INT
DECLARE @CharID INT
Declare @addkill int
set @oldk1 = (select k1 from deleted)
set @newk1 = (select k1 from inserted)
SET @CharID = (select CHARID from inserted) -- gets char id from new inserted row
set @newUserUID = (SELECT USERUID FROM PS_gameData.dbo.chars WHERE charID =@charID) -- sets newuserid as the id to look for
set @Maxk1 = (select MAX(k1) FROM dbo.chars where UserUID = @newUserUID) -- gets max kills from a account
set @Addkill = @newk1 - @oldk1
if @oldk1<@newk1
begin
update PS_userdata.dbo.users_master
set point=point+5
from PS_userdata.dbo.users_master m,inserted i where m.userUID=i.useruid
update PS_GAMEDATA.dbo.CHARS
set K1 = @MAXK1
from PS_GAMEDATA.dbo.CHARS M,inserted i where M.userUID=i.useruid
END
end
this part checks for the max kills on a account then adds those kills to all chars on that account and then adds the new kill to them it also adds dp per kill but I do not take any credit for it only the kill sharing
part 2 of 2
USE [PS_GameData]
GO
/* Built By [ADM]Alcatraz 2014 */
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create trigger [dbo].[NewCharsAdded] on [PS_GameData].[dbo].[_CreatedChars]
after INSERT
as
begin
SET NOCOUNT ON
declare
@oldk1 int,
@newk1 int,
@UserUID INT,
@newUserUID INT,
@CharID INT
set @UserUID = (select UserUID from inserted) -- gets useruid from inserted row
SET @CharID = (select CHARID from inserted) -- gets char id from new inserted row
set @newUserUID = (SELECT USERUID FROM PS_gameData.dbo.chars WHERE charID =@charID) -- sets newuserid as the id to look for
set @OLDK1 = (SELECT k1 FROM PS_gameData.dbo.chars WHERE CHARID =@CharID) -- sets @oldk1 as the new chars k1
set @NEWk1 = (select MAX(k1) FROM dbo.chars where UserUID = @newUserUID) -- gets max kills from a account
update PS_GAMEDATA.dbo.CHARS
set K1 = @newk1
from PS_GAMEDATA.dbo.CHARS where @CHARID = CharID
SET NOCOUNT off
END
this part finds the char with the most kills on it and adds it to any newly created chars so that all new chars start with the max kills of their account
please note: if your adding this to a server that is already up and running with people how have kills already that the kills will not be shown on the accounts until after a char on the account has made 1 kill after that all chars on that account will have the same max kills as the char with the most kills on it