Server crashed by mysql_function_query -
domi3322 - 28.02.2014
Hey guys,
Before i wrote my Problem, i hope you can unterstand all of this text, im from Austria :P
To my Problem:
I maked a little Helpsystem with Mysql.
And now, i use the Function mysql_function_query.
but the server crashed after i enter the /help2 command
The Problemkid(Under Helpsystem):
Код:
format(query,sizeof query,"SELECT * FROM `helpsystem` WHERE `name` LIKE '%%%s%%'",text);
mysql_function_query(sqlcon, query, true, "ReturnHelp", "is", playerid, text);
Crashlog(Crashdetect):
Код:
[18:13:19] [debug] Server crashed while executing trucking.amx
[18:13:19] [debug] AMX backtrace:
[18:13:19] [debug] #0 native mysql_function_query () [10008f00] from mysql.DLL
[18:13:19] [debug] #1 0001c9d8 in public Helpsystem (0x00000000, 0x00053614, 0x00000000, 0x00000000, 0x00000000, 0x00000000) from trucking.amx
[18:13:19] [debug] Native backtrace:
[18:13:19] [debug] #0 0040335f in ?? () from samp-server.exe
[18:13:19] [debug] #1 1000ad58 in ?? () from plugins\mysql.DLL
[18:13:19] [debug] #2 100090ed in ?? () from plugins\mysql.DLL
[18:13:19] [debug] #3 004010b6 in ?? () from samp-server.exe
[18:13:19] [debug] #4 57a09db7 in ?? () from plugins\crashdetect.DLL
[18:13:19] [debug] #5 57a158ca in ?? () from plugins\crashdetect.DLL
[18:13:19] [debug] #6 57a1774f in ?? () from plugins\crashdetect.DLL
[18:13:19] [debug] #7 57a10834 in ?? () from plugins\crashdetect.DLL
[18:13:19] [debug] #8 57a1591a in ?? () from plugins\crashdetect.DLL
[18:13:19] [debug] #9 57a59f0d in ?? () from plugins\streamer.DLL
[18:13:19] [debug] #10 0047e408 in ?? () from samp-server.exe
[18:13:19] [debug] #11 002bedf0 in ?? ()
[18:13:19] [debug] #12 002b12a0 in ?? ()
[18:13:19] [debug] #13 002bedd0 in ?? ()
[18:13:19] [debug] #14 002bedb0 in ?? ()
My System:
/help2 Command:
Код:
ocmd:help2(playerid,params[])
{
new text[32];
if(sscanf(params, "s[64]", text)) return SendClientMessage(playerid, COLOR_RED, "BENUTZUNG: /help2 [Text]");
/*
ShowPlayerDialog(playerid,10,DIALOG_STYLE_LIST,"Help","Trucker Commands\nPolice Commands\nGeneral Commands\nHouse","Select","Cancel");
*/
SendClientMessage(playerid, COLOR_BLUE, "Helpsystem wird aus Datenbank geladen.");
SetTimerEx("Helpsystem", 4000, 0, "is[64]", playerid, text);
return 1;
}
My 2 Callbacks (Helpsystem & ReturnHelp):
Код:
forward Helpsystem(playerid, text[]);
public Helpsystem(playerid, text[])
{
if(mysql_ping(1) == 0)
{
SendClientMessage(playerid, COLOR_RED, "Konnte Helpsystem nicht abrufen, bitte versuche es spдter erneut.");
return 1;
}
else
{
new query[128];
format(query,sizeof query,"SELECT * FROM `helpsystem` WHERE `name` LIKE '%%%s%%'",text);
mysql_function_query(sqlcon, query, true, "ReturnHelp", "is", playerid, text);
return 1;
}
}
forward ReturnHelp(playerid, text[]);
public ReturnHelp(playerid, text[])
{
new rows, lines;
cache_get_data(rows, lines);
if(!rows)
{
new string[128];
format(string, sizeof string, "[Helpsystem]Konnte keinen Eintrag mit dem Namen '%s' finden.", text);
SendClientMessage(playerid, COLOR_RED, string);
}
else
{
if(rows > 1)
{
new data[64], string[128];
for(new i; i<5; i++)
{
cache_get_field_content(i, "name", data);
format(string, sizeof string, "%s\n%s", string, data);
}
ShowPlayerDialog(playerid, DIALOG_RETURNHELP, DIALOG_STYLE_LIST, "Helpsystem - Auswahl", string, "Auswдhlen", "Abbrechen");
}
else if(rows == 1)
{
SendClientMessage(playerid, COLOR_RED, "test");
}
}
}
i hope anyone can help :/
Best Regards,
domi