ice_brasil Posted May 17, 2013 Share Posted May 17, 2013 Well as soon as I start the script, everything is pixealizado, just wanted to start a script when entering a function / drug What do by just to start the script so the command is used? My lua used: -- -- c_block_world.lua -- local shaderList = {} local colorizeOff = false addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.1.0" then return end -- Create shader to test for any errors local testShader, tec = dxCreateShader ( "block_world.fx" ) if not testShader then else -- Create 26 shaders and apply each one to some world textures for c=65,96 do local clone = dxCreateShader ( "block_world.fx" ) engineApplyShaderToWorldTexture ( clone, string.format( "%c*", c + 32 ) ) engineRemoveShaderFromWorldTexture ( clone, "tx*" ) -- Skip doing the grass shaderList[#shaderList+1] = clone end -- Initial colors colorize() end end ) ---------------------------------------------------------------- -- Do change ---------------------------------------------------------------- function colorize() colorizeOff = not colorizeOff for _,shader in ipairs(shaderList) do local r,g,b = 0,0,0 while r+g+b < 2 do r,g,b = math.random(0.25,1.25),math.random(0.25,1.25),math.random(0.25,1.25) end if colorizeOff then r,g,b = 1,1,1 end dxSetShaderValue ( shader, "COLORIZE", r,g,b ) end end addCommandHandler("droga", colorize) Help-me plis sorry my bad english I'm Brazilian Link to comment
RaceXtreme Posted May 17, 2013 Share Posted May 17, 2013 So you want to start the shader when typing /drug, huh? Here it is: -- -- c_block_world.lua -- local shaderList = {} local colorizeOff = false function ColorizeShader () -- Version check if getVersion ().sortable < "1.1.0" then return end -- Create shader to test for any errors local testShader, tec = dxCreateShader ( "block_world.fx" ) if not testShader then else -- Create 26 shaders and apply each one to some world textures for c=65,96 do local clone = dxCreateShader ( "block_world.fx" ) engineApplyShaderToWorldTexture ( clone, string.format( "%c*", c + 32 ) ) engineRemoveShaderFromWorldTexture ( clone, "tx*" ) -- Skip doing the grass shaderList[#shaderList+1] = clone end -- Initial colors colorize() end end ---------------------------------------------------------------- -- Do change ---------------------------------------------------------------- function colorize() colorizeOff = not colorizeOff for _,shader in ipairs(shaderList) do local r,g,b = 0,0,0 while r+g+b < 2 do r,g,b = math.random(0.25,1.25),math.random(0.25,1.25),math.random(0.25,1.25) end if colorizeOff then r,g,b = 1,1,1 end dxSetShaderValue ( shader, "COLORIZE", r,g,b ) end end addCommandHandler("droga", ColorizeShader) You should start learning Lua by clicking on this link: https://wiki.multitheftauto.com/index.php?title=PT-BR/P%C3%A1gina_Inicial%20 because you don't know even the basis. 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