array index out of bounds
#4

Quote:
Originally Posted by ATomas
Посмотреть сообщение
pawn Код:
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];
rewrite to:
pawn Код:
enum prices
{
    coltm
    deaglem
    pumpshotgunm
    combatshotgunm
    mp5m
    tec9m
    ak47m
    m4m
    sniperm
    countryriflem
    armourm
    parachute
}

new WPrices[prices] = {
    150,
    300,
    350,
    500,
    420,
    400,
    700,
    700,
    1000,
    850,
    500,
    210
};
and this
pawn Код:
format(buylist1,sizeof(buylist1),"Colt-45 {4ECC47}[$%i]\nDesert Eagle {4ECC47}[$%i]",colt,deagle);
rewrite to:
pawn Код:
format(buylist1,sizeof(buylist1),"Colt-45 {4ECC47}[$%i]\nDesert Eagle {4ECC47}[$%i]",WPrices[colt],WPrices[deagle]);
etc...
Can you please explain why I need to make 2 sections, I'm trying to learn how I can combat the error in the future.
Reply


Messages In This Thread
array index out of bounds - by Pawnify - 04.10.2014, 12:20
Re: array index out of bounds - by Pawnify - 04.10.2014, 13:41
Re: array index out of bounds - by ATomas - 04.10.2014, 13:45
Re: array index out of bounds - by Pawnify - 04.10.2014, 13:52
Re: array index out of bounds - by mamorunl - 04.10.2014, 14:20
Re: array index out of bounds - by ATomas - 04.10.2014, 18:34

Forum Jump:


Users browsing this thread: 1 Guest(s)