Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 19:31.