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;
}