IMariukas Posted November 6, 2013 Share Posted November 6, 2013 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? Link to comment
Castillo Posted November 6, 2013 Share Posted November 6, 2013 Both codes don't make any sense. Link to comment
IMariukas Posted November 7, 2013 Author Share Posted November 7, 2013 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. Link to comment
IMariukas Posted November 8, 2013 Author Share Posted November 8, 2013 Does somebody gonna help me please? Link to comment
Blaawee Posted November 8, 2013 Share Posted November 8, 2013 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 ); 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