Eddyxd Posted December 11, 2013 Posted December 11, 2013 I need a resource to go through a car changer (vehiclechange) stay with the same color Example: I have a comet with color #ff000 and when I change the infernus stay with the same color and does not change, does anyone could give me? Thanks
Woovie Posted December 12, 2013 Posted December 12, 2013 I didn't test this, but this should work. function changeVehicle(command,player,vehicle,color1,color2,color3,color4) if getPedOccupiedVehicle(player) and getPedOccupiedVehicleSeat == 0 and then local pVehicle = getPedOccupiedVehicle(player) if getVehicleModelFromName(vehicle) then vehicle = getVehicleModelFromName(vehicle) elseif getVehicleNameFromModel(vehicle) then vehicle = vehicle else outputChatBox ("You didn't specify a proper new vehicle. Please check your model name or ID.",player) return false end local r1,g1,b1,r2,g2,b2,r3,g3,b3,r4,g4,b4 = getVehicleColor(pVehicle, true) color1 = {r1,g1,b1} color2 = {r2,g2,b2} color3 = {r3,g3,b3} color4 = {r4,g4,b4} if color1 then local r1,g1,b1 = getColorFromString(color1) color1 = {r1,g1,b1} end if color2 then local r2,g2,b2 = getColorFromString(color2) color2 = {r2,g2,b2} end if color3 then local r3,g3,b3 = getColorFromString(color3) color3 = {r3,g3,b3} end if color4 then local r4,g4,b4 = getColorFromString(color4) color4 = {r4,g4,b4} end local vx,vy,vz = getElementVelocity(pVehicle) setElementModel(pVehicle, vehicle) setVehicleColor(pVehicle,color1[1],color1[2],color1[3],color2[1],color2[2],color2[3],color3[1],color3[2],color3[3],color4[1],color4[2],color4[3]) setElementVelocity(pVehicle,vx,vy,vz) else outputChatBox("You must be the driver of the vehicle in order to change the model.",player) end end addCommandHandler("cvrgb",changeVehicle) Then just do /cvrgb vehicle_name_or_model You can also specify RGB values afterwards, like so. /cvrgb vehicle_name_or_model #FF0000 #00FF00 It has all 4 color values in there too.
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