Jump to content

As you do this?


Brad96

Recommended Posts

Posted (edited)

I wonder if I could give the functions, if They Want to or give me clues Also to try it .. this what comes to detailing the infernus or cars.

clfy.png

n61u.png

6oa6.png

Edited by Guest
Posted (edited)

You want to edit the Infernus to make it have those custom lights?

If so, you're going to need to download TXD Workshop, edit the Infernus's txd, and then replace the stock images with the custom ones.

ED: Sorry for my lismeading information, I thought it was similar to replacing the textures of custom mods :P

Edited by Guest
Posted

You need to use a shader to replace texture of lights. Most if not all cars share the same lights texture and therefore there is no lights texture in cars' .txd's.

Posted

as I found them but I need this script activate the lights when a player enters the server .. for now activated by a Panel .. how could I do that will be activated when entering the sv without panel or anything?

local lights = { 
    "vehiclelightson128" 
     
} 
local shaders = {} 
  
local currentLight = "vehiclelightson128" 
local drawLights = true 
  
addEventHandler("onClientResourceStart",resourceRoot, 
    function () 
        currentLight = getCookieOption("lights") or "high quality" 
        setElementData(localPlayer,"vehiclelight",currentLight,true) 
        if getCookieOption("draw") ~= "false" then 
            for i,vehicle in ipairs (getElementsByType("vehicle")) do 
                loadVehicleLights(vehicle) 
            end 
        end 
    end 
) 
  
addEventHandler("onClientElementStreamIn",root, 
    function () 
        if getElementType(source) == "vehicle" then 
            loadVehicleLights(source) 
        end 
    end 
) 
  
addEventHandler("onClientVehicleEnter",root, 
    function () 
        loadVehicleLights(source) 
    end 
)        
  
function loadVehicleLights (vehicle) 
    local controller = getVehicleController(vehicle) 
    if not controller then return end 
    local image = getElementData(controller,"vehiclelight") 
    if not image then return end 
    if not shaders[image] then 
        local texture = dxCreateTexture("images/vehiclelightson128.jpg","dxt3") 
        local shader = dxCreateShader("lights.fx") 
        dxSetShaderValue(shader,"gTexture",texture) 
        shaders[image] = shader 
    end 
    engineApplyShaderToWorldTexture(shaders[image],"vehiclelightson128",vehicle) -- needs messing with alpha 
end 
  
addEventHandler("onClientElementDataChange",root, 
    function (key,oldvalue) 
        if key == "vehiclelight" then 
            local vehicle = getPedOccupiedVehicle(source) 
            if vehicle then 
                loadVehicleLights(vehicle) 
            end 
        end 
    end 
) 
  

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