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

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

  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.

Loading...

×
×
  • Create New...

Important Information

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