Jump to content
  • 0

check character if he has the item


xmaniacx

Question


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   1
  • Joined:  04/03/12
  • Last Seen:  

my players are suspecting me of giving gods item on the player.... can i request a script where if you enter the name of the player the npc would ask you to input the id then if you enter 2629 for megs it would tell you if this account has megs i mean it would say "I found ?? megs in "searched name"'s account......

Link to comment
Share on other sites

11 answers to this question

Recommended Posts


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

prontera,159,180,5	script	hjkl	456,{

	mes "Enter a name.";
	input .@n$;

	if ( query_sql("SELECT `account_id` FROM `char` WHERE `name` = '"+ escape_sql( .@n$ ) +"'", .@a_id ) ) {
		query_sql("SELECT `char_id`, `guild_id` FROM `char` WHERE `account_id` = '"+ .@a_id +"'", .@c_id, .@g_id );
		mes "Input an item ID.";
		input .@item;
		if( getitemname( .@item ) == "" ) {
			mes "wrong item ID";
			close;
		}
		for( .@i = 0; .@i < getarraysize( .@c_id ); .@i++ ) {
			query_sql( "SELECT SUM(`amount`) FROM `inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_inv );
			query_sql( "SELECT SUM(`amount`) FROM `cart_inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_cart );
			query_sql( "SELECT SUM(`amount`) FROM `guild_storage` WHERE `guild_id` = "+ .@g_id[.@i] +" AND `nameid` = "+ .@item, .@count_gsto );
			.@inv = .@inv + .@count_inv + .@count_cart;
			.@gsto = .@gsto + .@count_gsto;
		}
		query_sql( "SELECT SUM(`amount`) FROM `storage` WHERE `account_id` = "+ .@a_id +" AND `nameid` = "+ .@item, .@count_sto );
		.@inv = .@inv + .@count_sto;
	}
	else {
		mes "Character '"+.@n$+"' does not exist.";
		close;
	}
	mes "Character '"+.@n$+"' has ^0055FF"+ .@inv +"^000000 "+ getitemname( .@item ) +" ("+ .@item +") in his account (storage, inventory, cart inventory).",
		( !.@gsto ? "" : ( "And ^0055FF"+ .@gsto +"^000000 "+ getitemname( .@item ) +" in guild storage on all his character." ) );
	
	close;
}

Check item ID in inventory, cart inventory, storage and gstorage of all player in the account of the player's name you write

Can be improve ( my skills in SQL are 'NULL' lol)

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

prontera,150,150,5	script	Item Counter	101,{

mes "Enter a name.";

input .@n$;

set .@aid, getcharid(3,.@n$);

set .@cid, getcharid(0,.@n$);

if (isloggedin(.@aid,.@cid)) {

mes "Input an item ID.";

input .@item;

set .@self, getcharid(3);

attachrid(.@aid);

set .@count, countitem(.@item);

attachrid(.@self);

} else if (query_sql("SELECT `char_id` FROM `char` WHERE `name` = '"+.@n$+"'",.@cid)) {

mes "Input an item ID.";

input .@item;

query_sql("SELECT SUM(`amount`) FROM `inventory` WHERE `char_id` = "+.@cid+" AND `nameid` = "+.@item,.@count);

} else {

mes "Character '"+.@n$+"' does not exist.";

close;

}

mes "Character '"+.@n$+"' has ^0055FF"+.@count+"^000000 "+getitemname(.@item)+" ("+.@item+").";

close;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

prontera,150,150,5	script	Item Counter	101,{	mes "Enter a name.";	input .@n$;	set .@aid, getcharid(3,.@n$);	set .@cid, getcharid(0,.@n$);	if (isloggedin(.@aid,.@cid)) {		mes "Input an item ID.";		input .@item;		set .@self, getcharid(3);		attachrid(.@aid);		set .@count, countitem(.@item);		attachrid(.@self);	} else if (query_sql("SELECT `char_id` FROM `char` WHERE `name` = '"+.@n$+"'",.@cid)) {		mes "Input an item ID.";		input .@item;		query_sql("SELECT SUM(`amount`) FROM `inventory` WHERE `char_id` = "+.@cid+" AND `nameid` = "+.@item,.@count);	} else {		mes "Character '"+.@n$+"' does not exist.";		close;	}	mes "Character '"+.@n$+"' has ^0055FF"+.@count+"^000000 "+getitemname(.@item)+" ("+.@item+").";	close;}

does this script search all the "inventory","cart_inventory", & "storage" of all the character on the searched name's account?

Edited by caspa
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:  

This script search 1 item ID you want in the inventory of the player you want (online or offline)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  110
  • Reputation:   1
  • Joined:  04/03/12
  • Last Seen:  

This script search 1 item ID you want in the inventory of the player you want (online or offline)

Well i was hoping that for example

Account : 2000000

Accoun'ts Character List

"GM 1" has 21 TCG Card in Cart

"GM 2" has 2 TCG in Inventory

"GM 3"  no TCG

Has 1000 TCG Card In Storage

So if i click the NPC it tells me "enter the name of the person you wish to inspect."

input "GM 1"

then "Input the ID of the item you think this person might have."

input "7227(TCG Card)

After that NPC tells "

"GM 1's Account contains 1023 TCG Card." ( total tcg card of all the character on the searched account has. )

 

or if the account has no TCG, it says "GM1's Account contains 0 TCG Card."

something like this

Edited by xmaniacx
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

@bump for this topic...

Edited by caspa
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

prontera,159,180,5	script	hjkl	456,{

	mes "Enter a name.";
	input .@n$;

	if ( query_sql("SELECT `account_id` FROM `char` WHERE `name` = '"+ escape_sql( .@n$ ) +"'", .@a_id ) ) {
		query_sql("SELECT `char_id`, `guild_id` FROM `char` WHERE `account_id` = '"+ .@a_id +"'", .@c_id, .@g_id );
		mes "Input an item ID.";
		input .@item;
		if( getitemname( .@item ) == "" ) {
			mes "wrong item ID";
			close;
		}
		for( .@i = 0; .@i < getarraysize( .@c_id ); .@i++ ) {
			query_sql( "SELECT SUM(`amount`) FROM `inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_inv );
			query_sql( "SELECT SUM(`amount`) FROM `cart_inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_cart );
			query_sql( "SELECT SUM(`amount`) FROM `guild_storage` WHERE `guild_id` = "+ .@g_id[.@i] +" AND `nameid` = "+ .@item, .@count_gsto );
			.@inv = .@inv + .@count_inv + .@count_cart;
			.@gsto = .@gsto + .@count_gsto;
		}
		query_sql( "SELECT SUM(`amount`) FROM `storage` WHERE `account_id` = "+ .@a_id +" AND `nameid` = "+ .@item, .@count_sto );
		.@inv = .@inv + .@count_sto;
	}
	else {
		mes "Character '"+.@n$+"' does not exist.";
		close;
	}
	mes "Character '"+.@n$+"' has ^0055FF"+ .@inv +"^000000 "+ getitemname( .@item ) +" ("+ .@item +") in his account (storage, inventory, cart inventory).",
		( !.@gsto ? "" : ( "And ^0055FF"+ .@gsto +"^000000 "+ getitemname( .@item ) +" in guild storage on all his character." ) );
	
	close;
}

Check item ID in inventory, cart inventory, storage and gstorage of all player in the account of the player's name you write

Can be improve ( my skills in SQL are 'NULL' lol)

Sir capuche i found some bug.... when i click the npc and i put the name of who i want to search and put the item i need to check it has given me accurate result however the searched person dropped the item that was in his possession and after i search again that item on the person the npc has given me the same result on my first search even though the person already dropped the items........

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:  

It's not a bug, this script use sql and database in sql is not update instantly, it takes some time

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

It's not a bug, this script use sql and database in sql is not update instantly, it takes some time

oh.... hahaha i've just tested it and waiting for a little bit and it did tells me the correct one.... thx capuche [ PROBLEM SOLVED ]

Edited by caspa
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

There are no non-SQL script commands to check storage and cart items. You'll need to add custom storagecountitem() and cartcountitem() commands.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

There are no non-SQL script commands to check storage and cart items. You'll need to add custom storagecountitem() and cartcountitem() commands.

Yes... thank you for that sir euphy..... anyway capuche already give me the script i need....... thank you so much [ SOLVED ]

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