Jump to content

[Close] Shader (skid marks) question


SpecT

Recommended Posts

Posted (edited)

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

Posted

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 

Posted
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) 

Posted

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 ?

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

Posted

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

Posted
What do you think, @Walid ?

Sorry for the late reply i'm busy, As i can see you are using ccw resource (Skid marks) , ask him if it's possible to apply the shader only for one car. already create something like that before.

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