Register for your free account! | Forgot your password?

You last visited: Today at 15:07

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Auto PvP Rewards

Discussion on Auto PvP Rewards within the Shaiya Private Server forum part of the Shaiya category.

Reply
 
Old 09/23/2012, 08:28   #16
 
elite*gold: 50
Join Date: Sep 2011
Posts: 408
Received Thanks: 1,262
Okay, After a few dozens of trying.. Im lost again.. It should be working i dont get any error at all but it is not working >.< I added this to Read_Chars_Detail2 >.< but didnt work again.. Tried to make a new SP and it didnt work too.. I dont know whats the problem x_x
Code:
DECLARE @DP int
DECLARE @K1 int
DECLARE @UserID varchar (12)

Select @K1=K1 From dbo.chars
If @K1 = 10000
Set @DP = 100000

BEGIN
UPDATE PS_UserData.dbo.Users_Master SET Point = Point + @DP WHERE UserID = @UserID
END
---
JuuF is offline  
Old 09/27/2012, 18:10   #17
 
elite*gold: 0
Join Date: Sep 2011
Posts: 21
Received Thanks: 47
Here is what I use

This trigger updates points based on kills ( K1 )

It fires when K1 is updated in the chars table. I do 5 pts for each kill.

Code:
USE [PS_GameData]
GO

/****** Object:  Trigger [dbo].[PointsForKills]    Script Date: 09/27/2012 11:57:00 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

                                                     
                                             

create trigger [dbo].[PointsForKills]
on [PS_GameData].[dbo].[Chars]
after update
as
IF (UPDATE (k1))
begin
declare @oldk1 int
declare @newk1 int
set @oldk1 = (select k1 from deleted)
set @newk1 = (select k1 from inserted)
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
	end
/*if I wanted to do 500 points per x000 kills I would do something like this

if (convert ( varchar (5),@newk1) like '%000')
	begin
	update PS_userdata.dbo.users_master
	set point=point+500 
	from PS_userdata.dbo.users_master m,inserted i where m.userUID=i.useruid
        end
This would give 500 points to every k1 value that is "like" 1000 or 2000 or 3000 etc, not just 1000 kills
*/
	end
end

GO
Pseudo code of what the trigger is doing:
1. Trigger waits for K1 to be updated
2. If k1 gets updated, go compare the old value ( deleted ) with the new value ( inserted ) that was just added.
3. If old value is less than new value, go update users_master points, where userid of chars table matches userid of Users_master ( this way you don't update everyone's points lol )

Appendix:
A. There is a "from" statement because we are comparing 2 tables and you have to reference both inside. There are many ways of doing this ( joins, full object names etc ) but this is how i did it.
B. /* this begins a comment block in SQL
C. */ this ends a comment block in SQL
D. Understand what you are doing before doing it
E. Added points take a little bit to show on the client side, but a relog is NOT necessary.
player1up is offline  
Thanks
13 Users
Old 09/29/2012, 15:07   #18
 
elite*gold: 50
Join Date: Sep 2011
Posts: 408
Received Thanks: 1,262
Thats really awesome Thank you for sharing this, i did it via quests, i made a quest repeatable and every 100 opposite faction gives 100 DP but it is kinda useless for big pvp cuz ppl will have to take quest again and again all the time T_T Thank you again, this helped me alot ^^
JuuF is offline  
Old 10/16/2012, 00:47   #19
 
Svinseladden's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
Quote:
Originally Posted by player1up View Post
This trigger updates points based on kills ( K1 )

It fires when K1 is updated in the chars table. I do 5 pts for each kill.

Code:
USE [PS_GameData]
GO

/****** Object:  Trigger [dbo].[PointsForKills]    Script Date: 09/27/2012 11:57:00 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

                                                     
                                             

create trigger [dbo].[PointsForKills]
on [PS_GameData].[dbo].[Chars]
after update
as
IF (UPDATE (k1))
begin
declare @oldk1 int
declare @newk1 int
set @oldk1 = (select k1 from deleted)
set @newk1 = (select k1 from inserted)
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
	end
/*if I wanted to do 500 points per x000 kills I would do something like this

if (convert ( varchar (5),@newk1) like '%000')
	begin
	update PS_userdata.dbo.users_master
	set point=point+500 
	from PS_userdata.dbo.users_master m,inserted i where m.userUID=i.useruid
        end
This would give 500 points to every k1 value that is "like" 1000 or 2000 or 3000 etc, not just 1000 kills
*/
	end
end

GO
Pseudo code of what the trigger is doing:
1. Trigger waits for K1 to be updated
2. If k1 gets updated, go compare the old value ( deleted ) with the new value ( inserted ) that was just added.
3. If old value is less than new value, go update users_master points, where userid of chars table matches userid of Users_master ( this way you don't update everyone's points lol )

Appendix:
A. There is a "from" statement because we are comparing 2 tables and you have to reference both inside. There are many ways of doing this ( joins, full object names etc ) but this is how i did it.
B. /* this begins a comment block in SQL
C. */ this ends a comment block in SQL
D. Understand what you are doing before doing it
E. Added points take a little bit to show on the client side, but a relog is NOT necessary.
this gives me and error at end it say's..

and i just del go and last end and it say's it works. but i'm not so sure.. first kill yes but on a server running alot of pvp is this realy working? becouse some get 10dp and it stops other have 50 kills and still no dp..
Svinseladden is offline  
Old 10/17/2012, 16:51   #20
 
zokylove's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 172
Received Thanks: 70
just delete the last end
there are 2 of them...
zokylove is offline  
Old 10/17/2012, 20:34   #21
 
Svinseladden's Avatar
 
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
thanks but made my own twist..

Svinseladden is offline  
Old 07/23/2014, 19:19   #22
 
admin_lewis's Avatar
 
elite*gold: 195
Join Date: Jul 2014
Posts: 63
Received Thanks: 88
thanks for releasing! I'm gonna use it!
admin_lewis is offline  
Reply


Similar Threads Similar Threads
gate waves end rewards+event rewards
09/15/2012 - DarkOrbit - 35 Replies
i give a list of all rewards of gate's end events. olsow the waves of the gate's to safe peaple some work . i'm not chure i post it in the right section. feel free to drag it to the right one. i hope this helped some peaple. greets. *kaat* 1. alpha gate: NPC waves 40 Streuners
Shaiya MultiBot v1.6#Auto potion,auto collection,auto stroke,auto skill
06/01/2012 - Shaiya Hacks, Bots, Cheats & Exploits - 12 Replies
http://d1205.hizliresim.com/x/5/5bjkl.jpg Hello everyone friends. I took off and I wanted to share the new version of Hilemizin. Other editions, a new difference: * Layout option 2.Skill. One trick from Image; http://c1205.hizliresim.com/x/4/59sgl.jpg Use the same fashion as yet. Slot {1} / Flat Beat Flat Beat Talent = 1 you put in the game. That it is the other options we.
[Exclusive]Conquer Online Auto Rewards v1.0 For Paypal
10/23/2010 - CO2 PServer Guides & Releases - 34 Replies
#removed someone else can make it. If you still want it, PM me. #request close



All times are GMT +2. The time now is 15:07.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.