Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Share Posted April 11, 2013 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. Quote Link to comment Share on other sites More sharing options...
0 ittiphol Posted June 8, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 115 Reputation: 7 Joined: 05/09/19 Last Seen: May 20, 2021 Share Posted June 8, 2019 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 Quote Link to comment Share on other sites More sharing options...
0 Capuche Posted June 8, 2019 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted June 8, 2019 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. Maybe the query of this script need to be updated depending of your server but it will be your homework. Quote Link to comment Share on other sites More sharing options...
0 ittiphol Posted June 8, 2019 Group: Members Topic Count: 27 Topics Per Day: 0.01 Content Count: 115 Reputation: 7 Joined: 05/09/19 Last Seen: May 20, 2021 Share Posted June 8, 2019 5 hours ago, Capuche said: 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? Quote Link to comment Share on other sites More sharing options...
Patskie Posted April 11, 2013 Group: Members Topic Count: 50 Topics Per Day: 0.01 Content Count: 1702 Reputation: 241 Joined: 09/05/12 Last Seen: 26 minutes ago Share Posted April 11, 2013 What item will you insert on the storage? Quote Link to comment Share on other sites More sharing options...
Boom Posted April 11, 2013 Group: Members Topic Count: 21 Topics Per Day: 0.00 Content Count: 182 Reputation: 22 Joined: 12/30/12 Last Seen: February 20, 2017 Share Posted April 11, 2013 (edited) It'll be more easier to have the items "INSERTED" on every account's storage by making a database-side query 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! Edited April 11, 2013 by paopao Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 11, 2013 (edited) I want to send an item with zero weight for the storage of all registered accounts at once that the id is 32002paopao, 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 April 11, 2013 by cumbe11 Quote Link to comment Share on other sites More sharing options...
Boom Posted April 11, 2013 Group: Members Topic Count: 21 Topics Per Day: 0.00 Content Count: 182 Reputation: 22 Joined: 12/30/12 Last Seen: February 20, 2017 Share Posted April 11, 2013 (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. 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 April 11, 2013 by paopao Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 11, 2013 (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 April 11, 2013 by cumbe11 Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 11, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 11, 2013 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; } 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 11, 2013 (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 April 11, 2013 by cumbe11 Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 11, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 11, 2013 You want to give an item to all online players directly in their inventory ? 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 11, 2013 That, plus not just on the players online but to all registered accounts in inventory if possible Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 11, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 11, 2013 You want to give one item by account or one by character ? 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 11, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 11, 2013 per account. in that case would be the same storage. Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 12, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 12, 2013 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. 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 12, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 12, 2013 The NPC appears to click on it nothing happens. Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 12, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 12, 2013 Previous post edit for eA 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 13, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 13, 2013 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. Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 13, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 13, 2013 Haha! yeah I forgot to increment the loop when I modified the script for eA. I edited the script in the post above 1 Quote Link to comment Share on other sites More sharing options...
Scofield Posted April 13, 2013 Group: Members Topic Count: 109 Topics Per Day: 0.02 Content Count: 272 Reputation: 16 Joined: 01/11/13 Last Seen: Thursday at 07:33 PM Author Share Posted April 13, 2013 It worked thank you. Quote Link to comment Share on other sites More sharing options...
Rage Guy Posted April 18, 2013 Group: Members Topic Count: 113 Topics Per Day: 0.03 Content Count: 354 Reputation: 3 Joined: 02/17/13 Last Seen: August 14, 2016 Share Posted April 18, 2013 i cant understand can u post it working pls Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 19, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 19, 2013 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 1 Quote Link to comment Share on other sites More sharing options...
Rage Guy Posted April 19, 2013 Group: Members Topic Count: 113 Topics Per Day: 0.03 Content Count: 354 Reputation: 3 Joined: 02/17/13 Last Seen: August 14, 2016 Share Posted April 19, 2013 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 Quote Link to comment Share on other sites More sharing options...
Capuche Posted April 19, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted April 19, 2013 Check your mapserv and tell me if you have an error. Do you use eA/rA ? Quote Link to comment Share on other sites More sharing options...
Rage Guy Posted April 19, 2013 Group: Members Topic Count: 113 Topics Per Day: 0.03 Content Count: 354 Reputation: 3 Joined: 02/17/13 Last Seen: August 14, 2016 Share Posted April 19, 2013 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? Quote Link to comment Share on other sites More sharing options...
Question
Scofield
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
27 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.