Jump to content

[Close] Shader (skid marks) question


SpecT

Recommended Posts

Hello people!

I want to ask you a shader related question.

Is it possible to set the rainbow skid marks shader just for car1? So in this case the other players will only see car1's rainbow skid marks but theirs will be the default ones.

Thanks in advance!

Edited by Guest
Link to comment
Hello people!

I want to ask you a shader related question.

Is it possible to set the rainbow skid marks shader just for car1? So in this case the other players will only see car1's rainbow skid marks but theirs will be the default ones.

Thanks in advance!

Yes it's

Link to comment

This is triggered from server (loop) to all the clients

function handleSkidmarks(isEnabled) 
    local vehicle = getPedOccupiedVehicle(getLocalPlayer()) 
    myShader, tec = dxCreateShader ( "skidmark/skidmarks.fx" ) 
    if isEnabled then 
        engineApplyShaderToWorldTexture ( myShader, "particleskid", vehicle  ) 
    end 
    selectPreset(4) 
end 

Link to comment
Hello?

BUMP

Here is all what you need , it's just an example

-- Server side

if isPedInVehicle(thePlayer) then 
    local vehicle = getPedOccupiedVehicle(thePlayer) 
    local model = getElementModel(vehicle) 
    if model == 533 then -- Feltzer 
        triggerClientEvent( root,"eventName", root,vehicle) 
    end  
end 

-- Client side

function handleSkidmarks(vehicle) 
   -- apply shader here 
end 
addEvent("eventName", true) 
addEventHandler("eventName", root,handleSkidmarks) 

Link to comment

That's what I have done.

The problem is the applying of the shader. It doesn't seem to get applied to my vehicle's skid marks (and it should).

I tried with debugging methods but everything is working just fine but the engineApplyShaderToWorldTexture won't apply it if I put the vehicle in the function arguments.

Maybe the skid marks aren't connected with the vehicle... :?:

So what should I do now ?

Link to comment
That's what I have done.

The problem is the applying of the shader. It doesn't seem to get applied to my vehicle's skid marks (and it should).

I tried with debugging methods but everything is working just fine but the engineApplyShaderToWorldTexture won't apply it if I put the vehicle in the function arguments.

Maybe the skid marks aren't connected with the vehicle... :?:

So what should I do now ?

BUMP

Any advices ?

Show me full code.

Link to comment

- Server side:

function onEnableSkidmarks() 
    local specialVehicle = nil 
    for i,player in pairs(getElementsByType("player")) do 
        if isPlayerLogged(player) and isPedInVehicle(player) then 
            local vehicle = getPedOccupiedVehicle(player) 
            local skidEnabled = getPlayerData(player,"skidmarksEnabled") 
            if skidEnabled == true then 
                specialVehicle = vehicle 
            end 
        end 
    end 
    if specialVehicle then 
        triggerClientEvent( root,"handleSkidmarks", root,specialVehicle) 
    end 
end 
  

- Client side:

function handleSkidmarks(vehicle) 
    local myShader, tec = dxCreateShader ( "data/shader/skidmark/skidmarks.fx" ) 
    if vehicle then 
        engineApplyShaderToWorldTexture ( myShader, "particleskid", vehicle) 
        outputChatBox("Applying...") 
        selectPreset(4) 
    end 
end 
addEvent("handleSkidmarks",true) 
addEventHandler("handleSkidmarks",root,handleSkidmarks) 

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