Serginix Posted November 1, 2011 Share Posted November 1, 2011 Bueenas, Estaba mirnado los Shaders (No deseo crear uno), solo quiero, q con un comando se vayan qactivando, por ejemplo, copies /shader_water, y se te ponga el shader del agua, por lo tanto taba haciendo esto (mriando esta parte de la Wiki y editando el Script de Shader_Water q taba en la Wiki) : [url=https://wiki.multitheftauto.com/wiki/DxCreateShader]https://wiki.multitheftauto.com/wiki/DxCreateShader[/url] <---- Lei de ahi y logre: addCommandHandler( "shader_water", function() if not myShader then local myShader, tec = dxCreateShader ( "water.fx" ) local textureVol = dxCreateTexture ( "images/smallnoise3d.dds" ); local textureCube = dxCreateTexture ( "images/cube_env256.dds" ); dxSetShaderValue ( myShader, "microflakeNMapVol_Tex", textureVol ); dxSetShaderValue ( myShader, "showroomMapCube_Tex", textureCube ); engineApplyShaderToWorldTexture ( myShader, "waterclear256" ) setTimer( function() if myShader then local r,g,b,a = getWaterColor() dxSetShaderValue ( myShader, "gWaterColor", r/255, g/255, b/255, a/255 ); end end ,100,0 ) else destroyElement (myShader) myShader = nil end end ) Mas sin emabrgo solo Activa, Mas no desactiva al usar el mismo comando, no me atrevo a tocarlo mucho, dado q no se mucho de Shaders, entonces q podria hacer? Gracias gente. Link to comment
Castillo Posted November 1, 2011 Share Posted November 1, 2011 Yo ya cree esto para SAUR, te dejo el codigo. -- -- c_water.lua -- addEventHandler( "onClientResourceStart", resourceRoot, function() -- Version check if getVersion ().sortable < "1.1.0" then return end -- Create shader myShader, tec = dxCreateShader ( "water.fx" ) if myShader then outputChatBox( "Using technique " .. tec ) -- Set textures local textureVol = dxCreateTexture ( "images/smallnoise3d.dds" ); local textureCube = dxCreateTexture ( "images/cube_env256.dds" ); dxSetShaderValue ( myShader, "microflakeNMapVol_Tex", textureVol ); dxSetShaderValue ( myShader, "showroomMapCube_Tex", textureCube ); enabled = false end end ) function setWaterShaderEnabled(bool) if bool then engineApplyShaderToWorldTexture ( myShader, "waterclear256" ) -- Update water color incase it gets changed by persons unknown waterTimer = setTimer( function() if myShader then local r,g,b,a = getWaterColor() dxSetShaderValue ( myShader, "gWaterColor", r/255, g/255, b/255, a/255 ); end end ,100,0 ) else if isTimer(waterTimer) then killTimer(waterTimer) end engineRemoveShaderFromWorldTexture ( myShader, "waterclear256" ) end enabled = bool end addCommandHandler("shader_water", function () setWaterShaderEnabled(not enabled) end) Link to comment
Serginix Posted November 1, 2011 Author Share Posted November 1, 2011 Jjaja supongo q tengo suerte, gracias Link to comment
Castillo Posted November 1, 2011 Share Posted November 1, 2011 De nada, espero te funcione (a mi me funciona, pero no lo uso asi). Link to comment
Serginix Posted November 2, 2011 Author Share Posted November 2, 2011 jajajaaj, si ya se como lo debes usar, con una gui muy bonita... Link to comment
Recommended Posts