SA-MP Forums Archive
Server crashing on MYSQL loading - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server crashing on MYSQL loading (/showthread.php?tid=352584)



Server crashing on MYSQL loading - Jstylezzz - 20.06.2012

Hi eveyone,

It seems that something is wrong in my loadstats function, but i just don't get what is going on..
Does anyone see the error?
Every help is appreciated!
pawn Код:
stock LoadStats(playerid)
{
    new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s' ", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[60]s[60]iiiiiiiiiiiiiiiiiiiiiiiiis[128]iis[128]s[128]s[128]ii>", PInfo[playerid]);
    mysql_free_result();
    GivePlayerMoney(playerid,PInfo[playerid][Money]);
    SetPVarInt(playerid,"Score",PInfo[playerid][Level]);
    SetPlayerScore(playerid,PInfo[playerid][Level]);
    SetPVarInt(playerid,"Level",PInfo[playerid][Admin]);
    SetPVarInt(playerid,"Helper",PInfo[playerid][Helper]);
    SetPlayerSkin(playerid,PInfo[playerid][Skin]);
    SetPVarInt(playerid,"Kills",PInfo[playerid][Kills]);
    SetPVarInt(playerid,"Deaths",PInfo[playerid][Deaths]);
    SetPVarInt(playerid,"Muted",PInfo[playerid][Muted]);
    SetPVarInt(playerid,"HasCell",PInfo[playerid][Cell]);
    SetPVarInt(playerid,"HasCigs",PInfo[playerid][Cigs]);
    SetPVarInt(playerid,"HasWatch",PInfo[playerid][Watch]);
    SetPVarInt(playerid,"HasMask",PInfo[playerid][Mask]);
    SetPVarInt(playerid,"GasCan",PInfo[playerid][GasCan]);
    SetPVarInt(playerid,"HasSprunk",PInfo[playerid][Sprunk]);
    SetPVarInt(playerid,"HasStereo",PInfo[playerid][Stereo]);
    SetPVarInt(playerid,"GoldCoins",PInfo[playerid][GoldCoins]);
    SetPVarInt(playerid,"PMethod",PInfo[playerid][PaymentMethod]);
    SetPVarInt(playerid,"Skin",PInfo[playerid][Skin]);



    return 1;
}



Re: Server crashing on MYSQL loading - Vince - 20.06.2012

Log? And what's the point of these PVars if you're already using an enum?


Re: Server crashing on MYSQL loading - iggy1 - 20.06.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Log? And what's the point of these PVars if you're already using an enum?
Maybe he needs to use them cross script. Though i do agree that's not a good way of going about it.

@Jari Have you tried the crashdetect plugin yet?

EDIT:

If you decide to use the crash detect plugin put the following file in your pawno folder.
http://dl.dropbox.com/u/76608104/pawn.cfg

Re-compile your code and run it with the crash detect plugin. If you compile with this file, extra information will be added to the crashdetect output. It should tell you which line the mode crashes on.

Remove the file or delete it's contents and recompile once you have debugged your code.


Re: Server crashing on MYSQL loading - Jstylezzz - 20.06.2012

Thanks for the responses.
I know these pvars are shit xD I made my whole script with pvars since I was a total noob when I started it, I'm converting everything now.

I will check the crashdetect plugin, and i hope i can solve my problem.
Thanks

EDIT: ok, so i did some research...
It's clear that the problem is in this part of the stock:
pawn Код:
new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s' ", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[60]s[60]iiiiiiiiiiiiiiiiiiiiiiiiis[128]iis[128]s[128]s[128]ii>", PInfo[playerid]);
    mysql_free_result();
Anyone any idea?


Re: Server crashing on MYSQL loading - Jstylezzz - 21.06.2012

Bump - Sorry for bumping, but i really need this fixed, this is the only thing that keeps my server from going online :\

Problem:
pawn Код:
new pName[24],Query[80];
    GetPlayerName(playerid,pName,24);
    format(Query, sizeof(Query), "SELECT * FROM `Users` WHERE `Username` = '%s' ", pName);
    mysql_query(Query);
    mysql_store_result();
    mysql_fetch_row_format(Query, "|");
    sscanf(Query, "e<p<|>s[60]s[60]iiiiiiiiiiiiiiiiiiiiiiiiis[128]iis[128]s[128]s[128]ii>", PInfo[playerid]);
    mysql_free_result();
Somewhere in here...
I am out of ideas..


Re: Server crashing on MYSQL loading - Vince - 21.06.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Log?
4 char.


