Need help with arrays.
#1

hi all i have 1 question, if i have
pawn Код:
new buyablevehicles[][32] = {
    {400, "Landstalker", 15000}
};
how to get 400, then "Landstalker", and then 15000?
Reply
#2

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
hi all i have 1 question, if i have
pawn Код:
new buyablevehicles[][32] = {
    {400, "Landstalker", 15000}
};
how to get 400, then "Landstalker", and then 15000?
1. use enumeration

enum Vehicleinfo ( size 34 - variable structure )
{
Model, //array 0
Name[32], //array 1-32
Price //array 33
}
new buyablevehicles[][Vehicleinfo] =
{
{400, "Landstalker", 15000},
{493, "bmx", 1500}
}

and you can refer it with buyablevehicles[Model], (or buyablevehicles[Vehicleinfo:0] )
buyablevehicles[Name], buyablevehicles[Price]

this is the best way to implement the requested feature ( as far as I know ) Thanks.
Reply
#3

Quote:
Originally Posted by dax123
Посмотреть сообщение
1. use enumeration

enum Vehicleinfo ( size 34 - variable structure )
{
Model, //array 0
Name[32], //array 1-32
Price //array 33
}
new buyablevehicles[][Vehicleinfo] =
{
{400, "Landstalker", 15000},
{493, "bmx", 1500}
}

and you can refer it with buyablevehicles[Model], (or buyablevehicles[Vehicleinfo:0] )
buyablevehicles[Name], buyablevehicles[Price]

this is the best way to implement the requested feature ( as far as I know ) Thanks.
THANKS A LOT MAN!!!! I was looking for answer over one month . . . . i owe you, your name will be in credits
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)