Feche1320 Posted December 28, 2010 Posted December 28, 2010 Hello, I'm making a /flip command, but if he types nothing or just letters, it give me an error on debugscript, so I made this: if ammount == "nil" then outputChatBox("Usage: flip [amount]", source, 46, 154, 254) return end And: if tonumber(ammount) == "nil" then outputChatBox("Usage: flip [amount]", source, 46, 154, 254) return end But none of them work. Thanks
Antibird Posted December 28, 2010 Posted December 28, 2010 -> if ammount == "nil" then should be like -> if ammount == nil then or even like -> if not ammount then if tonumber(ammount) == "nil" then same way: if not tonumber(ammount) then Means tonumber() can't convert "amount" string into a number, so false is returned and that's what we're checking for using "not".
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