Advertisement
akbare

Check item with whisper npc

Nov 15th, 2022 (edited)
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. - script ItemCount -1,{
  2. OnWhisperGlobal:
  3. if( getgmlevel() < 90 ) end;
  4. if( getitemname( atoi( @whispervar0$ ) ) != "null" ){
  5.  
  6. set .@item_id,atoi( @whispervar0$ );
  7.  
  8. if( .@item_id ){
  9. for( set .@i,0; .@i < .sql_size; set .@i,.@i + 1 ){
  10. query_sql( "SELECT SUM(`amount`) FROM `"+.sql_table$[.@i]+"` WHERE `nameid`='"+.@item_id+"'",.@amount );
  11. query_sql( "SELECT COUNT(`card0`) FROM `"+.sql_table$[.@i]+"` WHERE `card0`='"+.@item_id+"'",.@card0 );
  12. query_sql( "SELECT COUNT(`card1`) FROM `"+.sql_table$[.@i]+"` WHERE `card1`='"+.@item_id+"'",.@card1 );
  13. query_sql( "SELECT COUNT(`card2`) FROM `"+.sql_table$[.@i]+"` WHERE `card2`='"+.@item_id+"'",.@card2 );
  14. query_sql( "SELECT COUNT(`card3`) FROM `"+.sql_table$[.@i]+"` WHERE `card3`='"+.@item_id+"'",.@card3 );
  15. set .@total,.@total + ( .@amount + .@card0 + .@card1 + .@card2 + .@card3 );
  16. }
  17.  
  18. dispbottom "Found "+.@total+" x "+getitemname( .@item_id );
  19. }
  20. }else{
  21. dispbottom "Invalid Item ID";
  22. }
  23. end;
  24.  
  25. OnInit:
  26. setarray .sql_table$[0],"inventory","cart_inventory","guild_storage","storage","mail";
  27. set .sql_size,getarraysize( .sql_table$ );
  28. end;
  29. }
  30.  
  31.  
  32. // sample
  33. //[npc:ItemCount] 512
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement