21.05.2015, 14:35
no. i have aldready set it to 0 at first. i made this timer to check if he/or she enter the business areas, if he is in then the value is i(value of the business). so the command /buy will show the right dialog with the i as the id of the business. but when he is not in the business areaes then the value return 0. /buy should not work.
here is the/buy command
and all the business is saved in .ini files thats why i need to make it like this
here is the/buy command
Код:
command(buy, playerid, params[]) { #pragma unused params if(Businesses[Player[playerid][InBusiness]][bType] == 1) { new string[160], price1 = Businesses[Player[playerid][InBusiness]][bProductPrice1]; new price2 = Businesses[Player[playerid][InBusiness]][bProductPrice2]; new price3 = Businesses[Player[playerid][InBusiness]][bProductPrice3]; new price4 = Businesses[Player[playerid][InBusiness]][bProductPrice4]; new price5 = Businesses[Player[playerid][InBusiness]][bProductPrice5]; // new price6 = Businesses[Player[playerid][InBusiness]][bProductPrice6]; new price7 = Businesses[Player[playerid][InBusiness]][bProductPrice7]; new price8 = Businesses[Player[playerid][InBusiness]][bProductPrice8]; // new price9 = Businesses[Player[playerid][InBusiness]][bProductPrice9]; format(string, sizeof(string), "Rope ($%d)\nRags ($%d)\nPhone ($%d)\nPhonebook ($%d)\nBottle o' Sprunk ($%d)\nSpraycan ($%d)\nWalkie Talkie ($%d)", price1, price2, price3, price4, price5, price7, price8); ShowPlayerDialog(playerid, 631, DIALOG_STYLE_LIST, "Select the product you wish to purchase.", string, "Purchase", "Cancel"); } else if(Businesses[Player[playerid][InBusiness]][bType] == 11) { new string[128]; format(string, sizeof(string), "5 grams of Pot ($%d)\n5 grams of Cocaine ($%d)", Businesses[Player[playerid][InBusiness]][bProductPrice1], Businesses[Player[playerid][InBusiness]][bProductPrice2]); ShowPlayerDialog(playerid, 8561, DIALOG_STYLE_LIST, "Select the product you wish to purchase.", string, "Purchase", "Cancel"); } else if(Businesses[Player[playerid][InBusiness]][bType] == 12) { new string[128]; new price1 = Businesses[Player[playerid][InBusiness]][bProductPrice1]; new price2 = Businesses[Player[playerid][InBusiness]][bProductPrice2]; new price3 = Businesses[Player[playerid][InBusiness]][bProductPrice3]; format(string, sizeof(string), "Sprunk ($%d)\nVegetarian Surprise ($%d)\nMeat Feast Pizza ($%d)\n", price1, price2, price3); ShowPlayerDialog(playerid, 81, DIALOG_STYLE_LIST, "Select the product you wish to purchase.", string, "Purchase", "Cancel"); } else if(Businesses[Player[playerid][InBusiness]][bType] == 5) { new string[135]; new price1 = Businesses[Player[playerid][InBusiness]][bProductPrice1]; new price2 = Businesses[Player[playerid][InBusiness]][bProductPrice2]; new price3 = Businesses[Player[playerid][InBusiness]][bProductPrice3]; new price4 = Businesses[Player[playerid][InBusiness]][bProductPrice4]; new price5 = Businesses[Player[playerid][InBusiness]][bProductPrice5]; new price6 = Businesses[Player[playerid][InBusiness]][bProductPrice6]; new price7 = Businesses[Player[playerid][InBusiness]][bProductPrice7]; format(string, sizeof(string), "Rope ($%d)\nSmall White Vibrator ($%d)\nSilver Vibrator ($%d)\nLarge White Vibrator ($%d)\nPriest ($%d)\nNaughty Girl Cop Costume ($%d)\nCat Woman Costume ($%d)", price1, price2, price3, price4, price5, price6, price7); ShowPlayerDialog(playerid, 257, DIALOG_STYLE_LIST, "Select the product you wish to purchase.", string, "Purchase", "Cancel"); } return 1; }