cant solve this error
#1

I was going to test one filterscript, so I used Grand Larceny as base gamemode for testing. But when i connect, server crashes.

This is what crashdetect gives out:

pawn Код:
[19:44:33] Running Grand Larceny - by the SA-MP team

[19:44:33] ---------------------------------------

[19:44:33] Number of vehicle models: 173
[19:45:02] Incoming connection: 192.168.1.24:57538
[19:45:02] [join] Kappa has joined the server (0:192.168.1.24)
[19:45:08] [debug] Server crashed while executing DAdmin2Mysql.amx
[19:45:08] [debug] AMX backtrace:
[19:45:08] [debug] #0 native mysql_real_escape_string () [10006ae0] from mysql.DLL
[19:45:08] [debug] #1 00021d1c in public OnDialogResponse (0x00000000, 0x000005dd, 0x00000001, 0xffffffff, 0x000e9390) from DAdmin2Mysql.amx
[19:45:09] [debug] Native backtrace:
[19:45:09] [debug] #0 710d1c72 in ?? () from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll
[19:45:09] [debug] #1 710b4951 in ?? () from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll
[19:45:09] [debug] #2 710b4996 in ?? () from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4940_none_50916076bcb9a742\MSVCR90.dll
[19:45:09] [debug] #3 10005b41 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\mysql.DLL
[19:45:09] [debug] #4 10005d6d in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\mysql.DLL
[19:45:09] [debug] #5 10008648 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\mysql.DLL
[19:45:09] [debug] #6 10006bc6 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\mysql.DLL
[19:45:09] [debug] #7 004010b6 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #8 70865f2a in AmxCallback () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\crashdetect.DLL
[19:45:09] [debug] #9 7086822e in amx_Exec () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\crashdetect.DLL
[19:45:09] [debug] #10 7085ff6f in CrashDetect::DoAmxExec () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\crashdetect.DLL
[19:45:09] [debug] #11 70865f7a in AmxExec () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\plugins\crashdetect.DLL
[19:45:09] [debug] #12 0046b69f in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #13 0048eaf5 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #14 00492b26 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #15 00492b48 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #16 67e8046a in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #17 59000043 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #18 247c83c3 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #19 2277e004 in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
[19:45:09] [debug] #20 042474ff in ?? () from C:\Users\Korisnik\Desktop\samp03x_svr_R2_win32\samp-server.exe
Reply
#2

fwrite crashes the server if you don't correctly open the file and don't check that the file was correctly openeed.
People do it like this
pawn Код:
new File:file = fopen("nameoffile.txt", io_write);
fwrite(file, "text");
fclose(file);
While the correct way is
pawn Код:
new File:file = fopen("nameoffile.txt", io_write);
if (file)
{
    fwrite(file, "text");
    fclose(file);
}
Reply
#3

The crash was caused by mysql_real_escape_string function in OnDialogResponse response in the DAdmin2Mysql file.

I don't know which MySQL plugin you use but in BlueG's one there was a problem with crashes from mysql_real_escape_string function that was fixed later on.

I'd recommend you to use 4.12 version: https://github.com/Zeex/samp-plugin-...ases/tag/v4.12
and compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info

so crashdetect may print more information about the crash.

Quote:
Originally Posted by Wizza
Посмотреть сообщение
fwrite crashes the server if you don't correctly open the file and don't check that the file was correctly openeed.
People do it like this
pawn Код:
new File:file = fopen("nameoffile.txt", io_write);
fwrite(file, "text");
fclose(file);
While the correct way is
pawn Код:
new File:file = fopen("nameoffile.txt", io_write);
if (file)
{
    fwrite(file, "text");
    fclose(file);
}
What you're saying is true but it has nothing to do with his case.
Reply
#4

Its BlueG's think. I will test later when I come home on PC.
Reply
#5