Re: Server crashing on MYSQL loading - Snipa - 21.06.2012

Yes, show the log..

Or it could be this:

pawn Код:
"e<p<|>ssiiiiiiiiiiiiiiiiiiiiiiiiisiisssii>", PInfo[playerid]



Re: Server crashing on MYSQL loading - Jstylezzz - 21.06.2012

pawn Код:
[18:17:37]  

[18:17:37] ---------------------------

[18:17:37] MySQL Debugging activated (06/21/12)

[18:17:37] ---------------------------

[18:17:37]  

[18:17:37] >> mysql_connect( )

[18:17:37] CMySQLHandler::CMySQLHandler() - constructor called.

[18:17:37] CMySQLHandler::CMySQLHandler() - Connecting to "" | DB: "" | Username: "" ...

[18:17:37] CMySQLHandler::Connect() - Connection was successful.

[18:17:37] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[18:17:40]  

[18:17:40] ---------------------------

[18:17:40] MySQL Debugging activated (06/21/12)

[18:17:40] ---------------------------

[18:17:40]  

[18:17:40] >> mysql_connect( )

[18:17:40] CMySQLHandler::CMySQLHandler() - constructor called.

[18:17:40] CMySQLHandler::CMySQLHandler() - Connecting to "" | DB: "" | Username: "" ...

[18:17:40] CMySQLHandler::Connect() - Connection was successful.

[18:17:40] CMySQLHandler::Connect() - Auto-Reconnect has been enabled.

[18:19:24] >> mysql_query( Connection handle: 1 )

[18:19:25] CMySQLHandler::Query(SELECT `Username` FROM `Users` WHERE `Username` = 'Jari_Johnson' LIMIT 1;) - Successfully executed.

[18:19:25] >> mysql_store_result( Connection handle: 1 )

[18:19:25] CMySQLHandler::StoreResult() - Result was stored.

[18:19:25] >> mysql_num_rows( Connection handle: 1 )

[18:19:25] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:19:25] >> mysql_free_result( Connection handle: 1 )

[18:19:25] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:20:14] >> mysql_real_escape_string( Connection handle: 1 )

[18:20:14] CMySQLHandler::EscapeString(password); - Escaped 10 characters to password.

[18:20:14] >> mysql_query( Connection handle: 1 )

[18:20:14] CMySQLHandler::Query(SELECT * FROM `Users` WHERE `Username` = '
Jari_Johnson' AND `Password` = 'password') - Successfully executed.

[18:20:14] >> mysql_store_result( Connection handle: 1 )

[18:20:14] CMySQLHandler::StoreResult() - Result was stored.

[18:20:14] >> mysql_num_rows( Connection handle: 1 )

[18:20:14] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:20:14] >> mysql_query( Connection handle: 1 )

[18:20:14] CMySQLHandler::Query(SELECT * FROM `Users` WHERE `Username` = '
Jari_Johnson' ) - Successfully executed.

[18:20:14] >> mysql_store_result( Connection handle: 1 )

[18:20:14] CMySQLHandler::StoreResult() - Result was stored.

[18:20:14] >> mysql_fetch_row_format( Connection handle: 1 )

[18:20:14] CMySQLHandler::FetchRow() - Return: Jari_Johnson|password|5000|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||0|0||||0|0

[18:20:14] >> mysql_free_result( Connection handle: 1 )

[18:20:14] CMySQLHandler::FreeResult() - Result was successfully free'
d.

[18:20:14] >> mysql_free_result( Connection handle: 1 )

[18:20:14] CMySQLHandler::FreeResult() - The result is already empty.

[18:22:09] >> mysql_query( Connection handle: 1 )

[18:22:09] CMySQLHandler::Query(SELECT `Username` FROM `Users` WHERE `Username` = 'Casper_Johnson' LIMIT 1;) - Successfully executed.

[18:22:09] >> mysql_store_result( Connection handle: 1 )

[18:22:09] CMySQLHandler::StoreResult() - Result was stored.

[18:22:09] >> mysql_num_rows( Connection handle: 1 )

[18:22:09] CMySQLHandler::NumRows() - Returned 0 row(s)

[18:22:09] >> mysql_free_result( Connection handle: 1 )

[18:22:09] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:22:12] >> mysql_query( Connection handle: 1 )

