Jump to content

What is bad?


Javier

Recommended Posts

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

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
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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...