Vice City: Multiplayer

VC:MP Discussion => Support => Topic started by: D4rkR420R on Jun 10, 2017, 08:56 PM

Title: A small problem....
Post by: D4rkR420R on Jun 10, 2017, 08:56 PM
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.
Title: Re: A small problem....
Post by: Stormeus on Jun 10, 2017, 09:15 PM
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.
Title: Re: A small problem....
Post by: D4rkR420R on Jun 10, 2017, 09:17 PM
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?
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FxxiwFRQ.png&hash=633f1e21c8d5ec2ded385222c60ebb8ece39b986)
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FgX99xRs.png&hash=db526051b2792326d131f5141683d652a1bb1452)

P.S. Press CTRL & + to zoom in this images. Forgive me if their small.
Title: Re: A small problem....
Post by: Stormeus on Jun 10, 2017, 09:46 PM
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FGI3hhjD.png&hash=58a0ad616d3029a2531f30df577a0c4a80d8bd8d)
Title: Re: A small problem....
Post by: D4rkR420R on Jun 10, 2017, 09:58 PM
Quote from: Stormeus on Jun 10, 2017, 09:46 PM(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FGI3hhjD.png&hash=58a0ad616d3029a2531f30df577a0c4a80d8bd8d)
I don't understand the fix of that.
Title: Re: A small problem....
Post by: KAKAN on Jun 11, 2017, 07:13 AM
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.
Title: Re: A small problem....
Post by: EK.IceFlake on Jun 11, 2017, 08:52 AM
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 (https://forum.vc-mp.org/?topic=4300.0):
        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.
Title: Re: A small problem....
Post by: 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?
Title: Re: A small problem....
Post by: EK.IceFlake on Jun 11, 2017, 09:33 AM
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 (https://github.com/iSLC/VCMP-SQLite/blob/master/source/Functions.cpp#L586) rather than the actual database unlike SQLite_ErrMsg.
Title: Re: A small problem....
Post by: D4rkR420R 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 (https://forum.vc-mp.org/?topic=4300.0):
        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.....?
Title: Re: A small problem....
Post by: 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 (https://forum.vc-mp.org/?topic=4300.0):
        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.
Title: Re: A small problem....
Post by: D4rkR420R 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 (https://forum.vc-mp.org/?topic=4300.0):
        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?
Title: Re: A small problem....
Post by: EK.IceFlake on Jun 12, 2017, 06:11 AM
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 (https://forum.vc-mp.org/?topic=4300.0):
        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?
Title: Re: A small problem....
Post by: Milko on Jun 12, 2017, 12:32 PM
You need jebed on head.
Title: Re: A small problem....
Post by: D4rkR420R on Jun 12, 2017, 02:36 PM
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.