First part of OnDialogResponse:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_REGISTRATION)
    {
        if(response)
        {
            new string[256];
            if(!strlen(inputtext) || strlen(inputtext) > 100)
            {
                format(string,sizeof(string),"{FFFFFF}This User {FF9900}%s {FFFFFF}Is Not {FF0000}Registered {FFFFFF}On Server Yet!.\nPlease Enter A {FF9900}Password {FFFFFF}Below To Register It.\nOr Else You can Press The {FF0000}Quit {FFFFFF}Button To Quit the Server!",pName(playerid));
                ShowPlayerDialog(playerid,DIALOG_REGISTRATION, DIALOG_STYLE_INPUT, "{FFFFFF}Registeration Window",string,"Register","Cancel");
            }
            else if(strlen(inputtext) > 0 && strlen(inputtext) < 100)
            {
                new Pass[100];
                mysql_real_escape_string(inputtext, Pass);
                new query[400],Query_Main[2000], pname[24], IP[16];
                GetPlayerName(playerid, pname, 24);
                GetPlayerIp(playerid, IP, 16);
                new date,month,year;
                getdate(year,month,date);
                format(query, sizeof(query), "INSERT INTO Users(Name, Password, Score, Money, IP, Admin, Vip,NoGoto, PmEnabled, SkinInUse, SavedSkin, LoggedIn,Banned,BannedReason,BannedByAdmin,TempAdmin,TempAdminDay,TempAdminMonth,TempAdminYear,Forumslogged,LastOnDate,LastOnMonth,LastOnYear,RegisteredOnDate,RegisteredOnMonth,RegisteredOnYear,Freezed,FreezeTimer,Muted,MuteTimer) ");
                strcat(Query_Main,query);
                format(query,sizeof(query),"VALUES('%s', SHA1('%s'), 0, 0, '%s', 0 , 0 ,0 ,0 ,0 ,0, 1, 0,'No-Reason','No-Admin',0,0,0,0,0,%d,%d,%d,%d,%d,%d,0,0,0,0)", pname,Pass, IP,date,month,year,date,month,year);
                strcat(Query_Main,query);
                mysql_query(Query_Main);
                format(string,sizeof(string),"[:] You Have Successfully registered And loggedin to your account!");
                SendClientMessage(playerid,Red,string);
                pInfo[playerid][LoggedIn] = 1;
                pInfo[playerid][Registered] = 1;
                pInfo[playerid][SkinInUse] = 0;
                pInfo[playerid][Admin] = 0;
                pInfo[playerid][TempAdmin] = 0;
                pInfo[playerid][TempAdmDay] = 0;
                pInfo[playerid][TempAdmMonth] = 0;
                pInfo[playerid][TempAdmYear] = 0;
                pInfo[playerid][LastOnDate] = date;
                pInfo[playerid][LastOnMonth] = month;
                pInfo[playerid][LastOnYear] = year;
                pInfo[playerid][RegisteredDate] = date;
                pInfo[playerid][RegisteredMonth] = month;
                pInfo[playerid][RegisteredYear] = year;
                ServerInfo[TotalAccounts]++;
                format(query,sizeof(query),"UPDATE `Config` SET TotalAccounts = %d",ServerInfo[TotalAccounts]);
                mysql_query(query);
                format(string,sizeof(string),"[ACCREG]: %s Has Registered on the server making the total accounts as {F0F0F0}%d",pName(playerid),ServerInfo[TotalAccounts]);
                SendClientMessageToAll(Green,string);

            }
        }
        if(!response)
        {
            new string[256];
            format(string,sizeof(string),"{FFFFFF}This User {FF9900}%s {FFFFFF}Is Not {FF0000}Registered {FFFFFF}On Server Yet!.\nPlease Enter A {FF9900}Password {FFFFFF}Below To Register It.\nOr Else You can Press The {FF0000}Quit {FFFFFF}Button To Quit the Server!",pName(playerid));
            ShowPlayerDialog(playerid,DIALOG_REGISTRATION, DIALOG_STYLE_INPUT, "{FFFFFF}Registeration Window",string,"Register","Cancel");
        }
        return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)