|
You last visited: Today at 16:26
Advertisement
Send an item to all players!
Discussion on Send an item to all players! within the Dekaron Private Server forum part of the Dekaron category.
12/17/2012, 19:02
|
#1
|
elite*gold: 0
Join Date: Sep 2008
Posts: 231
Received Thanks: 151
|
Send an item to all players!
Send an item through the mail to all players on your server.
Run this first to create the Stored Procedure:
Code:
USE [character]
GO
/****** Object: StoredProcedure [dbo].[SP_POST_EVENTITEM_BULK] Script Date: 12/17/2012 12:04:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_POST_EVENTITEM_BULK]
@i_wIndex INT,
@i_sFrom varchar(40),
@i_sSubject varchar(50),
@i_sBody varchar(500),
@o_sp_rtn INT OUTPUT
AS
DECLARE @v_post_no varchar(18)
DECLARE @v_state_tag tinyint
DECLARE @v_byHeader smallint
DECLARE @v_wIndex INT
DECLARE @v_dwSerialNumber binary(16)
DECLARE @v_expire_day int
DECLARE @v_character_no varchar(20)
DECLARE @v_info varbinary(25)
DECLARE @v_item_tag tinyint
DECLARE @v_dil_tag tinyint
DECLARE @v_include_dil BIGINT
DECLARE @v_from_char_nm VARCHAR(40)
DECLARE @v_post_sort TINYINT
DECLARE @v_post_title VARCHAR(50)
DECLARE @v_body_text VARCHAR(500)
DECLARE @v_event_no INT
DECLARE @v_tab_nm varchar(20)
DECLARE @v_m_date varchar(6)
DECLARE @v_spid varchar(4)
DECLARE @v_regdate varchar(8)
DECLARE @v_seq_no int
--// SerialNumber Info
DECLARE @i_wLinear int
DECLARE @i_dwRandom int
DECLARE @v_curr_time datetime
DECLARE @v_expire_time datetime
BEGIN
SELECT @v_dil_tag = 0
SELECT @v_include_dil = 0
SELECT @v_curr_time = GetDate()
SELECT @v_expire_day = 30
SELECT @v_expire_time = @v_curr_time + @v_expire_day
SELECT @v_state_tag = 0
SELECT @v_byHeader = 0
SELECT @v_info = 0x
SELECT @v_item_tag = 1
SELECT @v_from_char_nm = @i_sFrom
SELECT @v_post_title = @i_sSubject
SELECT @v_body_text = @i_sBody
SELECT @v_post_sort = 7
SELECT @o_sp_rtn = 0
SELECT @v_dwSerialNumber = 0x00000000000000000000000000000000
SELECT @v_spid = CAST(dbo.FN_GetAutoNo(@@spid,4) as varchar(4))
SELECT @v_m_date = SUBSTRING(CONVERT(varchar(10),GetDate(),112),3,6)
SELECT @v_tab_nm = 'USER_POSTBOX'
SELECT @v_regdate = SUBSTRING(CONVERT(varchar(10),GetDate(),112),1,6)+'01'
DECLARE cur_event_user CURSOR FAST_FORWARD
FOR
SELECT character_no
from character.dbo.user_character
OPEN cur_event_user
FETCH NEXT FROM cur_event_user INTO @v_character_no
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_com_seqno @v_tab_nm, @v_regdate, @v_seq_no OUTPUT
IF @v_seq_no < 1
BEGIN
SELECT @o_sp_rtn = -1
RETURN
END
SET @v_post_no = @v_m_date + dbo.FN_GetAutoNo(@v_seq_no,8) + @v_spid
BEGIN TRANSACTION
INSERT INTO USER_POSTBOX
(
character_no,
post_no,
from_char_nm,
post_sort,
post_title,
body_text,
state_tag,
item_tag,
byHeader,
wIndex,
dwSerialNumber,
info,
dil_tag,
include_dil,
ipt_time,
expire_time
)
VALUES
(
@v_character_no,
@v_post_no,
@v_from_char_nm,
@v_post_sort,
@v_post_title,
@v_body_text,
@v_state_tag,
@v_item_tag,
@v_byHeader,
@i_wIndex,
@v_dwSerialNumber,
@v_info,
@v_dil_tag,
@v_include_dil,
@v_curr_time,
@v_expire_time
)
IF @@ERROR <> 0 OR @@ROWCOUNT <> 1
-- USER_POSTBOX
BEGIN
ROLLBACK TRANSACTION
PRINT '우편함전송실패_쿠퍼 : ' + @v_character_no
SET @o_sp_rtn = -3
RETURN
END
COMMIT TRANSACTION
EXEC sp_com_seqno @v_tab_nm, @v_regdate, @v_seq_no OUTPUT
IF @v_seq_no < 1
BEGIN
SELECT @o_sp_rtn = -1
RETURN
END
SET @v_post_no = @v_m_date + dbo.FN_GetAutoNo(@v_seq_no,8) + @v_spid
BEGIN TRANSACTION
INSERT INTO USER_POSTBOX
(
character_no,
post_no,
from_char_nm,
post_sort,
post_title,
body_text,
state_tag,
item_tag,
byHeader,
wIndex,
dwSerialNumber,
info,
dil_tag,
include_dil,
ipt_time,
expire_time
)
VALUES
(
@v_character_no,
@v_post_no,
@v_from_char_nm,
@v_post_sort,
@v_post_title,
@v_body_text,
@v_state_tag,
@v_item_tag,
@v_byHeader,
@i_wIndex,
@v_dwSerialNumber,
@v_info,
@v_dil_tag,
@v_include_dil,
@v_curr_time,
@v_expire_time
)
IF @@ERROR <> 0 OR @@ROWCOUNT <> 1
-- USER_POSTBOX
BEGIN
ROLLBACK TRANSACTION
PRINT '우편함전송실패_실버 : ' + @v_character_no
SET @o_sp_rtn = -4
RETURN
END
COMMIT TRANSACTION
EXEC sp_com_seqno @v_tab_nm, @v_regdate, @v_seq_no OUTPUT
IF @v_seq_no < 1
BEGIN
SELECT @o_sp_rtn = -1
RETURN
END
SET @v_post_no = @v_m_date + dbo.FN_GetAutoNo(@v_seq_no,8) + @v_spid
BEGIN TRANSACTION
INSERT INTO USER_POSTBOX
(
character_no,
post_no,
from_char_nm,
post_sort,
post_title,
body_text,
state_tag,
item_tag,
byHeader,
wIndex,
dwSerialNumber,
info,
dil_tag,
include_dil,
ipt_time,
expire_time
)
VALUES
(
@v_character_no,
@v_post_no,
@v_from_char_nm,
@v_post_sort,
@v_post_title,
@v_body_text,
@v_state_tag,
@v_item_tag,
@v_byHeader,
@i_wIndex,
@v_dwSerialNumber,
@v_info,
@v_dil_tag,
@v_include_dil,
@v_curr_time,
@v_expire_time
)
IF @@ERROR <> 0 OR @@ROWCOUNT <> 1
-- USER_POSTBOX
BEGIN
ROLLBACK TRANSACTION
PRINT '우편함전송실패_골드 : ' + @v_character_no
SET @o_sp_rtn = -5
RETURN
END
COMMIT TRANSACTION
FETCH NEXT FROM cur_event_user INTO @v_character_no
END
CLOSE cur_event_user
DEALLOCATE cur_event_user
SET @o_sp_rtn = 0
RETURN
END
Then whenever you want to send out an item run the SP like so:
@parameters = ItemIndex, "FROM", "SUBJECT", "BODY", null
Code:
exec character.dbo.SP_POST_EVENTITEM_BULK 6001, "DEKARON", "GIFT", "ENJOY THIS GIFT!", null
*Note: This is fairly light on server resources, so don't worry about running it while your game is running. It will not lag the server.
|
|
|
12/18/2012, 17:26
|
#2
|
elite*gold: 0
Join Date: Oct 2011
Posts: 149
Received Thanks: 34
|
Great release man!, Altho i was gonna try making something just like that a couple of weeks ago, but i failed, now i really laugh at my self, i was so close i had a couple of errors making this, im glad you released this now, i corrected my errors, thanks bud!
|
|
|
12/18/2012, 20:34
|
#3
|
elite*gold: 0
Join Date: Sep 2008
Posts: 231
Received Thanks: 151
|
You're welcome. I'm glad you are able to use this.
|
|
|
01/28/2013, 17:33
|
#4
|
elite*gold: 0
Join Date: Mar 2008
Posts: 226
Received Thanks: 34
|
Evrey item I use with it to send, it's send it out 3 times, any idea why?
|
|
|
08/25/2014, 11:51
|
#5
|
elite*gold: 20
Join Date: Nov 2007
Posts: 2,854
Received Thanks: 1,891
|
UPDATE AND FIXED AND TESTED on mssql 2012
- Fixed: 3 times send
- Fixed: Translation
- Updated: For mssql 2012
- Added: Output with the nr of times send
Run as:
<item index>, "<from>", "<subject>", "<message>"
Example:
Code:
declare @P1 int
set @P1=NULL
exec character.dbo.SP_POST_EVENTITEM_BULK 6001, "DEKARON", "GIFT", "ENJOY THIS GIFT!", @P1 output
select @P1
The SP:
Code:
USE [character]
GO
/****** Object: StoredProcedure [dbo].[SP_POST_EVENTITEM_BULK] Script Date: 25/08/2014 11:49:35 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_POST_EVENTITEM_BULK]
@i_wIndex INT,
@i_sFrom varchar(40),
@i_sSubject varchar(50),
@i_sBody varchar(500),
@o_sp_rtn INT OUTPUT
AS
DECLARE @v_post_no varchar(18)
DECLARE @v_state_tag tinyint
DECLARE @v_byHeader smallint
DECLARE @v_wIndex INT
DECLARE @v_dwSerialNumber binary(16)
DECLARE @v_expire_day int
DECLARE @v_character_no varchar(20)
DECLARE @v_info varbinary(25)
DECLARE @v_item_tag tinyint
DECLARE @v_dil_tag tinyint
DECLARE @v_include_dil BIGINT
DECLARE @v_from_char_nm VARCHAR(40)
DECLARE @v_post_sort TINYINT
DECLARE @v_post_title VARCHAR(50)
DECLARE @v_body_text VARCHAR(500)
DECLARE @v_event_no INT
DECLARE @v_tab_nm varchar(20)
DECLARE @v_m_date varchar(6)
DECLARE @v_spid varchar(4)
DECLARE @v_regdate varchar(8)
DECLARE @v_seq_no int
DECLARE @i_totalCount int
--// SerialNumber Info
DECLARE @i_wLinear int
DECLARE @i_dwRandom int
DECLARE @v_curr_time datetime
DECLARE @v_expire_time datetime
BEGIN
SELECT @v_dil_tag = 0
SELECT @v_include_dil = 0
SELECT @v_curr_time = GetDate()
SELECT @v_expire_day = 30
SELECT @v_expire_time = @v_curr_time + @v_expire_day
SELECT @v_state_tag = 0
SELECT @v_byHeader = 0
SELECT @v_info = 0x
SELECT @v_item_tag = 1
SELECT @v_from_char_nm = @i_sFrom
SELECT @v_post_title = @i_sSubject
SELECT @v_body_text = @i_sBody
SELECT @v_post_sort = 7
SELECT @i_totalCount = 0
SELECT @o_sp_rtn = 0
SELECT @v_dwSerialNumber = 0x00000000000000000000000000000000
SELECT @v_spid = CAST(dbo.FN_GetAutoNo(@@spid,4) as varchar(4))
SELECT @v_m_date = SUBSTRING(CONVERT(varchar(10),GetDate(),112),3,6)
SELECT @v_tab_nm = 'USER_POSTBOX'
SELECT @v_regdate = SUBSTRING(CONVERT(varchar(10),GetDate(),112),1,6)+'01'
DECLARE cur_event_user CURSOR FAST_FORWARD
FOR
SELECT character_no
from character.dbo.user_character
OPEN cur_event_user
FETCH NEXT FROM cur_event_user INTO @v_character_no
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC sp_com_seqno @v_tab_nm, @v_regdate, @v_seq_no OUTPUT
IF @v_seq_no < 1
BEGIN
SELECT @o_sp_rtn = -1
RETURN
END
SET @v_post_no = @v_m_date + dbo.FN_GetAutoNo(@v_seq_no,8) + @v_spid
BEGIN TRANSACTION
INSERT INTO USER_POSTBOX
(
character_no,
post_no,
from_char_nm,
post_sort,
post_title,
body_text,
state_tag,
item_tag,
byHeader,
wIndex,
dwSerialNumber,
info,
dil_tag,
include_dil,
ipt_time,
expire_time
)
VALUES
(
@v_character_no,
@v_post_no,
@v_from_char_nm,
@v_post_sort,
@v_post_title,
@v_body_text,
@v_state_tag,
@v_item_tag,
@v_byHeader,
@i_wIndex,
@v_dwSerialNumber,
@v_info,
@v_dil_tag,
@v_include_dil,
@v_curr_time,
@v_expire_time
)
SET @i_totalCount = @i_totalCount + 1
IF @@ERROR <> 0 OR @@ROWCOUNT <> 1
-- USER_POSTBOX
BEGIN
ROLLBACK TRANSACTION
PRINT 'Mailbox transmission failure : ' + @v_character_no
SET @o_sp_rtn = -3
RETURN
END
COMMIT TRANSACTION
FETCH NEXT FROM cur_event_user INTO @v_character_no
END
CLOSE cur_event_user
DEALLOCATE cur_event_user
SET @o_sp_rtn = @i_totalCount
RETURN
END
GO
|
|
|
 |
Similar Threads
|
Jar item , send all people to another map
10/27/2011 - CO2 Private Server - 15 Replies
hello Elitepvpers members , i want to code npc to give a jar quest to kill a limited mount of monsters , i coded the npc but he gives the jar is reading monster type , pheeasent monsters , and count of killed monsters is always loading , i wanna know how to code it for any monster i want and count of monsters required to kill , and how to make check if the player finished the quest and has killed all required monsters or not .
and there another code i needed , is a code to send all players...
|
[Help] Item Send Script
06/24/2011 - Flyff Private Server - 4 Replies
Hallo Leute,
Ich hab ein kleines Problem mit einer HP, da in v15 die Prozedur dbo.usp_ProvideItem_Bill in der CHARACTER_01_DBF nicht geht.
Ich hab hier den Befehl in der PHP Datei
odbc_exec($connect, "EXEC CHARACTER_01_DBF.dbo.usp_ProvideItem_Bill '$idofchar', '$serverindex', '$tid', '$count'");
Die eigentlichen ODBC Funktionen gehen, wie z.B. den cash wert um 200 runter zu setzten.
|
[REQUEST]Send coins for few players at once
01/25/2011 - Dekaron Private Server - 7 Replies
Hi,
As title says need query or php script to send some amount of coins to some players only.
For example I want to send for player xxx and player yyy and player zzz 999 coins at once.
Or maybe it is possible to make a job to do that every 2 days for example.
So anyone can help me with that? pieter can you? I know you are MSSQL master :D
|
TO ALL GC US PLAYERS. SEND ME A BOT/HACK/TRAINER PLZ
11/30/2009 - Grand Chase - 2 Replies
i have the gg pass but i dont have a bot/hack/trainer. wen sent can u include include instructons plz?:)
|
[osds] problem send item & send weapon
11/12/2009 - Dekaron Private Server - 3 Replies
Hello i have 2 problems with osds control panel
when i try to send weapon i have no more weapon available i cant choice i have nothing but i can send armor succesfully and my second problem is send item when i try to send item the browser say Login Error, Please login again.anyone can be fix that please?
i post screenshots http://panzer.power-heberg.com/itembug.JPG
http://panzer.power-heberg.com/noweapon.JPG
|
All times are GMT +1. The time now is 16:29.
|
|