SA-MP Forums Archive
Array help again. . . - 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: Array help again. . . (/showthread.php?tid=170152)



Array help again. . . - CoaPsyFactor - 22.08.2010

hi there, i have one more question for array
pawn Код:
enum BuyAbleVehicleInfo{
    Model,
    Name[32],
    Price

}
//Buyable vehicles
new buyablevehicles[][BuyAbleVehicleInfo] = {
    {400, "Landstalker", 15000},
    {401, "Bravura", 10000},
    {402, "Buffalo", 70000},
    {404, "Perenniel", 8000}
}
now how to do if someone want to buy vehicle with Model ID 402, how to get Price form Array that Model ID is 402?


Re: Array help again. . . - dax123 - 22.08.2010

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
hi there, i have one more question for array
pawn Код:
enum BuyAbleVehicleInfo{
    Model,
    Name[32],
    Price

}
//Buyable vehicles
new buyablevehicles[][BuyAbleVehicleInfo] = {
    {400, "Landstalker", 15000},
    {401, "Bravura", 10000},
    {402, "Buffalo", 70000},
    {404, "Perenniel", 8000}
}
now how to do if someone want to buy vehicle with Model ID 402, how to get Price form Array that Model ID is 402?
the simple way to get this is using iteration.
but if you concerned about CPU usage, you need to use more memory.