04.10.2014, 12:20
Hi, on my thread I was suggested to use an enum instead. So I've tried this,
I'm getting the error
I don't reguarly use enums so I'm not quite sure what I'm doing wrong here. Any help appreciated.
Код:
enum prices { colt = 150, deagle = 300, pumpshotgun = 350, combatshotgun = 500, mp5 = 420, tec9 = 400, ak47 = 700, m4 = 700, sniper = 1000, countryrifle = 850, armour = 500, parachute = 210 } new WPrices[prices];
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { new buylist1[100],buylist2[100],buylist3[100],buylist4[100],buylist5[100],buylist6[100]; format(buylist1,sizeof(buylist1),"Colt-45 {4ECC47}[$%i]\nDesert Eagle {4ECC47}[$%i]",colt,deagle); format(buylist2,sizeof(buylist2),"Pump Shotgun {4ECC47}[$%i]\nCombat Shotgun {4ECC47}[$%i]",pumpshotgun,combatshotgun); format(buylist3,sizeof(buylist3),"MP5 {4ECC47}[$%i]\nTec-9 {4ECC47}[$%i]",mp5,tec9); format(buylist4,sizeof(buylist4),"AK47 {4ECC47}[$%i]\nM4 {4ECC47}[$%i]",ak47,m4); format(buylist5,sizeof(buylist5),"Sniper Rifle {4ECC47}[$%i]\nCountry Rifle {4ECC47}[$%i]",sniper,countryrifle); format(buylist6,sizeof(buylist6),"Armour {4ECC47}[$%i]\nParachute {4ECC47}[$%i]",armour,parachute); if(dialogid == 0) { if(response) { switch(listitem) { case 0: ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Pistols",buylist1,"Buy",""); case 1: ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Shotguns",buylist2,"Buy",""); case 2: ShowPlayerDialog(playerid, 3, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Submachine gun",buylist3,"Buy",""); case 3: ShowPlayerDialog(playerid, 4, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Assault",buylist4,"Buy",""); case 4: ShowPlayerDialog(playerid, 5, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Rifles",buylist5,"Buy",""); case 5: ShowPlayerDialog(playerid, 6, DIALOG_STYLE_LIST, "{008CFF}Weapon Shop - Extras",buylist6,"Buy",""); } } } if(dialogid == 1) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[colt]) { GivePlayerMoney(playerid, -WPrices[colt]); GivePlayerWeapon(playerid, WEAPON_COLT45, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[deagle]) { GivePlayerMoney(playerid, -WPrices[deagle]); GivePlayerWeapon(playerid, WEAPON_DEAGLE, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } if(dialogid == 2) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[pumpshotgun]) { GivePlayerMoney(playerid, -WPrices[pumpshotgun]); GivePlayerWeapon(playerid, WEAPON_SHOTGUN, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[combatshotgun]) { GivePlayerMoney(playerid, -WPrices[combatshotgun]); GivePlayerWeapon(playerid, WEAPON_SHOTGSPA, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } if(dialogid == 3) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[mp5]) { GivePlayerMoney(playerid, -WPrices[mp5]); GivePlayerWeapon(playerid, WEAPON_MP5, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[tec9]) { GivePlayerMoney(playerid, -WPrices[tec9]); GivePlayerWeapon(playerid, WEAPON_TEC9, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } if(dialogid == 4) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[ak47]) { GivePlayerMoney(playerid, -WPrices[ak47]); GivePlayerWeapon(playerid, WEAPON_AK47, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[m4]) { GivePlayerMoney(playerid, -WPrices[m4]); GivePlayerWeapon(playerid, WEAPON_M4, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } if(dialogid == 5) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[sniper]) { GivePlayerMoney(playerid, -WPrices[sniper]); GivePlayerWeapon(playerid, WEAPON_SNIPER, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[countryrifle]) { GivePlayerMoney(playerid, -WPrices[countryrifle]); GivePlayerWeapon(playerid, WEAPON_RIFLE, 99999); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } if(dialogid == 6) { if(response) { switch(listitem) { case 0: { if(GetPlayerMoney(playerid) >= WPrices[armour]) { GivePlayerMoney(playerid, -WPrices[armour]); SetPlayerArmour(playerid, 100); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } case 1: { if(GetPlayerMoney(playerid) >= WPrices[parachute]) { GivePlayerMoney(playerid, -WPrices[parachute]); GivePlayerWeapon(playerid, WEAPON_PARACHUTE, 1); }else SendClientMessage(playerid, -1, "{FFFF00}[Info] {808080}You do not have enough money."); } } } } return 1; }
Quote:
-- : error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices")--: error 032: array index out of bounds (variable "WPrices")-- : error 032: array index out of bounds (variable "WPrices") --(45 : error 032: array index out of bounds (variable "WPrices") |