Yonko Posted August 11, 2013 Posted August 11, 2013 Hi,Can i request a NPC which is GM only allowed to use, the function of NPC is to use @storeall on a designated account or characterexample:GM use the NPC, he input username & password of the player for authentication then next is to store all items of characters in storageThanks! Quote
Skorm Posted August 13, 2013 Posted August 13, 2013 prontera,150,150,0 script Storage 100,{ set .@npc$, "Storage"; if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql("SELECT DISTINCT `account_id`,`char_id`,`online` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@rid,.@cid,.@a); if ( .@rid && !.@a ) { mes .@npc$; mes "The character is currently offline."; mes "Re-routing storage..."; query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`) "+ "SELECT `nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time` "+ "FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "UPDATE `storage` "+ "SET `account_id` = "+.@rid+" "+ "WHERE `account_id` = 0"; query_sql "UPDATE `char` "+ "SET `weapon` = DEFAULT, "+ "`shield` = DEFAULT, "+ "`head_top` = DEFAULT, "+ "`head_mid` = DEFAULT, "+ "`head_bottom` = DEFAULT, "+ "`robe` = DEFAULT "+ "WHERE `char_id` = "+.@cid; query_sql "DELETE FROM `inventory` "+ "WHERE `char_id` = "+.@cid; mes "Items Stored!"; close; } else if( !.@rid ) { mes .@npc$; mes "That character doesn't seem to exist!"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } Alright I'm not sure what tables eAthena has and what they don't so remove the error tables that show up. From this... query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`) "+ "SELECT `nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time` "+ 1 Quote
BugMeNot Posted August 11, 2013 Posted August 11, 2013 Here. You could always use #storeall "namehere" you know. :3 http://pastebin.com/240Lgpdz Quote
Yonko Posted August 11, 2013 Author Posted August 11, 2013 Here. You could always use #storeall "namehere" you know. :3 http://pastebin.com/240Lgpdz Dude, thanks for the effort but how will this script trigger even the character is offline? thanks Quote
Patskie Posted August 11, 2013 Posted August 11, 2013 Try these one : prontera,150,150,0 script Storage 100,{ set .@npc$, strnpcinfo(1); if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@aid; if ( .@aid == 0 ) { mes .@npc$; mes "The character do not exist."; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } Quote
Yonko Posted August 12, 2013 Author Posted August 12, 2013 Thanks imma try it Try these one : prontera,150,150,0 script Storage 100,{ set .@npc$, strnpcinfo(1); if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql "SELECT `account_id` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@aid; if ( .@aid == 0 || !isloggedin(.@aid) ) { mes .@npc$; mes "Either the character do not exist or is offline"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } sir not working Quote
Skorm Posted August 12, 2013 Posted August 12, 2013 (edited) I cannot see anything wrong with his script other than maybe a few incompatibilities with eAthena. What emulator are you using? Maybe you haven't replaced the spaces with tabs? If you want something that can store offline character inventories. You can try this but I have to warn you it's completely untested... I don't have time to do so right now but I will later when I get back. prontera,150,150,0 script Storage 100,{ set .@npc$, "Storage"; if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql("SELECT DISTINCT `account_id`,`char_id`,`online` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@rid,.@cid,.@a); if ( .@rid && !.@a ) { mes .@npc$; mes "The character is currently offline."; mes "Re-routing storage..."; query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "SELECT (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "DELETE FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "UPDATE `storage` "+ "SET `account_id` = "+.@rid+" "+ "WHERE `account_id` = 0"; mes "Items Stored!"; close; } else if( !.@rid ) { mes .@npc$; mes "That character doesn't seem to exist!"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } Edited August 12, 2013 by Skorm Quote
Yonko Posted August 12, 2013 Author Posted August 12, 2013 I cannot see anything wrong with his script other than maybe a few incompatibilities with eAthena. What emulator are you using? Maybe you haven't replaced the spaces with tabs? If you want something that can store offline character inventories. You can try this but I have to warn you it's completely untested... I don't have time to do so right now but I will later when I get back. prontera,150,150,0 script Storage 100,{ set .@npc$, "Storage"; if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql("SELECT DISTINCT `account_id`,`char_id`,`online` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@rid,.@cid,.@a); if ( .@rid && !.@a ) { mes .@npc$; mes "The character is currently offline."; mes "Re-routing storage..."; query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "SELECT (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "DELETE FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "UPDATE `storage` "+ "SET `account_id` = "+.@rid+" "+ "WHERE `account_id` = 0"; mes "Items Stored!"; close; } else if( !.@rid ) { mes .@npc$; mes "That character doesn't seem to exist!"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } okay thanks, btw i'm using eA, the script of patskie seems not working i try to store all items of an offline account seems the NPC ticks out that the player is offline like the post#2 I cannot see anything wrong with his script other than maybe a few incompatibilities with eAthena. What emulator are you using? Maybe you haven't replaced the spaces with tabs? If you want something that can store offline character inventories. You can try this but I have to warn you it's completely untested... I don't have time to do so right now but I will later when I get back. prontera,150,150,0 script Storage 100,{ set .@npc$, "Storage"; if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql("SELECT DISTINCT `account_id`,`char_id`,`online` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@rid,.@cid,.@a); if ( .@rid && !.@a ) { mes .@npc$; mes "The character is currently offline."; mes "Re-routing storage..."; query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "SELECT (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`,`unique_id`) "+ "FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "DELETE FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "UPDATE `storage` "+ "SET `account_id` = "+.@rid+" "+ "WHERE `account_id` = 0"; mes "Items Stored!"; close; } else if( !.@rid ) { mes .@npc$; mes "That character doesn't seem to exist!"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } Okay sir it comes no error at map server console, the NPC appears and ask gives a textfield input so i putted a name of an offline character wearing Hat w/ card. so when i enter it works fine and exit conversation w/ npc then next is i looked up on the map server console so it comes out an sql error about unique_id column i think eA doesn't support that so i barely remove it from query_sql script then same problem again. here the pic of the console http://tinypic.com/view.php?pic=107j52g&s=5 then next i open up the character used to be trigger by the NPC seems the hat doesn't store on storage but weird if you lookin up at the character still wearing at it even though it doesn't exist in equipment or in storage refer to this picture http://tinypic.com/view.php?pic=2lj3i3o&s=5 Quote
Patskie Posted August 13, 2013 Posted August 13, 2013 Dude, thanks for the effort but how will this script trigger even the character is offline? thanks I misunderstood this one lol. Edited my previous post Quote
Yonko Posted August 13, 2013 Author Posted August 13, 2013 prontera,150,150,0 script Storage 100,{ set .@npc$, "Storage"; if ( !getgmlevel() ) end; mes .@npc$; mes "Input the name of the character"; next; input .@name$; query_sql("SELECT DISTINCT `account_id`,`char_id`,`online` FROM `char` WHERE `name` = '" +escape_sql(.@name$)+ "'",.@rid,.@cid,.@a); if ( .@rid && !.@a ) { mes .@npc$; mes "The character is currently offline."; mes "Re-routing storage..."; query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`) "+ "SELECT `nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time` "+ "FROM `inventory` "+ "WHERE `char_id` = "+.@cid; query_sql "UPDATE `storage` "+ "SET `account_id` = "+.@rid+" "+ "WHERE `account_id` = 0"; query_sql "UPDATE `char` "+ "SET `weapon` = DEFAULT, "+ "`shield` = DEFAULT, "+ "`head_top` = DEFAULT, "+ "`head_mid` = DEFAULT, "+ "`head_bottom` = DEFAULT, "+ "`robe` = DEFAULT "+ "WHERE `char_id` = "+.@cid; query_sql "DELETE FROM `inventory` "+ "WHERE `char_id` = "+.@cid; mes "Items Stored!"; close; } else if( !.@rid ) { mes .@npc$; mes "That character doesn't seem to exist!"; close; } charcommand "#storeall " + .@name$; mes .@npc$; mes "Done!"; close; } Alright I'm not sure what tables eAthena has and what they don't so remove the error tables that show up. From this... query_sql "INSERT INTO `storage` (`nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time`) "+ "SELECT `nameid`,`amount`,`equip`,`identify`,`refine`,`attribute`,`card0`,`card1`,`card2`,`card3`,`expire_time` "+ Thanks Works like a Charm! Kudos Quote
Question
Yonko
Hi,
Can i request a NPC which is GM only allowed to use, the function of NPC is to use @storeall on a designated account or character
example:
GM use the NPC, he input username & password of the player for authentication then next is to store all items of characters in storage
Thanks!
9 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.