public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch(1337) { case 1: { if(!response) { SendClientMessage(playerid, 0xFF0000FF, "You cancelled."); return 1; // We processed it } switch(3) // This is far more efficient than using an if-elseif-else structure { case 0: // Listitems start with 0, not 1 { GetPlayerPos(playerid, x, y, z); CreateVehicle(603, x, y, z, 0, -1, -1, 60); SendClientMessage(playerid, red, "You have spawned a Phoenix ID: 603"); } case 1: { GetPlayerPos(playerid, x, y, z); CreateVehicle(506, x, y, z, 0, -1, -1, 60); } case 2: { GetPlayerPos(playerid, x, y, z); CreateVehicle(532, x, y, z, 0, -1, -1, 60); } // Add the rest of your listitems for dialog 1 here } } // Add the rest of your dialogs here } return 1; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.). }
CMD:vehlist(playerid, params[]) { ShowPlayerDialog(playerid, 1337, DIALOG_STYLE_LIST, "Vehicle List:", "603\tPhoenix\n503\tHotring B\n532\tCombine Harvestor\n588\tHotdog\n403\tLinerunner\n462\tFaggio\n468\tSanchez\n432\tRhino\n520\tHydra\n425\tHunter", "OK", "Exit"); // SendClientMessage(playerid, red, "Veh list: Phoenix 603 Hotring B 503 Combine Harvestor 532 Hotdog 588 Linerunner 403 Faggio 462 Sanchez 468 Rhino 432 Hydra 520"); // SendClientMessage(playerid, red, "Hunter 425"); return 1; }
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 1337)
{
if(!response)
{
SendClientMessage(playerid, 0xFF0000FF, "You cancelled.");
return 1; // We processed it
}
if(response)
{
switch(listitem) // This is far more efficient than using an if-elseif-else structure
{
case 0: // Listitems start with 0, not 1
{
GetPlayerPos(playerid, x, y, z);
CreateVehicle(603, x, y, z, 0, -1, -1, 60);
SendClientMessage(playerid, red, "You have spawned a Phoenix ID: 603");
}
case 1:
{
GetPlayerPos(playerid, x, y, z);
CreateVehicle(506, x, y, z, 0, -1, -1, 60);
}
case 2:
{
GetPlayerPos(playerid, x, y, z);
CreateVehicle(532, x, y, z, 0, -1, -1, 60);
}
}
}
}
return 1; // If you put return 1 here the callback will not continue to be called in other scripts (filterscripts, etc.).
}
You need to use 'else' after the if(!response) and not 'if(response)'
|