Jump to content

About Vehicle Handling


SkatCh

Recommended Posts

Bro i know those function but i'm asking how to store vehicle handling data inside table.

i tried this but i don't know if it's working or not because i didn't test it yet:

for i, hand in ipairs (getVehicleHandling(theVehicle)) do 
                if handling == "" then 
                    handling = hand 
                else 
                    handling = handling..","..hand 
                end 
            end 

Link to comment

thx bro for your help but i need it with sql and i know how to do it ; but tell me is this correct ,

-- when the player destroy the car

local handling == "" 
  
for i, hand in ipairs (getVehicleHandling(theVehicle)) do 
                if handling == "" then 
                    handling = hand 
                else 
                    handling = handling..","..hand 
                end 
end 

Link to comment

At first line you have two == but you suppose to have one only. Also the table isn't numeric index therefore you should use pairs instead of ipairs. Moreover the property centerOfMass is returned in table so you have table inside table.

Link to comment

Yeh exactly that's why i want as you said i need to use to two table but the problem i don't which the proprety , wich is the value. can you help me make it ;

this is my try you mean like this

local handling = "" 
  
for i, hand in pairs (getVehicleHandling(theVehicle)) do 
   for i, v in pairs (hand) do 
               
      end 
end 

Link to comment

I just wonder what wrong with JSON?

You don't need any kind of variable to make the string. JSON will convert the table to string already all you have to do is to store the string into account data or file or xml or even db.

Link to comment

Create a db table with two columns one for the account name and another for the table string.

toJSON -- convert table to string. 
fromJSON -- convert string to table again. 

toJSON -- > from table to string 
fromJSON -- > from string to table 

Link to comment
At first line you have two == but you suppose to have one only. Also the table isn't numeric index therefore you should use pairs instead of ipairs. Moreover the property centerOfMass is returned in table so you have table inside table.
Link to comment
local hTable = getVehicleHandling(vehicle) 
local hString = toJSON(hTable) 
setAccountData(account, "Handling", hString) 
  
------------------------------ 
  
local hString = getAccountData(account, "Handling") 
local hTable = fromJSON(hString) 
  
for property, value in pairs(hTable) do 
    setVehicleHandling(vehicle, property, value) 
end 

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...