Killerhamster10 Posted April 5, 2010 Share Posted April 5, 2010 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 Link to comment
Dark Dragon Posted April 5, 2010 Share Posted April 5, 2010 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 ) Link to comment
Killerhamster10 Posted April 5, 2010 Author Share Posted April 5, 2010 Okay thanks, but now it only sais: Failed to change the sky colour I type: /setsky 200 0 100 150 0 70 and again this error message But i think it'a allright? Greetings Link to comment
Gamesnert Posted April 5, 2010 Share Posted April 5, 2010 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 ) Link to comment
Killerhamster10 Posted April 5, 2010 Author Share Posted April 5, 2010 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 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