micheal1230 Posted August 7, 2012 Share Posted August 7, 2012 How can I make this script more compact because it is very long. It uses a shaders to replace paintjobs but since there is 3 paintjobs for each 5 cars so it I will make the script bloody huge. Is there anyway I could use a table to make the script smaller, could you maybe make it for me if not could you explain how I could make it. Thanks Script: -------------------------------------Sultan---------------------------------------------- addEventHandler( "onClientResourceStart", resourceRoot, function() texture = dxCreateTexture ( "sultan1.txd" ) shader, tec = dxCreateShader( "shader.fx" ) --bit of sanity checking if not shader then outputConsole( "Could not create shader. Please use debugscript 3" ) destroyElement( texture ) return elseif not texture then outputConsole( "loading texture failed" ) destroyElement ( shader ) tec = nil return else engineApplyShaderToWorldTexture ( shader, "internalfilenamewithoutextension" ) dxSetShaderValue ( shader, "gTexture", texture ) end end ) addEventHandler( "onClientResourceStart", resourceRoot, function() texture = dxCreateTexture ( "sultan2.txd" ) shader, tec = dxCreateShader( "shader.fx" ) --bit of sanity checking if not shader then outputConsole( "Could not create shader. Please use debugscript 3" ) destroyElement( texture ) return elseif not texture then outputConsole( "loading texture failed" ) destroyElement ( shader ) tec = nil return else engineApplyShaderToWorldTexture ( shader, "internalfilenamewithoutextension" ) dxSetShaderValue ( shader, "gTexture", texture ) end end ) addEventHandler( "onClientResourceStart", resourceRoot, function() texture = dxCreateTexture ( "sultan3.txd" ) shader, tec = dxCreateShader( "shader.fx" ) --bit of sanity checking if not shader then outputConsole( "Could not create shader. Please use debugscript 3" ) destroyElement( texture ) return elseif not texture then outputConsole( "loading texture failed" ) destroyElement ( shader ) tec = nil return else engineApplyShaderToWorldTexture ( shader, "internalfilenamewithoutextension" ) dxSetShaderValue ( shader, "gTexture", texture ) end end ) -------------------------------------End Sultan---------------------------------------------- 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