Advertisement
Capuche

Check_item_player

May 8th, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Check amount item
  3. //===== By: ==================================================
  4. //= Capuche
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN
  9. //===== Description: =========================================
  10. //= Check the amount of Items in the inventory, storage
  11. //= guild storage, cart of the specific player.
  12. //= Specific player must be offline to make sure of amount
  13. //= Items.
  14. //============================================================
  15.  
  16.  
  17. prontera,166,185,6 script ghjkl 56,{
  18. mes "Enter a name.";
  19. input .@n$;
  20.  
  21. if ( query_sql("SELECT `account_id` FROM `char` WHERE `name` = '"+ escape_sql( .@n$ ) +"'", .@a_id ) ) {
  22. query_sql("SELECT `char_id`, `guild_id` FROM `char` WHERE `account_id` = '"+ .@a_id +"'", .@c_id, .@g_id );
  23. mes "Input an item ID.";
  24. input .@item;
  25. if( getitemname( .@item ) == "" ) {
  26. mes "wrong item ID";
  27. close;
  28. }
  29. for( .@i = 0; .@i < getarraysize( .@c_id ); .@i++ ) {
  30. query_sql( "SELECT SUM(`amount`) FROM `inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_inv );
  31. query_sql( "SELECT SUM(`amount`) FROM `cart_inventory` WHERE `char_id` = "+ .@c_id[.@i] +" AND `nameid` = "+ .@item, .@count_cart );
  32. query_sql( "SELECT SUM(`amount`) FROM `guild_storage` WHERE `guild_id` = "+ .@g_id[.@i] +" AND `nameid` = "+ .@item, .@count_gsto );
  33. .@inv = .@inv + .@count_inv + .@count_cart;
  34. .@gsto = .@gsto + .@count_gsto;
  35. }
  36. query_sql( "SELECT SUM(`amount`) FROM `storage` WHERE `account_id` = "+ .@a_id +" AND `nameid` = "+ .@item, .@count_sto );
  37. .@inv = .@inv + .@count_sto;
  38. }
  39. else {
  40. mes "Character '"+ .@n$ +"' does not exist.";
  41. close;
  42. }
  43. mes "Character '"+ .@n$ +"' has ^0055FF"+ .@inv +"^000000 "+ getitemname( .@item ) +" ("+ .@item +") in his account (storage, inventory, cart inventory).",
  44. ( !.@gsto ? "" : ( "And ^0055FF"+ .@gsto +"^000000 "+ getitemname( .@item ) +" in guild storage on all his character." ) );
  45.  
  46. close;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement