28.01.2015, 19:02
Okay, so i am having a issue with DIALOG_STYLE_MSGBOX. I wonder how i can do something like "Case's" or listitem for it. Or should it be done in another way?
if(dialogid == 6774)
{
if(response)
{
if(listitem == 0) //Cars
{
ShowPlayerDialogEx(playerid, DIALOG_SALOONS, DIALOG_STYLE_LIST, "Choose a car you would like to buy","Bravura\nSentinel","Buy/Preview", "Cancel");
}
}
}
if(dialogid == DIALOG_CARS)
{
if(response)
{
switch(listitem)
{
case 0:
{
if (GetPlayerCash(playerid) >= 3000)
{
GivePlayerCash(playerid, -3000);
new playervehicleid = GetPlayerFreeVehicleId(playerid);
CreatePlayerVehicle(playerid, playervehicleid, 401, 2172.1597,1391.7802,10.8203, 90.0000, 0, 0, 0);
SendClientMessage(playerid, COLOR_GRAD1, "You have bought a bravura");
VehicleSpawned[playerid] = 1;
TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
return 1;
}
else
{
TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
SendClientMessage(playerid, COLOR_GRAD1, "You don't have enough money");
}
}
case 1:
{
if (GetPlayerCash(playerid) >= 10000)
{
GivePlayerCash(playerid, -10000);
new playervehicleid = GetPlayerFreeVehicleId(playerid);
CreatePlayerVehicle(playerid, playervehicleid, 405, 2172.1597,1391.7802,10.8203, 90.0000, 0, 0, 0);
SendClientMessage(playerid, COLOR_GRAD1, "You have bought a Sentinel");
VehicleSpawned[playerid] = 1;
TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
return 1;
}
else
{
TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
SendClientMessage(playerid, COLOR_GRAD1, "You don't have enough money");
}
}
}
}
else
TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
//ShowPlayerDialogEx(playerid, 6774, DIALOG_STYLE_LIST, "Choose a car you would like to buy","Bravura\nSentinel","Buy/Preview", "Cancel");
}
if(dialogid == DIALOG_SALOONS)
{
if(response)
{
switch(listitem)
{
case 0: // Bravura
{
TextDrawShowForPlayer(playerid, TDEditor_TD[0]);
ShowPlayerDialogEx(playerid,DIALOG_CONVERT,DIALOG_STYLE_MSGBOX,"Are you sure?","Do you wanna buy this Bravura\nPrice: $3,000","Buy","Cancel");
}
case 1: // Sentinel
{
TextDrawShowForPlayer(playerid, TDEditor_TD[1]);
ShowPlayerDialogEx(playerid,DIALOG_CONVERT,DIALOG_STYLE_MSGBOX,"Are you sure?","Do you wanna buy this Sentinel\nPrice: $10,000","Buy","Cancel");
}
}
}
else
TextDrawHideForPlayer(playerid, TDEditor_TD[0]);
TextDrawHideForPlayer(playerid, TDEditor_TD[1]);
}