SA-MP Forums Archive
About OnDialogResponse - 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: About OnDialogResponse (/showthread.php?tid=658488)



About OnDialogResponse - RedGun2015 - 05.09.2018

Hello, I have a question.

Today i'm looking at my server_log, and i see this:

Код:
[21:44:17] [debug] #0 0030b7d8 in public dialog_vehScript (playerid=4, response=1, listitem=-1, inputtext[]=@01abb9f8 "") at ../modules/a_vehicles.inc:328
I fixed the problem, because the listitem where -1, but is possible to be -1? I just have something like this in the dialog:

Код:
Dialog_Show(playerid, vehScript, DIALOG_STYLE_TABLIST_HEADERS, "Personal vehicles", "Car 1\nCar 2\nSpawn all your cars, "Select", "Exit");

Dialog:vehScript(playerid, response, listitem, inputtext[])
{
	if(response))
	{
		if(listitem < GetPlayerVehicles(playerid))
		{
			vehicleSelect[playerid] = vehiclePlayer[playerid][listitem]; // here was the error
                        // my stuff..
		}
		else
		{
			spawnallvehicles(playerid);
		}
	}
	return 1;
}
So, listitem can be -1? Or just using a hack or something?


Re: About OnDialogResponse - NaS - 05.09.2018

I don't know about easyDialog (I assume that is what you are using) but by default -1 shouldn't be a possible value for listitem.
However you should always add boundary checks for any player input because the info can be spoofed/changed in most cases, eg. Dialogs or clicked TextDraws.