Need help with arrays. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need help with arrays. (
/showthread.php?tid=170146)
Need help with arrays. -
CoaPsyFactor - 22.08.2010
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?
Re: Need help with arrays. -
dax123 - 22.08.2010
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.
Re: Need help with arrays. -
CoaPsyFactor - 22.08.2010
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