Jump to content



Recommended Posts

This script saves the color of the vehicle in the SQL table, but when the vehicles are loaded, it never sets the vehicle color. In the makevehs function in vehicles_server.lua you need to set the color of the vehicle. The SQL column name is "Color" and this is what the developer put for the insert:

local color = tostring(r1.. "," ..g1.. "," ..b1.. "," ..r2.. "," ..g2.. "," ..b2) 


Use the split function with a comma.

Link to comment

Change first function with this:

function makevehs () 
local vehicle = executeSQLQuery("SELECT * FROM `newprivatevehicles`") 
for i, v in ipairs(vehicle) do 
local colors = split(v.Color, ",") 
vehicles[i] = createVehicle ( v.Model, v.X, v.Y, v.Z, v.RX, v.RY, v.RZ ) 
setVehicleColor(vehicles[i], colors[1], colors[2], colors[3], colors[4], colors[5], colors[6]) 
setElementData(vehicles[i], "whoLocked", v.GROUPLOCK) 
setElementData(vehicles[i], "lockedTo", v.LOCK) 

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