07.08.2016, 16:43
No funciona el comando y antes si, cuбl es el error?
Errores
Errores
Код:
[21:50:04] [debug] Run time error 4: "Array index out of bounds" [21:50:04] [debug] Accessing element at negative index -1 [21:50:04] [debug] AMX backtrace: [21:50:04] [debug] #0 000b6be0 in public cmd_comprar (0, 7950824) from bare.amx [21:50:04] [debug] #1 native CallLocalFunction () from samp-server.exe [21:50:04] [debug] #2 0006d1d0 in public OnPlayerCommandText (0, 7950764) from bare.amx
Код:
CMD:comprar(playerid, params[]) { if(sscanf(params, "s[32]", params[0])) return SendClientMessage(playerid, COLOR_PIEL, "* Debes indicar parбmetros para el comando(/comprar), ejemplo: /comprar productos."); if(strfind(params[0], "comida", true) != -1) { for(new n = 0; n < sizeof(InformacionNegocio_); n++) { new string[290]; if(InformacionJugador_[playerid][pEnNegocio] == -1) return SendClientMessage(playerid, COLOR_ROJO, "* No estбs en ningъn negocio."); if(!EstaEnMostrador(playerid)){SendClientMessage(playerid, COLOR_ROJO, "* Debes estar en un mostrador para usar este comando."); return 1;} if(InformacionNegocio_[n][nTipo] == 0) { format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"The Little(+10 HAMBRE)\t%d\t"#CVERDE"12$\n\ "#CBLANCO"Cluker(+12 HAMBRE)\t-\t"#CVERDE"18$\n\ "#CBLANCO"Kids Meal(+16 HAMBRE)\t-\t"#CVERDE"36$\n\ "#CBLANCO"Especial Bell(+30 HAMBRE)\t-\t"#CVERDE"60$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdSolidos]); ShowPlayerDialog(playerid, DIALOG_CUCKLIN, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Cucklin Bell", string, "Comprar", "Cancelar"); return 1; } else if(InformacionNegocio_[n][nTipo] == 1) { format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"The Bustert(+12 HAMBRE)\t%d\t"#CVERDE"14$\n\ "#CBLANCO"The Double D-Lux(+18 HAMBRE)\t-\t"#CVERDE"20$\n\ "#CBLANCO"Pizza(+50 HAMBRE)\t-\t"#CVERDE"70$\n\ "#CBLANCO"The Full Rack(+40 HAMBRE)\t-\t"#CVERDE"60$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdSolidos]); ShowPlayerDialog(playerid, DIALOG_PIZZA, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Pizza Stack", string, "Comprar", "Cancelar"); return 1; } else if(InformacionNegocio_[n][nTipo] == 2) { format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"Almuerzo(+60 HAMBRE)\t%d\t"#CVERDE"80$\n\ "#CBLANCO"Cena(+65 HAMBRE)\t-\t"#CVERDE"85$\n\ "#CBLANCO"Cafй(+10 SED)\t%d\t"#CVERDE"15$\n\ "#CBLANCO"Postre(+40 HAMBRE)\t-\t"#CVERDE"30$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdSolidos], InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdLiquidos]); ShowPlayerDialog(playerid, DIALOG_REST, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Restaurante", string, "Comprar", "Cancelar"); return 1; } else if(InformacionNegocio_[n][nTipo] == 5) { format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"Buckshot(+50 HAMBRE)\t%d\t"#CVERDE"70$\n\ "#CBLANCO"Pollo Bits(+45 HAMBRE)\t-\t"#CVERDE"65$\n\ "#CBLANCO"Fillete(+30 HAMBRE)\t-\t"#CVERDE"40$\n\ "#CBLANCO"Parilla(+80 HAMBRE)\t-\t"#CVERDE"90$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdSolidos]); ShowPlayerDialog(playerid, DIALOG_BURGER, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Burger Shot", string, "Comprar", "Cancelar"); return 1; } } } else if(strfind(params[0], "bebidas", true) != -1) { for(new n = 0; n < sizeof(InformacionNegocio_); n++) { if(InformacionJugador_[playerid][pEnNegocio] == -1) return SendClientMessage(playerid, COLOR_ROJO, "* No estбs en ningъn negocio."); if(!EstaEnMostrador(playerid)){SendClientMessage(playerid, COLOR_ROJO, "* Debes estar en un mostrador para usar este comando."); return 1;} if(InformacionNegocio_[n][nTipo] == 3) { new string[290]; format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"Sprunk(+30 SED)\t%d\t"#CVERDE"40$\n\ "#CBLANCO"Refresco(+55 SED)\t-\t"#CVERDE"60$\n\ "#CBLANCO"Cerveza(+20 SED)\t-\t"#CVERDE"30$\n\ "#CBLANCO"Vodka(+60 SED)\t-\t"#CVERDE"65$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdLiquidos]); ShowPlayerDialog(playerid, DIALOG_BAR, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Bar", string, "Comprar", "Cancelar"); return 1; } } } else if(strfind(params[0], "donas", true) != -1) { for(new n = 0; n < sizeof(InformacionNegocio_); n++) { if(InformacionJugador_[playerid][pEnNegocio] == -1) return SendClientMessage(playerid, COLOR_ROJO, "* No estбs en ningъn negocio."); if(!EstaEnMostrador(playerid)){SendClientMessage(playerid, COLOR_ROJO, "* Debes estar en un mostrador para usar este comando."); return 1;} if(InformacionNegocio_[n][nTipo] == 4) { new string[290]; format(string, sizeof(string), "Producto\tStock\tPrecio\n\ "#CBLANCO"1 Caja de Donas(+15 HAMBRE)\t%d\t"#CVERDE"20$\n\ "#CBLANCO"2 Cajas de Donas(+20 HAMBRE)\t-\t"#CVERDE"25$\n\ "#CBLANCO"4 Cajas de Donas(+30 HAMBRE)\t-\t"#CVERDE"30$\n\ "#CBLANCO"Cafй(+10 SED)\t%d\t"#CVERDE"15$", InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdSolidos], InformacionNegocio_[InformacionJugador_[playerid][pNegocio]][nProdLiquidos]); ShowPlayerDialog(playerid, DIALOG_DONAS, DIALOG_STYLE_TABLIST_HEADERS, ""CAZUL"Donas", string, "Comprar", "Cancelar"); return 1; } } } return 1; }