IMariukas Posted November 6, 2013 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? "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
Castillo Posted November 6, 2013 Posted November 6, 2013 Both codes don't make any sense. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
IMariukas Posted November 7, 2013 Author 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. "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
IMariukas Posted November 8, 2013 Author Posted November 8, 2013 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
Blaawee Posted November 8, 2013 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 );
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