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

Louis T Steinhil

New member
Messages
172
Points
0
Age
35
Discord
Louis T Steinhil#8600
Emulator
Hercules
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

 
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

 
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

 
Back
Top