Jump to content

matchtok.... pos... and other things i dont know how to do..


Xabache

Recommended Posts

I have the car ID

local carID = getAccountData (getPlayerAccount (source), "funmodev2-car") 

I have a list of available cars and prices...

local cars = {{579,60000},{400,60000},{404,28000},{489,65000},{505,65000},{479,45000},{442,45000},{458,45000},{602,50000},{496,42500},{401,41000},{518,60000},{527,75000},{589,75000},{419,45000},{533,75000},{526,50000},{474,55000},{545,50000},{517,45000},{410,41000},{600,50000},{436,41000},{580,50000},{439,75000},{549,75000},{491,45000},{445,45000},{507,45000},{585,45000},{587,75000},{466,55000},{492,50000},{546,45000},{551,45000},{516,45000},{467,45000},{426,47500},{547,45000},{405,55000},{409,75000},{550,45000},{566,45000},{540,45000},{421,50000},{529,45000},{402,120000},{542,65000},{603,120000},{475,75000},{562,120000},{565,95000},{559,120000},{561,50000},{560,120000},{558,100000},{429,120000},{541,120000},{415,120000},{480,95000},{434,100000},{494,120000},{502,120000},{503,120000},{411,120000},{506,120000},{451,120000},{555,95000},{477,95000},{499,25000},{498,25000},{578,50000},{486,70000},{455,75000},{588,50000},{403,75000},{414,50000},{443,75000},{515,75000},{514,75000},{531,12000},{456,45000},{422,45000},{482,95000},{530,12000},{418,45000},{572,12000},{582,50000},{413,50000},{440,50000},{543,65000},{583,12000},{478,35000},{554,50000},{536,75000},{575,75000},{534,75000},{567,75000},{535,75000},{576,75000},{412,75000},{568,75000},{457,12000},{483,45000},{508,40000},{571,10000},{500,55000},{444,120000},{556,120000},{557,120000},{471,20000},{495,100000},{539,75000},{581,45000},{462,12000},{521,60000},{463,50000},{522,75000},{448,12000},{468,45000},{586,45000},{485,12000},{431,60000},{438,45000},{437,60000},{574,12000},{420,45000},{525,75000},{408,50000},{428,65000}} 

I want to turn CarID, say 568 into its listed price of 75000 but do not know how to match or find isin within this string using lua. ideas?

Link to comment
  • Moderators
for i=1,#cars do  
   local carTable = cars[i] 
   if carTable[1] == carID then 
      outputChatBox("Price: " .. carTable[2]) 
      break 
   end 
end 

There are more possibility's to do this, but that depends about how you use this tables in other ways.

When you change the table you are able to use other ways.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...