About OnDialogResponse
#1

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?
Reply
#2

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)