07.03.2013, 19:24
Hey guys wondering if anyone can help me solve this..
OnPlayerConnect
EDIT: it only happens if i reconnect to the server with the same character name after registering once. If i change it after registering my name it doesn't crash at connect. it's weird man..
PHP Code:
[20:32:10] [join] Patrick_S has joined the server (0:66.131.146.105)
[20:32:10] [debug] Server crashed while executing mysql.amx
[20:32:10] [debug] AMX backtrace:
[20:32:10] [debug] #0 native mysql_fetch_field_row () [b7c379d0] from mysql.so
[20:32:10] [debug] #1 00002a94 in ?? () from mysql.amx
[20:32:10] [debug] #2 000013b0 in public OnPlayerConnect () from mysql.amx
[20:32:10] [debug] System backtrace:
[20:32:10] [debug] #0 b6edaecb in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[20:32:10] [debug] #1 b6ed2c69 in _ZN11CrashDetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[20:32:10] [debug] #2 b6ed4c99 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[20:32:10] [debug] #3 b6eda9d8 in ?? () from plugins/crashdetect.so
[20:32:10] [debug] #4 00a510f0 in ?? () from /lib/libpthread.so.0
[20:32:10] [debug] #5 b7c31575 in _ZN13CMySQLHandler10FetchFieldESs () from plugins/mysql.so
[20:32:10] [debug] #6 b7c37a73 in _ZN7Natives23n_mysql_fetch_field_rowEP6tagAMXPi () from plugins/mysql.so
[20:32:10] [debug] #7 08093c94 in ?? () from ./samp03svr
[20:32:10] [debug] #8 b6ed4f37 in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[20:32:10] [debug] #9 b6ed7268 in ?? () from plugins/crashdetect.so
[20:32:10] [debug] #10 b6edd2c2 in amx_Exec () from plugins/crashdetect.so
[20:32:10] [debug] #11 b6ed4e1e in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[20:32:10] [debug] #12 b6ed72de in ?? () from plugins/crashdetect.so
PHP Code:
public OnPlayerConnect(playerid)
{
RemoveUnderScore(playerid);
TextDrawHideForPlayer(playerid, Textdraw1);
MoneyGiven[playerid] = -1;
JustLogged[playerid] = 0;
new query[300], pname[24];
GetPlayerName(playerid, pname, 24);
format(query, sizeof(query), "SELECT IP FROM `playerdata` WHERE user = '%s' LIMIT 1", pname);
mysql_query(query);
mysql_store_result();
new rows = mysql_num_rows();
if(!rows)
{
ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""Blue"Please register",""White"Welcome to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to register!\n\n"White"Please insert a password below:", "Register", "Cancel");
}
if(rows == 1)
{
new IP[2][15];
mysql_fetch_field_row(IP[0],"IP");
GetPlayerIp(playerid, IP[1], 15);
if(strlen(IP[0]) != 0 && !strcmp(IP[0], IP[1], true))
{
MySQL_Login(playerid);
}
else if(!strlen(IP[0]) || strcmp(IP[0], IP[1], true))
{
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
IsRegistered[playerid] = 1;
}
}
mysql_free_result();
return 1;
}