Javier Posted March 21, 2013 Share Posted March 21, 2013 Hey guys, check this out function blackSky ( ) local weather = getWeather ( ) if ( ( weather ) == 9 ) then setSkyGradient ( 0, 0 ,0, 10, 10 ,10 ) else resetSkyGradient ( ) end end addEventHandler ( "onResourceStart", resourceRoot, blackSky ) The problem is that the sky is always black. Although the weather is not number 9...Any idea how I can fix it? Link to comment
Moderators IIYAMA Posted March 21, 2013 Moderators Share Posted March 21, 2013 the numbers are from 0 t/m 255 10 = almost black. try: addEventHandler ( "onResourceStart", resourceRoot, function ( ) local weather = getWeather ( ) if weather == 9 then -- you don't have to use "()" when they aren't needed. setSkyGradient ( 0, 0 ,0, 200, 200 ,200 ) else resetSkyGradient ( ) end end) --You need to use " ()" at moments like this: 100*(100+1) = A -- 100+1 = 101 *100 = 10100 -- When you write it without "()" 100*100+1 = A --100*100 =10000 + 1 = 10001 () is always the first thing you do. Link to comment
Blaawee Posted March 21, 2013 Share Posted March 21, 2013 setSkyGradient ( topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue ) #Optional Arguments : - topRed: The red value of the upper part of the sky, from 0 to 255. - topGreen: The green value of the upper part of the sky, from 0 to 255. - topBlue: The blue value of the upper part of the sky, from 0 to 255. - bottomRed: The red value of the lower part of the sky, from 0 to 255. - bottomGreen: The green value of the lower part of the sky, from 0 to 255. - bottomBlue: The blue value of the lower part of the sky, from 0 to 255. Link to comment
Javier Posted March 21, 2013 Author Share Posted March 21, 2013 when I activate the resource, the sky is always black even though the weather is not the number 9 Link to comment
Moderators IIYAMA Posted March 21, 2013 Moderators Share Posted March 21, 2013 Even when you use this: setSkyGradient ( 255, 255 ,255, 255, 255 ,255 ) (/start runcode) /run setSkyGradient ( 255, 255 ,255, 255, 255 ,255 ) ? Link to comment
Blaawee Posted March 21, 2013 Share Posted March 21, 2013 try this : change the color you want and remember setSkyGradient ( topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue ) #Optional Arguments : - topRed: The red value of the upper part of the sky, from 0 to 255. - topGreen: The green value of the upper part of the sky, from 0 to 255. - topBlue: The blue value of the upper part of the sky, from 0 to 255. - bottomRed: The red value of the lower part of the sky, from 0 to 255. - bottomGreen: The green value of the lower part of the sky, from 0 to 255. - bottomBlue: The blue value of the lower part of the sky, from 0 to 255. #Make sure it's Server side. addEventHandler ( 'onResourceStart', resourceRoot, function ( res ) local weatherID = getWeather( ); if ( weatherID == 9 ) then setSkyGradient( 255, 255 ,255, 255, 255 ,255 ); else resetSkyGradient( ); end end ); 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