Dialog crashes my server
#1

Hello!

I have a filterscript with this code:
Код:
//Definitions somewhere upper
#define D_SALON          4441
#define D_INFO           4442

//Public OnDialogResponse
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == D_SALON)
	{
	    if(!response)
	        return 1;
		if(inputtext[0] == 'B') //Brak pojazdуw
		    return 1;
		    
		new strModel[5], vehicleModel, vehiclePrice;
		strmid(strModel, inputtext, 0, strfind(inputtext, ":", true)-1);
		vehicleModel = strval(strModel);
		vehiclePrice = GetVehiclePrice(GetPVarInt(playerid, "PQuisVeh_SalonID"), vehicleModel);
		
		if(CountPlayerVehicles(playerid) >= MAX_PLAYER_VEHICLES)
			ShowPlayerDialog(playerid, D_INFO, DIALOG_STYLE_MSGBOX, "Salon pojazdуw", "Nie możesz posiadać więcej pojazdуw.", "OK", "");
		else if(CheckPlayerMoney(playerid) < vehiclePrice)
		    ShowPlayerDialog(playerid, D_INFO, DIALOG_STYLE_MSGBOX, "Salon pojazdуw", "Nie stać Cię na zakup tego pojazdu.", "OK", "");
		else
		{
		    AddVehicle(vehicleModel, playerid);
		    SetPlayerMoney(playerid, CheckPlayerMoney(playerid)-vehiclePrice);
		    SendClientMessage(playerid, C_SUCCESS, "Kupiłeś pojazd! Jak najszybciej go przeparkuj używając komendy /zaparkuj");
		}
		return 1;
	}
	return 0;
}
And these two dialogs:
Код:
ShowPlayerDialog(playerid, D_INFO, DIALOG_STYLE_MSGBOX, "Salon pojazdуw", "Nie możesz posiadać więcej pojazdуw.", "OK", "");
ShowPlayerDialog(playerid, D_INFO, DIALOG_STYLE_MSGBOX, "Salon pojazdуw", "Nie stać Cię na zakup tego pojazdu.", "OK", "");
Crashes my server after I click button "OK". There is no collisions with other dialog IDs, from other scripts or gamemode. Can somebody help me, please?
Reply
#2

Load crashdetect plugin: https://github.com/Zeex/samp-plugin-...ases/tag/v4.13

Compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info

Re-compile, start the server, show the dialog and click "OK". If it crashes the server again, then post what it printed.
Reply
#3

Logs:
Код:
[20:24:40] [debug] Server crashed while executing truck.amx
[20:24:40] [debug] AMX backtrace:
[20:24:40] [debug] #0 native CallLocalFunction () [00471ef0] from samp-server.exe
[20:24:40] [debug] #1 00001b7c in public OnDialogResponse (playerid=0, dialogid=4442, response=1, listitem=-1, inputtext[]=@0x00002aec "") at D:\Dawid\SA-MP\Programy\Pawno\include\QuisRegister.inc:466
[20:24:45] [debug] Native backtrace:
[20:24:45] [debug] #0 004721bc in ?? () from samp-server.exe
[20:24:45] [debug] #1 004010b6 in ?? () from samp-server.exe
[20:24:45] [debug] #2 766a58ca in ?? () from plugins\crashdetect.DLL
[20:24:45] [debug] #3 766a774f in ?? () from plugins\crashdetect.DLL
[20:24:45] [debug] #4 766a0834 in ?? () from plugins\crashdetect.DLL
[20:24:45] [debug] #5 766a591a in ?? () from plugins\crashdetect.DLL
[20:24:45] [debug] #6 0046dac1 in ?? () from samp-server.exe
[20:24:45] [debug] #7 00452850 in ?? () from samp-server.exe
[20:24:45] [debug] #8 766a591a in ?? () from plugins\crashdetect.DLL
[20:24:45] [debug] #9 0046d840 in ?? () from samp-server.exe
[20:24:45] [debug] #10 00498cc9 in ?? () from samp-server.exe
[20:24:45] [debug] #11 0045b26a in ?? () from samp-server.exe
[20:24:45] [debug] #12 7711d12e in ?? () from C:\WINDOWS\SYSTEM32\ntdll.dll
This code crashed:
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
        //some code
	if(funcidx("quisreg_OnDialogResponse") != -1)
	{
		return CallLocalFunction("quisreg_OnDialogResponse", "dddds", playerid, dialogid, response, listitem, inputtext);
	}
	return 0;
}
#if defined _ALS_OnDialogResponse
    #undef OnDialogResponse
#else
    #define _ALS_OnDialogResponse
#endif
#define OnDialogResponse quisreg_OnDialogResponse
forward quisreg_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
Is there a way to fix this?

@EDIT
Oh, i know now. There is resolve: https://sampwiki.blast.hk/wiki/CallLocalFunction
inputtext is empty :X

Thanks for help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)