Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 28.08.2005, 11:45   #1
noypi
Архивный участник
 
Join Date: Jun 2005
Posts: 104
Default How to set Adena of 1 account

Hi I need help on SQL, what i would like to do is to set all players chars adena to 0 even their warehouse and leave one char of player a 5million adena for example.

Anyone have this script? Tnx in advance.
noypi is offline  
Old 28.08.2005, 12:09   #2
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

This will set the adena amount (assuming your adena item id is 57 in itemdata.txt) to 0 in all chars in the account named 'useraccount' both inventory and warehouse

Be more specific on what you'd like to do with the 5mil you are saing...

Code:
UPDATE user_item SET amount = 0 WHERE user_item.char_id = user_data.char_id AND user_item.item_type =57 AND user_data.account_name='useraccount'
MoSs is offline  
Old 28.08.2005, 13:35   #3
noypi
Архивный участник
 
Join Date: Jun 2005
Posts: 104
Default

wow tnx for fast reply... sorry for not being specific... what i would like to do is set all adena amount to zero of all plyers Chars. Not only for specific players but all players and there chars.

After reseting it to zero give one Char of each player a 5Million Adena.

5Million Adena is just a example amount.

Again Tnx in Advance.
noypi is offline  
Old 28.08.2005, 15:30   #4
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

Ok since I wanted to find out also for my self how to do something like that I searched and studied a little about MSSQL Queries
And I actually wrote a script that does this!

First of all you run this:
Code:
 UPDATE user_item SET amount = 0 WHERE user_item.char_id = user_data.char_id AND user_item.item_type =57
To set to 0 all adena from ALL players (including builders :P)

Then you run this rather sofisticated :P SQL Query that does exactly what you need!
Finds the first character from ALL accounts and gives 5mil adena to it!
Only 1 character per account, the first one!
Code:
DECLARE @count int; 
DECLARE @last int;
DECLARE @total int;
SET @total = (SELECT COUNT(DISTINCT account_name) AS ccount FROM user_data)
SET @count = 0;
SET @last = 0; 
WHILE  @total > @count
BEGIN
	SET @last = (SELECT TOP 1 account_id FROM user_data WHERE account_id > @last);
	DECLARE @charid int;
	SET @charid = (SELECT TOP 1 char_id FROM user_data WHERE account_id = @last) ;
	UPDATE user_item SET amount=5000000 WHERE char_id=@charid AND item_type=57 AND warehouse = 0;
	SET @count = @count + 1; 
END
Of course you realise that you should execute this ONLY when the server is OFFLINE!

HAVE FUN!!

EDIT: Did a small correction, added warehouse = 0 as a safety cause you dont want to set 5mil both to users inventory and warehouse (thats 10mil total)
MoSs is offline  
Old 28.08.2005, 16:00   #5
noypi
Архивный участник
 
Join Date: Jun 2005
Posts: 104
Default

Wow MoSs cool tnx...

One more question thus warehouse adena is set to 0?
noypi is offline  
Old 28.08.2005, 16:10   #6
MoSs
Архивный участник
 
Join Date: Jul 2005
Posts: 108
Default

Yes the first query sets all adena to 0 warehouse and inventory, the second adds 5mil to the inventory only
MoSs is offline  
Old 28.08.2005, 17:12   #7
noypi
Архивный участник
 
Join Date: Jun 2005
Posts: 104
Default

user_data is in l2world right?
noypi is offline  
Old 29.08.2005, 01:39   #8
noypi
Архивный участник
 
Join Date: Jun 2005
Posts: 104
Default

MoSs I forgot to ask if also clan warehouse will also be affected? if not can u tell me pls?

tnx in advance.
noypi is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 22:40.