Hello! I made this script as my second script and it wont work. Could someone find out where is problem and post here fixed one? Thx!
function CreateWindow()
guiCreateWindow(2,262,188,374,"Settings",false)
end
function waterShader()
guiCreateCheckBox(9,97,15,16,"water Shader",false,false
if ( getElementType(source) == "gui-checkbox" ) then -- Is the element clicked a checkbox?
if ( guiCheckBoxGetSelected(source) ) then
waterTimer = setTimer ( checkWaterColor, 1000, 0 )
engineApplyShaderToWorldTexture ( myShader, "waterclear256" )
outputChatBox ( "Water shader enabled" )
else
killTimer ( waterTimer )
engineRemoveShaderFromWorldTexture ( myShader, "waterclear256" )
outputChatBox ( "Water shader disabled" )
end
end
end
addEventHandler("onClientGUIClick", root, checkboxBleepWhenClicked, false)
addEventHandler( "onClientResourceStart", resourceRoot,
end
);
function()
-- Version check
if getVersion ().sortable < "1.1.0" then
outputChatBox( "Resource is not compatible with this client." )
return
end
-- Create shader
myShader, tec = dxCreateShader ( "water.fx" )
if not myShader then
outputChatBox( "Could not create shader. Please use debugscript 3" )
else
-- 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 );
-- Apply to global txd 13
engineApplyShaderToWorldTexture ( myShader, "waterclear256" )
-- Update water color incase it gets changed by persons unknown
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 )
end
end
)
enabled = false
function chromecars ()
guiCreateCheckBox(9,58,17,21,"",false,false
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),waterShader)
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),createWindow)