Jump to content
  • 0
Echoes

A way to read storage items of the invoking player

Question

Hello,

I was wondering, is there a way to use somethin alike countitem() but for storage items instead of the inventory items?

For example, I want to count how many Iron ore does the invoking character has in their storage, and return the number to the dialog the NPC is having; I think something with query_mysql() may be useful.

 

Thank you in advance.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
17 hours ago, Kubix said:

query_sql("SELECT amount FROM storage WHERE char_id = " + getcharid(0) + " AND id = " + .@item_id, .@amount);
mes "You have " + .@amount + " " + getitemname(.@item_id) + " in your storage!";
close;

?

query_sql(sprintf("SELECT amount FROM storage WHERE account_id='%d' AND nameid='%d'", getcharid(3), .@item_id), .@amount);

Share this post


Link to post
Share on other sites
  • 0
query_sql("SELECT amount FROM storage WHERE char_id = " + getcharid(0) + " AND id = " + .@item_id, .@amount);
mes "You have " + .@amount + " " + getitemname(.@item_id) + " in your storage!";
close;

?

Share this post


Link to post
Share on other sites
  • 0
4 hours ago, Kubix said:

query_sql("SELECT amount FROM storage WHERE char_id = " + getcharid(0) + " AND id = " + .@item_id, .@amount);
mes "You have " + .@amount + " " + getitemname(.@item_id) + " in your storage!";
close;

?

Yeah, something like that.

I will test it when I can, thank you!

Share this post


Link to post
Share on other sites
  • 0

Thank you for the replies @Kubix, @Dastgir.

 

May I ask then, how can I update the value of something (ingame) without making the invoking character to relog?

With my example, I erased 2 Iron Ores found in the storage of the character, and I can see that data update in the database, but ingame there are still that 2 Iron ores in the storage. Relogging fix this issue.

Edited by Echoes

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.