Jump to content
  • 0

DB Error - Duplicate entry


Yudax

Question


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

Sir Im having this error, just recently. Ive been running this for 3 weeks with no errors. I dont know what happened. When you convert your coins to pvp points, and relog. It will reset back to 0. Please help me with this sir.

db_zps194cf3b9.png

Link to comment
Share on other sites

11 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

Posted · Hidden by Mystery, December 22, 2012 - Duplicate as the beginning post.
Hidden by Mystery, December 22, 2012 - Duplicate as the beginning post.

Sir Im having this error, just recently. Ive been running this for 3 weeks with no errors. I dont know what happened. When you convert your coins to pvp points, and relog. It will reset back to 0. Please help me with this sir.

db_zps194cf3b9.png

Link to comment

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

Topic Merged.

Please dont create multiple topic for your issues...

1 topic is enough.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

@Emistry

Sorry, Just recently read that it should be posted in Linux ( 3rd party ). Thought this is a wrong section.

bump

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

Looks like you have a custom script that inserted #cashpoints rows in your global_reg_value table?

If you have any custom scripts that use query_sql to INSERT or UPDATE sql tables while the server is running and characters are logged in, they need to have proper checks for online/offline chars. It looks like what happened is: your script inserts a variable (#cashpoints) that did not exist yet for that player, then the player logs out and the map-server tried to save that variable too--thus the duplicate entry error.

To fix these inconsistencies in your `global_reg_value` table, you could delete the #cashpoints rows your script inserted:

DELETE FROM global_reg_value WHERE CAST(`str` AS BINARY) = '#cashpoints';

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

/***
 ** Script Request (Cash Trader NPC)
 ** Link: http://rathena.org/board/topic/57101-request-cash-trader/
 ** By Slim
 ***/
prontera,186,264,4 script RO Coins Trader 437,{
//,677
set .@coinid,20103;
mes "[^0000FFCash Trader^000000]";
mes "Hi ^ff8800"+strcharinfo(0)+"^000000,";
mes "Your Avenger Points: [^ff0000"+#cashpoints+"^000000]";
mes "~ ROCoins into PvP Points";
mes "~ PvP Points into ROCoins";
switch(select("^ff0000>^000000 Cancel:^0000ff>^000000 Exchange RO Coins to PvP Points:^0000ff>^000000 Exchange PvP Points to RO Coins"))
{
case 1: break;
case 2:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of coins that you want to exchange.";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcoin:
input @hcoins;
set @hhcoins,@hcoins;
if(@hhcoins == 0) { break; }
if(countitem(.@coinid) < @hhcoins) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcoin; }
next;
delitem .@coinid,@hhcoins;
set #cashpoints,#cashpoints+@hhcoins*25;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcoins+"^000000) "+getitemname(.@coinid)+"(s). Total PvP Points: [^0000ff"+#cashpoints+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcoins+") "+getitemname(.@coinid)+"(s). Total PvP Points: ["+#cashpoints+"]";
break;
case 3:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of PvP Points that you want to exchange.";
mes "Your Avenger Points: [^ff0000"+#cashpoints+"^000000]";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcash:
input @hcash;
set @hhcash,@hcash;
if(@hhcash == 0) { break; }
if(#cashpoints < @hhcash) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcash; }
//I know they weight 0 but just in case you change its weight
if (!checkweight(.@coinid,@hhcash)) { mes "* ^ff0000You're overweight please store some items.^000000"; dispbottom "[Cash Trader] You're overweight please store some items."; break; }
next;
set #cashpoints,#cashpoints-@hhcoins*25;
getitem .@coinid,@hhcash/25;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcash+"^000000) AvengerPoints to "+getitemname(.@coinid)+"(s). Total PvP Points: [^0000ff"+#cashpoints+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcash+") PvP Points to "+getitemname(.@coinid)+"(s). Total PvP Points: ["+#cashpoints+"]";
break;
}
close;
}

I tried many Coin to Cashpoints/PvP Points. All of them results to this:

db_zps194cf3b9.png

How shoul I Fix this?. I've updated to 17033

bumb

Edited by jmusc10
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

Looks like you have a custom script that inserted #cashpoints rows in your global_reg_value table?

If you have any custom scripts that use query_sql to INSERT or UPDATE sql tables while the server is running and characters are logged in, they need to have proper checks for online/offline chars. It looks like what happened is: your script inserts a variable (#cashpoints) that did not exist yet for that player, then the player logs out and the map-server tried to save that variable too--thus the duplicate entry error.

To fix these inconsistencies in your `global_reg_value` table, you could delete the #cashpoints rows your script inserted:

DELETE FROM global_reg_value WHERE CAST(`str` AS BINARY) = '#cashpoints';

When im doe doing this

DELETE FROM global_reg_value WHERE CAST(`str` AS BINARY) = '#cashpoints';.

Will the cashpoints be reset back to 0?

This is my script

/***
 ** Script Request (Cash Trader NPC)
 ** Link: http://rathena.org/board/topic/57101-request-cash-trader/
 ** By Slim
 ***/
prontera,186,264,4 script ZileRO Coins Trader 437,{
//,677
set .@coinid,20103;
mes "[^0000FFCash Trader^000000]";
mes "Hi ^ff8800"+strcharinfo(0)+"^000000,";
mes "Your Avenger Points: [^ff0000"+#cashpoints+"^000000]";
mes "~ ZileRO Coins into PvP Points";
mes "~ PvP Points into ZileRO Coins";
switch(select("^ff0000>^000000 Cancel:^0000ff>^000000 Exchange zRO Coins to PvP Points:^0000ff>^000000 Exchange PvP Points to zRO Coins"))
{
case 1: break;
case 2:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of coins that you want to exchange.";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcoin:
input @hcoins;
set @hhcoins,@hcoins;
if(@hhcoins == 0) { break; }
if(countitem(.@coinid) < @hhcoins) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcoin; }
next;
delitem .@coinid,@hhcoins;
set #cashpoints,#cashpoints+@hhcoins*25;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcoins+"^000000) "+getitemname(.@coinid)+"(s). Total PvP Points: [^0000ff"+#cashpoints+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcoins+") "+getitemname(.@coinid)+"(s). Total PvP Points: ["+#cashpoints+"]";
break;
case 3:
next;
mes "[^0000FFCash Trader^000000]";
mes "Please input the amount of PvP Points that you want to exchange.";
mes "Your Avenger Points: [^ff0000"+#cashpoints+"^000000]";
mes "Note: Put ^0000ff0^000000 to exit.";
L_inpcash:
input @hcash;
set @hhcash,@hcash;
if(@hhcash == 0) { break; }
if(#cashpoints < @hhcash) { mes "* ^ff0000Please input a valid amount^000000"; mes "(Put ^0000ff0^000000 to exit)."; goto L_inpcash; }
//I know they weight 0 but just in case you change its weight
if (!checkweight(.@coinid,@hhcash)) { mes "* ^ff0000You're overweight please store some items.^000000"; dispbottom "[Cash Trader] You're overweight please store some items."; break; }
next;
set #cashpoints,#cashpoints-@hhcoins*25;
getitem .@coinid,@hhcash/25;
mes "[^0000FFCash Trader^000000]";
mes "You've exchanged (^ff0000"+@hhcash+"^000000) AvengerPoints to "+getitemname(.@coinid)+"(s). Total PvP Points: [^0000ff"+#cashpoints+"^000000]";
dispbottom "[Cash Trader] You've exchanged ("+@hhcash+") PvP Points to "+getitemname(.@coinid)+"(s). Total PvP Points: ["+#cashpoints+"]";
break;
}
close;
}

By the way I tried to remove this and restarted the server. It goes well without errors. But after I put this NPC. The duplicate entries again appears.

Edited by jmusc10
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

That coz you have #cashpoints and #CASHPOINTS variables in global reg value.

In your script, change #cashpoints by #CASHPOINTS (#CASHPOINTS is used when using @cash command)

In global reg value delete #cashpoints

Edited by Capuche
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

That coz you have #cashpoints and #CASHPOINTS variables in global reg value.

In your script, change #cashpoints by #CASHPOINTS (#CASHPOINTS is used when using @cash command)

In global reg value delete #cashpoints

Is there any commands that will automatically delete #cashpoints? because in pvp, players earn i think #cashpoints and not #CASHPOINTS

So in the NPC script. i will change #cashpoints --> #CASHPOINTS?

I Also tried removing this script and it wont give any error

Edited by jmusc10
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

hmm I thought in the Athena Scripting Language, variable names are not case-sensitive

(#test is the same as #TEST and #teST)

So #cashpoints should be the same as #CASHPOINTS.

In your script, can you try changing #cashpoints to #CASHPOINTS (all uppercase), then see if you still get those errors.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

hmm I thought in the Athena Scripting Language, variable names are not case-sensitive

(#test is the same as #TEST and #teST)

So #cashpoints should be the same as #CASHPOINTS.

In your script, can you try changing #cashpoints to #CASHPOINTS (all uppercase), then see if you still get those errors.

I've tried changing to that server and still got errors.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  57
  • Topics Per Day:  0.01
  • Content Count:  248
  • Reputation:   7
  • Joined:  11/27/12
  • Last Seen:  

bump

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...