Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

cabal_tool_giveitemtoall stored procedure

The Dinosaur
Loyal Member
Joined
Jun 29, 2008
Messages
5,028
Reaction score
999
Here is a nice little snippet which i think a few people will find useful. Extra credits Lost-Spirit for testing and for the original idea.

Note: the stored procedure works on accounts, not characters so giving by nation isn't possible before anybody asks. I may do an alternate version for that at some point unless somebody else fancies doing it.

readme.txt said:
Installation:

Run the query on the gamedb database to add the new SP.


Usage:

SQL-> EXEC gamedb.dbo.cabal_tool_giveitemtoall @itemidx, @itemopt, @durationidx, @onlineonly

@onlineonly = 1 -- 0 = all accounts, 1 = online only


Example:

SQL-> EXEC gamedb.dbo.cabal_tool_giveitemtoall 1, 0, 31, 1

Gives a permanent Upgrade Core(High) to online players only.


Download ->
 
Newbie Spellweaver
Joined
Oct 22, 2009
Messages
14
Reaction score
0
Nice release chumpy.. Thanks in advance..

thanks
can u explain wat mean of the number - cause i try to send alot of item in one times - and other item ( not uch )


31 : duration

Here's explanation from chumpy :
SQL-> EXEC gamedb.dbo.cabal_tool_giveitemtoall @itemidx, @itemopt, @durationidx, @onlineonly

@onlineonly = 1 -- 0 = all accounts, 1 = online only

SQL-> EXEC gamedb.dbo.cabal_tool_giveitemtoall 1, 0, 31, 1

1 - itemidx, eg: if you want give Mithril blade so put 70

0 - itemopt

31 - durationidx, eg: 31=permenant, 13=14days and 15=30days
(for more information check at product.scp)

1 - online only, if you want give that item to player online only so put 1 then put
1 -- 0 for all account.
 
Last edited:
The Dinosaur
Loyal Member
Joined
Jun 29, 2008
Messages
5,028
Reaction score
999
Call the stored procedure several times. It can't handle multiple items at once and allowing it to do so would have made the SP much more complex and also the usage much more complex.

The ability to send "packs" of items is one of the reasons i have posted the SP because i want to use it with gm tools.
 
Newbie Spellweaver
Joined
Oct 21, 2013
Messages
9
Reaction score
0
can anyone teach me on how to add this SP in my database?
it gives me an error when i do this: EXEC gamedb.dbo.cabal_tool_giveitemtoall 1, 0, 31, 1

here's the error:
Msg 911, Level 16, State 4, Line 1Database 'gamedb' does not exist. Make sure that the name is entered correctly.


Please help me in here.
 
Junior Spellweaver
Joined
Dec 9, 2013
Messages
124
Reaction score
0
i cant make it working? someone can help me. error is gamedb i tried changing it to server01 still no luck.
 
Newbie Spellweaver
Joined
Oct 18, 2008
Messages
79
Reaction score
3
What's the error code? It works fine for me.
 
Junior Spellweaver
Joined
Sep 29, 2013
Messages
169
Reaction score
31
i cant make it working? someone can help me. error is gamedb i tried changing it to server01 still no luck.
create procedure first to be able to make it work
/****** Object: StoredProcedure [dbo].[cabal_tool_giveitemtoall] Script Date: 02/08/2010 19:32:28 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- Author: mrmagoo (Chumpy)
-- Purpose: Give an item to all accounts, or all online accounts only

CREATE PROCEDURE [dbo].[cabal_tool_giveitemtoall]
(
@itemidx int,
@itemopt int,
@durationidx int,
@onlineonly int = 1 -- 0 = all accounts, 1 = online only
)
AS
begin
DECLARE @UserNum int, @IsOnline int, @ServerIdx int
SET @serveridx=Server01.dbo.GetServerIdx()
DECLARE CURSOR_ACCOUNTS CURSOR FOR
SELECT UserNum,[Login]
FROM account.dbo.cabal_auth_table

OPEN CURSOR_ACCOUNTS
FETCH NEXT FROM CURSOR_ACCOUNTS
INTO @UserNum,@IsOnline
WHILE @@FETCH_STATUS = 0
BEGIN
IF (@onlineonly = 1)
BEGIN
IF (@IsOnline = 1)
INSERT INTO cabalcash.dbo.MyCashItem( UserNum, TranNo, ServerIdx, ItemKindIdx, ItemOpt, DurationIdx )
VALUES (@UserNum, '1', @serveridx,@itemidx,@itemopt,@durationidx )
END
ELSE
INSERT INTO cabalcash.dbo.MyCashItem( UserNum, TranNo, ServerIdx, ItemKindIdx, ItemOpt, DurationIdx )
VALUES (@UserNum, '1', @serveridx,@itemidx,@itemopt,@durationidx )
FETCH NEXT FROM CURSOR_ACCOUNTS
INTO @UserNum,@IsOnline
END
CLOSE CURSOR_ACCOUNTS
DEALLOCATE CURSOR_ACCOUNTS

END
change gamedb.dbo to Server01.dbo, btw, i've changed it already so you only to copy and execute it, have fun ^^
 
Last edited:
Back
Top