Mike269 Posted February 12, 2015 Share Posted February 12, 2015 Hello guys I need help with this script: https://community.multitheftauto.com/in ... ls&id=9337 Everything works fine but when I restart the scripts color of vehicles is not the same.. Help please! Link to comment
xXMADEXx Posted February 13, 2015 Share Posted February 13, 2015 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
Mike269 Posted February 13, 2015 Author Share Posted February 13, 2015 Thanks madex but this is so hard to me I'm not that good in scripting to do that Link to comment
Ryancit2 Posted February 13, 2015 Share Posted February 13, 2015 Change first function with this: vehicles={} 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) end end addEventHandler("onResourceStart",getResourceRootElement(getThisResource()),makevehs) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now