Why listitem 2 doesn't work. Help w/dialog -
Luiiiiiiiii - 15.02.2017
When InGame i press the last option (listitem 2) it doesnt work. why?.
sorry for my english, like u can see my main language is spanish
Код:
if(dialogid == DIALOGPTIENDA) {
if(response) {
if(listitem == 0) {
if(Peces[playerid] == 0) { SendClientMessage(playerid, COLOR_RED, "ЎNo tienes peces para vender!"); } else {
new msg[128];
format(msg, sizeof(msg), "Otorgas la bolsa de peces al vendedor, en total hay %d, la unidad cuesta 250$, asi que haz ganado en total: %d", Peces[playerid], Peces[playerid]*250);
SendClientMessage(playerid, COLORPOS, msg);
GivePlayerMoney(playerid, 250*Peces[playerid]);}
}
if(listitem == 1) {
if(GetPlayerMoney(playerid) >= 1500) {
SendClientMessage(playerid, COLORPOS, "Haz comprado una caсa. Esta no es de muy buena calidad, se rompe en unas cuantas horas ((Al desconectarse))");
TieneCana[playerid] = 1;
GivePlayerMoney(playerid, -1500); }
else { SendClientMessage(playerid, COLOR_RED, "No tienes suficiente dinero (1500$) para comprar una caсa."); }
if(listitem == 2) {
if(GetPlayerMoney(playerid) >= 500) {
new msg[128];
format(msg, sizeof(msg), "Haz comprado un pack de cebos. Cada vez que los tires al mar no servirбn mбs. Tienes actualmente %d cebos.", TieneCebo[playerid]);
SendClientMessage(playerid, COLORPOS, msg);
TieneCebo[playerid] = TieneCebo[playerid]+5;
GivePlayerMoney(playerid, -500); }
else { SendClientMessage(playerid, COLOR_RED, "no tienes suficiente dinero (500$) para comprar cebo."); }
}
}
}
if(!response) {
SendClientMessage(playerid, COLORPOS, "Cancelaste el dialogo."); }
}
Re: Why listitem 2 doesn't work. Help w/dialog -
FaLLenGirL - 15.02.2017
Show us the command that shows you the dialog.
Re: Why listitem 2 doesn't work. Help w/dialog -
Luiiiiiiiii - 15.02.2017
Quote:
Originally Posted by FaLLenGirL
Show us the command that shows you the dialog.
|
Код:
if(!strcmp(cmd,"/ptienda",true)) {
if(IsPlayerInRangeOfPoint(playerid,5, 400.0271,-2067.7073,10.7887))
{
ShowPlayerDialog(playerid, DIALOGPTIENDA, DIALOG_STYLE_LIST, "Tienda de Pesca.", "Vender Peces(todos)\nComprar Caсa\t(1)\t1500$\nComprar Cebo\t(5)\t 500$\n", "ACEPTAR", "CANCELAR");
}
else
{
SendClientMessage(playerid, COLOR_RED, "No estбs en la tienda de pesca.");
}
return 1;
}
Re: Why listitem 2 doesn't work. Help w/dialog -
FaLLenGirL - 15.02.2017
Delete please, i saw wrong.
Re: Why listitem 2 doesn't work. Help w/dialog -
Vince - 15.02.2017
Indent properly, please. And use a proper indentation style. Either you use K&R or you use Allman but not a mix of both. This makes the code very confusing to read.
Re: Why listitem 2 doesn't work. Help w/dialog -
Luiiiiiiiii - 15.02.2017
idk what i did, but i took the advice by @Vince and i did this and now its work. So thanks u all for trying to help

have a nice day
Код:
if(dialogid == DIALOGPTIENDA)
{
if(response)
{
switch(listitem)
{
case 0: // vender todos los peces
{
if(Peces[playerid] == 0)
{
SendClientMessage(playerid, COLOR_RED, "No tienes peces para vender.");
}
else
{
new msg[128];
format(msg, sizeof(msg), "Tienes %d peces, cada pez se vende a 250$. Los vendes todos y el cajero te da: %d$.", Peces[playerid], Peces[playerid]*250);
GivePlayerMoney(playerid, Peces[playerid]*250);
Peces[playerid] = 0;
}
}
case 1: // caсa
{
if(GetPlayerMoney(playerid) >= 1500)
{
TieneCana[playerid] = 1;
SendClientMessage(playerid, COLORPOS, "Haz comprado una caсa de pescar por 1500$.");
GivePlayerMoney(playerid, -1500);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ЎNo tienes 1500$ para comprar una caсa de pescar!");
}
}
case 2: // cebo
{
if(GetPlayerMoney(playerid) >= 500)
{
TieneCebo[playerid] += 5;
new msg[128];
format(msg, sizeof(msg), "Haz comprado 5 cebos. Tienes ahora %d", TieneCebo[playerid]);
SendClientMessage(playerid, COLORPOS, msg);
GivePlayerMoney(playerid, -500);
}
else
{
SendClientMessage(playerid, COLOR_RED, "ЎNo tienes 500$ para comprar una bolsa de cebo!");
}
}
}
}
}