Jump to content
  • 0

Requesting this Kind of GM Utility Script


Yonko

Question


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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!

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

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` "+
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  15
  • Reputation:   0
  • Joined:  10/06/12
  • Last Seen:  

Here. You could always use #storeall "namehere" you know. :3

http://pastebin.com/240Lgpdz

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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

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:  

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;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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 :(

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

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 by Skorm
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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

 

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:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  166
  • Topics Per Day:  0.04
  • Content Count:  789
  • Reputation:   50
  • Joined:  04/16/12
  • Last Seen:  

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 :)

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