Jump to content

setSkyGradient Function not work


Recommended Posts

Posted

Hey,

I try to make a script which can change the sky colour.

That's my code:

function changeSkyColor ( commandName, topred, topgreen, topblue, bottomred,bottomgreen,bottomblue )
   topRed = tonumber ( topRed )
   topGreen = tonumber ( topGreen )
   topBlue = tonumber ( topBlue )
bottomRed = tonumber ( bottomRed )
bottomGreen = tonumber ( bottomGreen )
bottomBlue = tonumber ( bottomBlue )
   if topRed and topGreen and topBlue and bottomRed and bottomGreen and bottomBlue then
       setSkyGradient( topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue )
   else
      outputChatBox ( "Failed to change the sky colour!" )
   end
end
 
addCommandHandler ( "setsky", changeSkyColor )

But it is not working :(

Can someone help me?

Greetings

Posted

variables are case sensitive. it must be "topRed" not "topred" etc:

function changeSkyColor ( commandName, topRed, topGreen, topBlue, bottomRed,bottomGreen,bottomBlue ) --capital letters here
   topRed = tonumber ( topRed )
   topGreen = tonumber ( topGreen )
   topBlue = tonumber ( topBlue )
  bottomRed = tonumber ( bottomRed )
  bottomGreen = tonumber ( bottomGreen )
  bottomBlue = tonumber ( bottomBlue )
if topRed and topGreen and topBlue and bottomRed and bottomGreen and bottomBlue then
setSkyGradient( topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue )
else
outputChatBox ( "Failed to change the sky colour!" )
end
end
 
addCommandHandler ( "setsky", changeSkyColor )

Posted

Is this function server-side or client-side?

If it's server-side, you're missing the player argument:

function changeSkyColor ( player, commandName, topRed, topGreen, topBlue, bottomRed, bottomGreen, bottomBlue )

Projects:

Slothbot | Maximap

Posted

Okay very nice :)

It was on server side, so i changed it

Okey, one other question:

Is it possible to change the sky color in a loop?

So that is like this:

Blue

Green

Red

Black

Red

--Start Again

Blue

Green

Red

Black

Red

--Start Again

So that it allways change?

Pls answer ;)

Greetings

Posted

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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