[18:22:12] CMySQLHandler::Query(INSERT INTO `Users` (Username) VALUES ('
Casper_Johnson')) - Successfully executed.

[18:22:17] >> mysql_query( Connection handle: 1 )

[18:22:18] CMySQLHandler::Query(UPDATE Users SET Age = '
50'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:18] >> mysql_query( Connection handle: 1 )

[18:22:18] CMySQLHandler::Query(UPDATE Users SET PNumber = '
104436075'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:23] >> mysql_query( Connection handle: 1 )

[18:22:23] CMySQLHandler::Query(UPDATE Users SET PCountry = '
The Netherlands'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:30] >> mysql_query( Connection handle: 1 )

[18:22:30] CMySQLHandler::Query(UPDATE Users SET PDesc = '
I am cool'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:35] >> mysql_query( Connection handle: 1 )

[18:22:35] CMySQLHandler::Query(UPDATE Users SET PMail = '
-'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:36] >> mysql_query( Connection handle: 1 )

[18:22:36] CMySQLHandler::Query(UPDATE Users SET PSex = '
0'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:39] >> mysql_query( Connection handle: 1 )

[18:22:39] CMySQLHandler::Query(UPDATE Users SET Password = '
password',Money = '5000',Level = '1'WHERE Username = 'Casper_Johnson') - Successfully executed.

[18:22:39] >> mysql_query( Connection handle: 1 )

[18:22:40] CMySQLHandler::Query(SELECT * FROM `Users` WHERE `Username` = '
Casper_Johnson' ) - Successfully executed.

[18:22:40] >> mysql_store_result( Connection handle: 1 )

[18:22:40] CMySQLHandler::StoreResult() - Result was stored.

[18:22:40] >> mysql_fetch_row_format( Connection handle: 1 )

[18:22:40] CMySQLHandler::FetchRow() - Return: Casper_Johnson|password|5000|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||50|104436075|I am cool|-|The Netherlands|0|0

[18:22:40] >> mysql_free_result( Connection handle: 1 )

[18:22:40] CMySQLHandler::FreeResult() - Result was successfully free'
d.

[18:22:52] >> mysql_query( Connection handle: 1 )

[18:22:52] CMySQLHandler::Query(SELECT `Username` FROM `Users` WHERE `Username` = 'Casper_Johnson' LIMIT 1;) - Successfully executed.

[18:22:52] >> mysql_store_result( Connection handle: 1 )

[18:22:52] CMySQLHandler::StoreResult() - Result was stored.

[18:22:52] >> mysql_num_rows( Connection handle: 1 )

[18:22:52] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:22:52] >> mysql_free_result( Connection handle: 1 )

[18:22:52] CMySQLHandler::FreeResult() - Result was successfully free'd.

[18:22:57] >> mysql_real_escape_string( Connection handle: 1 )

[18:22:57] CMySQLHandler::EscapeString(password); - Escaped 6 characters to password.

[18:22:57] >> mysql_query( Connection handle: 1 )

[18:22:57] CMySQLHandler::Query(SELECT * FROM `Users` WHERE `Username` = '
Casper_Johnson' AND `Password` = 'password') - Successfully executed.

[18:22:57] >> mysql_store_result( Connection handle: 1 )

[18:22:57] CMySQLHandler::StoreResult() - Result was stored.

[18:22:57] >> mysql_num_rows( Connection handle: 1 )

[18:22:57] CMySQLHandler::NumRows() - Returned 1 row(s)

[18:22:57] >> mysql_query( Connection handle: 1 )

[18:22:57] CMySQLHandler::Query(SELECT * FROM `Users` WHERE `Username` = '
Casper_Johnson' ) - Successfully executed.

[18:22:57] >> mysql_store_result( Connection handle: 1 )

[18:22:57] CMySQLHandler::StoreResult() - Result was stored.

[18:22:57] >> mysql_fetch_row_format( Connection handle: 1 )

[18:22:57] CMySQLHandler::FetchRow() - Return: Casper_Johnson|password|5000|1|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||50|104436075|I am cool|-|The Netherlands|0|0

[18:22:57] >> mysql_free_result( Connection handle: 1 )

[18:22:57] CMySQLHandler::FreeResult() - Result was successfully free'
d.
here is the log..
idk what this is, but when i am alone it works, but when a second person joins it crashes..
Sometimes it also crashes when i am alone..


Re: Server crashing on MYSQL loading - rachit_rocks - 21.06.2012

Big error will give u the method asap


Re: Server crashing on MYSQL loading - Jstylezzz - 21.06.2012

for everyone who tries to help, I just updated the mysql plugin, but the problem still exists :\
so at least it isnt the plugin.....