Released Account Kill Sharing

05/09/2015 21:45 Mark.Teal1982#1
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
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
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
10/18/2015 14:43 ShaiyaDeadlyBreath#2
Here is removed point per kill and share kills/deaths
DECLARE @OLDK1 and @OLDK2 .
07/23/2016 17:16 GMCronus#3
i think i actualy got it.

Quote:
USE [PS_GameData]
GO
/****** Object: Trigger [dbo].[PointsForKills] Script Date: 23.07.2016 16.59.42 ******/
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 and m.Level < '69')
END
end

+

Quote:
USE [PS_GameData]
GO
/****** Object: Trigger [dbo].[NewCharsAdded] Script Date: 23.07.2016 15.30.19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER 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 and level = '70'
SET NOCOUNT off
END

This actualy make all lvl 69+chars get the best kill you ahve on the account. BUT the characters under 69 does not get effected.

that's how i wanted it to work not to effect kills in 15 and 30 zone from 70+ pvp.. might be done easyer. but how i made it work for me.


DO NOT USE FOR EP5, i tested it on ep 6 and it was great. went and tried it on ep 5 and all dc after 25-30 min and it was a 20-25 min rollback so don'¨t use it....
04/14/2017 09:20 batymaty#4
everytime that you create a new toon, you get 5 dp too, but thanks anyway.
06/08/2017 13:14 [DEV]MasterMind#5
Msg 208, Level 16, State 6, Procedure KillShare, Line 5
Invalid object name 'dbo.PointsForKills'.

How can I fix that?
Sorry I am newbie in these things, you can also see my nickname contains [DEV] tag but this registration was made by a friend of mine. I do not want replies like "Aren't you DEV, as your nickname says?"

Thanks in advance.
06/08/2017 13:16 GMCronus#6
change ALTER trigger [dbo].[PointsForKills] to Create trigger [dbo].[PointsForKills] :-)