ShayF Posted March 15, 2017 Share Posted March 15, 2017 (edited) I made this simple script for freeroam servers. This lets you change the color of a players vehicle. Either with command or gui. I hope you enjoy (Server-sided only! NOT TESTED!) server.lua - local command = 'vehcolor' function vehColor(element,_,r,g,b) if getElementType(element) == 'player' then local v = getPedOccupiedVehicle(element) if v then if getVehicleOccupant(v,0) == element then vehicle = v end end elseif getElementType(element) == 'vehicle' then vehicle = element end if vehicle then if r then if g then if b then if tonumber(b) then setVehicleColor(vehicle,tonumber(r),tonumber(g),tonumber(b)) end else if tonumber(g) then setVehicleColor(vehicle,tonumber(r),tonumber(g),0) end end else if tonumber(r) then setVehicleColor(vehicle,tonumber(r),0,0) end end else setVehicleColor(vehicle,0,0,0) end end end addEvent('setVehicleColor',true) addEventHandler('setVehicleColor',root,vehColor) addCommandHandler(command,vehColor) --[[ Event Triggers triggerEvent('setVehicleColor',root,vehicle,_,r,g,b) triggerServerEvent('setVehicleColor',root,vehicle,_,r,g,b) triggerEvent('setVehicleColor',root,player,_,r,g,b) triggerServerEvent('setVehicleColor',root,player,_,r,g,b) ]] Edited March 16, 2017 by shay01 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