A small problem....

Started by D4rkR420R, Jun 10, 2017, 08:56 PM

Previous topic - Next topic

D4rkR420R

Dear fellows,

Quote from: Kewun on Jan 20, 2017, 12:26 PMNice bump but i will answer your question
"=" sign in ini parser ruins the file
When ever a player registers, creates a INI section, and the name of that section is the player's nick. However, if the player had brackets at the first character of the nickname, it will corrupt/ruin the data and stop the process. I wonder is there any way to prevent this from happening? I want you best answers as possible to solve this issue. If it's unsolving, then that's okay.

Stormeus

Yes, stop using INIs for data storage.

You could also try replacing the = symbol with a different character when saving and making sure to convert back when loading.

D4rkR420R

#2
Quote from: Stormeus on Jun 10, 2017, 09:15 PMYes, stop using INIs for data storage.

You could also try replacing the = symbol with a different character when saving and making sure to convert back when loading.
Well then I have no choice but to use SQLite. Although, I'm receiving errors from the Fuzzie Account system. Is about the constructor. Would you help me on this?



P.S. Press CTRL & + to zoom in this images. Forgive me if their small.

Stormeus


D4rkR420R


KAKAN

show us onPlayerJoin maybe?
Also, using INI is no problem. Hash the name using SHA1 and match it against the player's hashed name when it joins.
oh no

EK.IceFlake

You're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails. To figure out the actual error, you need to implement a workaround demonstrated here:
        try r = ::SQLite_Query(inst, q)
        catch (e) throw ::SQLite_ErrMsg(inst);

Wrap your query up in a try/catch block and add throw SQLite_ErrMsg(db); inside the catch part of that block and try again. You should get a more detailed error message this time.

Stormeus

Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails.

... why does it say not an error?

EK.IceFlake

Quote from: Stormeus on Jun 11, 2017, 08:58 AM
Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails.

... why does it say not an error?
Don't really feel like checking the source, but most probably because of someone forgetting to return the error code. An error code of 0 will usually cause either not an error or the operation completed successfully.

After checking the source, I'm guessing it's because of checking for an error on the query rather than the actual database unlike SQLite_ErrMsg.

D4rkR420R

Quote from: KAKAN on Jun 11, 2017, 07:13 AMshow us onPlayerJoin maybe?
Also, using INI is no problem. Hash the name using SHA1 and match it against the player's hashed name when it joins.

This may actutally work, rather than restarting the whole account system. The error coming from the console is in this line from onPlayerJoin: pstats[ player.ID ] = PlayerClass( player.Name, db );
Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails. To figure out the actual error, you need to implement a workaround demonstrated here:
        try r = ::SQLite_Query(inst, q)
        catch (e) throw ::SQLite_ErrMsg(inst);

Wrap your query up in a try/catch block and add throw SQLite_ErrMsg(db); inside the catch part of that block and try again. You should get a more detailed error message this time.

Where do I try/catch block it at? The QuerySQL or.....?

EK.IceFlake

Quote from: DarkRaZoR^ on Jun 11, 2017, 06:29 PM
Quote from: KAKAN on Jun 11, 2017, 07:13 AMshow us onPlayerJoin maybe?
Also, using INI is no problem. Hash the name using SHA1 and match it against the player's hashed name when it joins.

This may actutally work, rather than restarting the whole account system. The error coming from the console is in this line from onPlayerJoin: pstats[ player.ID ] = PlayerClass( player.Name, db );
Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails. To figure out the actual error, you need to implement a workaround demonstrated here:
        try r = ::SQLite_Query(inst, q)
        catch (e) throw ::SQLite_ErrMsg(inst);

Wrap your query up in a try/catch block and add throw SQLite_ErrMsg(db); inside the catch part of that block and try again. You should get a more detailed error message this time.

Where do I try/catch block it at? The QuerySQL or.....?
Yes.

D4rkR420R

Quote from: EK.IceFlake on Jun 11, 2017, 06:39 PM
Quote from: DarkRaZoR^ on Jun 11, 2017, 06:29 PM
Quote from: KAKAN on Jun 11, 2017, 07:13 AMshow us onPlayerJoin maybe?
Also, using INI is no problem. Hash the name using SHA1 and match it against the player's hashed name when it joins.

This may actutally work, rather than restarting the whole account system. The error coming from the console is in this line from onPlayerJoin: pstats[ player.ID ] = PlayerClass( player.Name, db );
Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails. To figure out the actual error, you need to implement a workaround demonstrated here:
        try r = ::SQLite_Query(inst, q)
        catch (e) throw ::SQLite_ErrMsg(inst);

Wrap your query up in a try/catch block and add throw SQLite_ErrMsg(db); inside the catch part of that block and try again. You should get a more detailed error message this time.

Where do I try/catch block it at? The QuerySQL or.....?
Yes.

try
{
  QuerySQL( db, "CREATE TABLE IF NOT EXISTS Accounts ( Name VARCHAR(32), Password VARCHAR(25), Cash INT, Bank INT, Kills INT, Deaths INT, Level INT, LastUsedIP VARCHAR(32) ");
}
catch (e) throw ::SQlite_ErrMsg( inst );
Is this correct?

EK.IceFlake

Quote from: DarkRaZoR^ on Jun 11, 2017, 09:18 PM
Quote from: EK.IceFlake on Jun 11, 2017, 06:39 PM
Quote from: DarkRaZoR^ on Jun 11, 2017, 06:29 PM
Quote from: KAKAN on Jun 11, 2017, 07:13 AMshow us onPlayerJoin maybe?
Also, using INI is no problem. Hash the name using SHA1 and match it against the player's hashed name when it joins.

This may actutally work, rather than restarting the whole account system. The error coming from the console is in this line from onPlayerJoin: pstats[ player.ID ] = PlayerClass( player.Name, db );
Quote from: EK.IceFlake on Jun 11, 2017, 08:52 AMYou're using SLC's SQLite plugin which causes a not an error error when an SQLite query fails. To figure out the actual error, you need to implement a workaround demonstrated here:
        try r = ::SQLite_Query(inst, q)
        catch (e) throw ::SQLite_ErrMsg(inst);

Wrap your query up in a try/catch block and add throw SQLite_ErrMsg(db); inside the catch part of that block and try again. You should get a more detailed error message this time.

Where do I try/catch block it at? The QuerySQL or.....?
Yes.

try
{
  QuerySQL( db, "CREATE TABLE IF NOT EXISTS Accounts ( Name VARCHAR(32), Password VARCHAR(25), Cash INT, Bank INT, Kills INT, Deaths INT, Level INT, LastUsedIP VARCHAR(32) ");
}
catch (e) throw ::SQlite_ErrMsg( inst );
Is this correct?
Why don't you try it?

Milko

You need jebed on head.

D4rkR420R

#14
Quote from: Milko on Jun 12, 2017, 12:32 PMYou need jebed on head.

Administradors, mind kindly preventing this topic from spam.

Edit: Solved & Locked.