Jump to content
  • 0

Add item in all accounts.


Scofield

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

I would like a npc or a way even if it is through phpAdmin adding an item in the storage of all accounts registered on my server all of a time.

Link to comment
Share on other sites

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.02
  • Content Count:  115
  • Reputation:   7
  • Joined:  05/09/19
  • Last Seen:  

On 4/13/2013 at 4:34 AM, Capuche said:

prontera,155,170,5	script	add storage	87,{
	if( getgmlevel() < 98 ) end;
	mes "You can add an item in all inventory.";
	mes "(ID reins: ^ff000012622^000000)";
	next;
	if( select( "Add an item ID", "Leave" ) -1 ) close;
	input .@item_id;
	if( getiteminfo( .@item_id,0 ) == -1 ) {
		mes "Unknown item id.";
		close;
	}
// online
	set .@item_name$, getitemname( .@item_id );
	set .@gm_name$, strcharinfo(0);
	do {
		set .@size, query_sql( "SELECT `account_id` from `char` where `online` = '1' order by `account_id` desc limit "+ ( .@loop *128 ) +", 128", .@account_id );
		for( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
			getitem .@item_id, 1, .@account_id[.@i];
			message rid2name( .@account_id[.@i] ), "You get an "+ .@item_name$ +" from "+ .@gm_name$ +".";
		}
		set .@loop, .@loop +1;
	}
	while( .@size );
// offline
	query_sql "INSERT INTO `global_reg_value` (`char_id`, `str`, `value`, `type`, `account_id`) select '0', '#item_inventory_gift', '"+ .@item_id +"', '2', `char`.`account_id` "+
			"from `char` where `char`.`online` = '0' on duplicate key update `global_reg_value`.`value` = '"+ .@item_id +"'";
	close;
OnPCLoginEvent:
	if( #item_inventory_gift ) {
		getitem #item_inventory_gift, 1;
		message strcharinfo(0), "You get an "+ getitemname( #item_inventory_gift ) +" from a gm.";
		set #item_inventory_gift, 0;
	}
	end;
}

 

Players online get an item in their inventory.

Others players get the item when they log in.

 

please make to sent item to all user offline too

this is only sent to user online 

 

thank you

Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

7 hours ago, ittiphol said:

this is only sent to user online 

 

On 4/12/2013 at 11:34 PM, Capuche said:

Others players get the item when they log in.

/hmm

 

Maybe the query of this script need to be updated depending of your server but it will be your homework.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.02
  • Content Count:  115
  • Reputation:   7
  • Joined:  05/09/19
  • Last Seen:  

5 hours ago, Capuche said:

 

/hmm

 

Maybe the query of this script need to be updated depending of your server but it will be your homework.

i try it's not work for me

just sent only user online

you can edit this script?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

What item will you insert on the storage?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  182
  • Reputation:   22
  • Joined:  12/30/12
  • Last Seen:  

It'll be more easier to have the items "INSERTED" on every account's storage by making a database-side query  /no1

 

Here's the query, for adding the Halter Lead (Item #12622) on all storages of players. the database name is 'ragnarok' for me.

 

 

INSERT INTO `ragnarok`.`storage` (`id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `expire_time`, `unique_id`) SELECT  NULL, `login`.`account_id`, '12622', '1', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0' FROM `ragnarok`.`login` WHERE `account_id` > 1;

 
Hope it helps!  /ok
Edited by paopao
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

I want to send an item with zero weight for the storage of all registered accounts at once that the id is 32002

paopao, that example you posted is an npc or command to execute in phpAdmin?

 

 

 

if it helps I have this script that checks the amount of existing equipment throughout the seridor, on all accounts, if you want a add an item in the storage of all accounts.

 

prontera,168,179,5    script    Registros ragnarok    757,{
mes "Enter the ID of the item which you want to know the amount on the server at the time.";
input .@item_id;
if( getitemname( .@item_id ) != "null" ){

    if( .@item_id ){
        for( set .@i,0; .@i < .sql_size; set .@i,.@i + 1 ){
            query_sql( "SELECT SUM(`amount`) FROM `"+.sql_table$[.@i]+"` WHERE `nameid`='"+.@item_id+"'",.@amount );
            query_sql( "SELECT COUNT(`card0`) FROM `"+.sql_table$[.@i]+"` WHERE `card0`='"+.@item_id+"'",.@card0 );
            query_sql( "SELECT COUNT(`card1`) FROM `"+.sql_table$[.@i]+"` WHERE `card1`='"+.@item_id+"'",.@card1 );
            query_sql( "SELECT COUNT(`card2`) FROM `"+.sql_table$[.@i]+"` WHERE `card2`='"+.@item_id+"'",.@card2 );
            query_sql( "SELECT COUNT(`card3`) FROM `"+.sql_table$[.@i]+"` WHERE `card3`='"+.@item_id+"'",.@card3 );
            set .@total,.@total + ( .@amount + .@card0 + .@card1 + .@card2 + .@card3 );
        }
            
        mes "Encontrado "+.@total+" x "+getitemname( .@item_id );
    }
}else{
    mes "Item ID invalid";
}
close;

OnInit:
setarray .sql_table$[0],"inventory","cart_inventory","guild_storage","storage","mail";
set .sql_size,getarraysize( .sql_table$ );
end;
}
Edited by cumbe11
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  182
  • Reputation:   22
  • Joined:  12/30/12
  • Last Seen:  

I want to send an item with zero weight for the storage of all registered accounts at once that the id is 32002

paopao, that example you posted is an npc or command to execute in phpAdmin?

 

Yes, the script I posted is the query which you can directly input on phpMyAdmin. That script can be modified with little changes (just for syntax) if it's going to be placed on an NPC script with the query_sql(); function.

 

For the zero weight of the item, it should be edited on the item_db.txt/item_db2.txt files.  /no1

 

ID,DBName,ScreenName,Type,Price,Sell,Weight,ATK,DEF,Range,Slot,Job,Upper,Gender,Loc,wLV,eLV,

Refineable,View,{Script},{OnEquip_Script},{OnUnequip_Script}

Edited by paopao
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

Would like to edit this script to check it instead of the quantity of an item on the server, he added an item in storage for everyone at once?

 

 

 

 

prontera,168,179,5    script    Registros ragnarok    757,{
mes "Enter the ID of the item which you want to know the amount on the server at the time.";
input .@item_id;
if( getitemname( .@item_id ) != "null" ){

    if( .@item_id ){
        for( set .@i,0; .@i < .sql_size; set .@i,.@i + 1 ){
            query_sql( "SELECT SUM(`amount`) FROM `"+.sql_table$[.@i]+"` WHERE `nameid`='"+.@item_id+"'",.@amount );
            query_sql( "SELECT COUNT(`card0`) FROM `"+.sql_table$[.@i]+"` WHERE `card0`='"+.@item_id+"'",.@card0 );
            query_sql( "SELECT COUNT(`card1`) FROM `"+.sql_table$[.@i]+"` WHERE `card1`='"+.@item_id+"'",.@card1 );
            query_sql( "SELECT COUNT(`card2`) FROM `"+.sql_table$[.@i]+"` WHERE `card2`='"+.@item_id+"'",.@card2 );
            query_sql( "SELECT COUNT(`card3`) FROM `"+.sql_table$[.@i]+"` WHERE `card3`='"+.@item_id+"'",.@card3 );
            set .@total,.@total + ( .@amount + .@card0 + .@card1 + .@card2 + .@card3 );
        }
            
        mes "Encontrado "+.@total+" x "+getitemname( .@item_id );
    }
}else{
    mes "Item ID invalid";
}
close;

OnInit:
setarray .sql_table$[0],"inventory","cart_inventory","guild_storage","storage","mail";
set .sql_size,getarraysize( .sql_table$ );
end;
}
Edited by cumbe11
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


prontera,155,170,5 script add storage 87,{

if( getgmlevel() < 98 ) end;

mes "You can add an item in all account storage.";

mes "Note: if one storage is full, the storage database will contain an extra line for this storage.";

mes "(ID reins: ^ff000012622^000000)";

next;

if( select( "Add an item ID", "Leave" ) -1 ) close;

input .@item_id;

if( getiteminfo( .@item_id,0 ) == -1 ) {

mes "Unknown item id.";

close;

}

query_sql "INSERT INTO `storage` (`id`, `account_id`, `nameid`, `amount`, `equip`, `identify`, `refine`, `attribute`, `card0`, `card1`, `card2`, `card3`, `expire_time`, `unique_id`) "+

"SELECT NULL, `login`.`account_id`, '"+ .@item_id +"', '1', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0' FROM `login` WHERE `account_id` > 1";

mes "Item add. Players must relog to see the item in storage.";

close;

}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

It did not work nothing appears in Storage and not in the inventory, if I want the same item appears in the inventory, I explained badly.

 

 

I want to send the item will stay on the tab etc.

Edited by cumbe11
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You want to give an item to all online players directly in their inventory ?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

That, plus not just on the players online but to all registered accounts in inventory if possible

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You want to give one item by account or one by character ?

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

per account. in that case would be the same storage.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

prontera,155,170,5	script	add storage	87,{
	if( getgmlevel() < 98 ) end;
	mes "You can add an item in all inventory.";
	mes "(ID reins: ^ff000012622^000000)";
	next;
	if( select( "Add an item ID", "Leave" ) -1 ) close;
	input .@item_id;
	if( getiteminfo( .@item_id,0 ) == -1 ) {
		mes "Unknown item id.";
		close;
	}
// online
	set .@item_name$, getitemname( .@item_id );
	set .@gm_name$, strcharinfo(0);
	do {
		set .@size, query_sql( "SELECT `account_id` from `char` where `online` = '1' order by `account_id` desc limit "+ ( .@loop *128 ) +", 128", .@account_id );
		for( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
			getitem .@item_id, 1, .@account_id[.@i];
			message rid2name( .@account_id[.@i] ), "You get an "+ .@item_name$ +" from "+ .@gm_name$ +".";
		}
		set .@loop, .@loop +1;
	}
	while( .@size );
// offline
	query_sql "INSERT INTO `global_reg_value` (`char_id`, `str`, `value`, `type`, `account_id`) select '0', '#item_inventory_gift', '"+ .@item_id +"', '2', `char`.`account_id` "+
			"from `char` where `char`.`online` = '0' on duplicate key update `global_reg_value`.`value` = '"+ .@item_id +"'";
	close;
OnPCLoginEvent:
	if( #item_inventory_gift ) {
		getitem #item_inventory_gift, 1;
		message strcharinfo(0), "You get an "+ getitemname( #item_inventory_gift ) +" from a gm.";
		set #item_inventory_gift, 0;
	}
	end;
}

 

Players online get an item in their inventory.

Others players get the item when they log in.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

The NPC appears to click on it nothing happens.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Previous post edit for eA

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

There are some minor errors, the script will be adding 146 items in each account instead of just one, and just who gets to be online, people who are off when logs get nothing.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Haha! yeah I forgot to increment the loop when I modified the script for eA. I edited the script in the post above

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

It worked thank you.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  354
  • Reputation:   3
  • Joined:  02/17/13
  • Last Seen:  

i cant understand can u post it working pls

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

i cant understand can u post it working pls

Check this post for the script

 

A GM can give an item for all players online and offline, offline players get the item once they log in

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  354
  • Reputation:   3
  • Joined:  02/17/13
  • Last Seen:  

Nothing Happens after writing the item ID



Check this post for the script


i cant understand can u post it working

 

A GM can give an item for all players online and offline, offline players get the item once they log in

 

Nothing Happens after writing the item ID

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Check your mapserv and tell me if you have an error.

 

Do you use eA/rA ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  113
  • Topics Per Day:  0.03
  • Content Count:  354
  • Reputation:   3
  • Joined:  02/17/13
  • Last Seen:  

am using something like mix between then o_o

for the STARTSERVER

Quz idk how to use the .sql



is there ready rATHENA

With STARTSERVER , logserv , map-server , char-serv

and that things?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...