Jump to content
  • 0
Louis T Steinhil

What's best in storing items and not duplicating by mistake?

Question

I am trying to make a script called Card Collection NPC all is working now but the main problem I'm encountering is when I submit the card it will give the bonus stats in return. I will immediately close the server via console without letting the character logout so now I got 20 Abysmal Knight Card which should be 10 only because I already submitted it. I use only setd / getd in storing variables. And I get the part why it's duplicating because there's a delay in saving data to sql right? So how do I prevent this?

 

Untitled.jpg

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Yes, you are right about the cause.

 

Your case seems to be causing a similar effect of a server crash, when it gets terminated in an abnormal situation.

 

I am not sure if there is really something that can be done in this case... while you could create a script command to force saving the character data for this case, you would still have it open for others.

 

I think the best option would be to:

1. When doing a production server normal shutdown, always do it properly. Kick all players (even better: do something to prevent them from logging back in) and wait some time (I think ~5 minutes would be more than enough).

    I think if map server is shut down separately first, it will send all data to char, but this is something that would need to be done manually

2. If there was a server crash, which could cause those dupes, you probably need to either review your logs of the last few minutes and check if actions are needed, or rollback to a recent backup if you think it would be safer

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, KirieZ said:

Yes, you are right about the cause.

 

Your case seems to be causing a similar effect of a server crash, when it gets terminated in an abnormal situation.

 

I am not sure if there is really something that can be done in this case... while you could create a script command to force saving the character data for this case, you would still have it open for others.

 

I think the best option would be to:

1. When doing a production server normal shutdown, always do it properly. Kick all players (even better: do something to prevent them from logging back in) and wait some time (I think ~5 minutes would be more than enough).

    I think if map server is shut down separately first, it will send all data to char, but this is something that would need to be done manually

2. If there was a server crash, which could cause those dupes, you probably need to either review your logs of the last few minutes and check if actions are needed, or rollback to a recent backup if you think it would be safer

Okay, thanks for the response. I was really curious if anyone has done something to prevent it but i guess rollback is really the answer, of course besides kicking them manually. XD

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.