Jump to content
  • 0

Add item in all accounts.


Question

Recommended Posts

  • 0
Posted
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

  • 0
Posted
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.

  • 0
Posted
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?

Posted (edited)

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
Posted (edited)

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
Posted (edited)

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
Posted (edited)

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
Posted


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
Posted (edited)

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
Posted
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
Posted

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.

Posted

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
Posted

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

Posted

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?

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...