Jump to content

[HELP]Custom paintjob problem.


IMariukas

Recommended Posts

Posted

:arrowup: Hi, so I wanted to make a script that there spawns a car and only that car has the custom paintjob, unless I spawn more cars and let them spawn with paintjobs.

Here's my client code-

function triggerelegy() 
    triggerServerEvent(source, "elegy-spawn", source) 
end 
  
addEventHandler("onResourceStart", root, 
    function(thePlayer, theVehicle) 
            if getElementModel(elegyshark) then 
            local shader, tec = dxCreateShader ( "texreplace.fx" ) 
            local tex = dxCreateTexture ( "textures/elegy.png") 
            engineApplyShaderToWorldTexture ( shader, "elegy2body256", elegyshark )  
            engineApplyShaderToWorldTexture ( shader, "elegy2body256lod", elegyshark ) 
            dxSetShaderValue ( shader, "gTexture", tex ) 
            end 
        end 
)    

And server side script-

elegyshark =  createVehicle ( 562, 2485.1001, -1539.5, 23.6) 
setVehiclePaintjob ( elegyshark, 2 ) 
  
addEvent("elegy-spawn", true) 
addEventHandler("elegy-spawn", getRootElement(), responce) 
  

The car spawns but there is no custom paintjob on it and no ERROR shows in debugscript 3.What's the problem?

  • "Lua" means "Moon" in Portuguese. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua". Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!

- http://www.lua.org/about.html

Posted

Both codes don't make any sense.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Actually I wanted to use createVehicle in client-side one, but I can't because the car spawns and it's freezed and you can't enter the car.So I needed to write createVehicle function in server-side.About my script, well example:

I want to make that paintjob2 that only "elegyshark" would have custom paintjob that you select on F1 paintjob the paintjob2.

  • "Lua" means "Moon" in Portuguese. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua". Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!

- http://www.lua.org/about.html

Posted

Does somebody gonna help me please?

  • "Lua" means "Moon" in Portuguese. More specifically, "Lua" is a name, the name of the Earth's moon and the name of the language. Like most names, it should be written in lower case with an initial capital, that is, "Lua". Please do not write it as "LUA", which is both ugly and confusing, because then it becomes an acronym with different meanings for different people. So, please, write "Lua" right!

- http://www.lua.org/about.html

Posted

Try this:

.fx

texture PaintjobTexture; 
  
technique vehiclePaintjobReplace 
{ 
    pass P0 
    { 
        Texture[ 0 ] = PaintjobTexture; 
    } 
} 

Client

local myShader, tec, theTexture; 
  
addEventHandler( 'onClientResourceStart', resourceRoot, 
    function( ) 
  
        -- Version check 
        if getVersion ().sortable < '1.1.0' then 
            outputChatBox( 'Resource is not compatible with this client.' ); 
            return 
        end 
  
        myShader, tec = dxCreateShader ( 'texreplace.fx', 0, 0, true, 'vehicle' ); 
  
        if not myShader then 
            outputChatBox( 'Could not create shader. Please use debugscript 3' ) 
        else 
            outputChatBox( 'Using technique [' . . tec. . ']' ); 
        end 
         
        theTexture = dxCreateTexture( 'textures/elegy.png' ); 
        dxSetShaderValue( myShader, 'PaintjobTexture', theTexture ); 
        engineApplyShaderToWorldTexture( myShader, 'elegy2body256'); 
    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...