02.06.2015, 19:00
I have a command to create and manage businesses, with the parameters being task (string), business ID (integer) and business name (string).
The business ID parameter isn't used for all tasks, hence it being optional, and the name parameter is only used for the task related to naming a business, so it's optional as well.
This all works fine but I've tried to add another optional parameter at the end (hour), to use with two new tasks that allow you to set the opening and closing hours for the business.
When I enter "/abusiness closingtime 2 13", it puts "13" in the name parameter.
So how do I properly add this optional parameter at the end so that if my task is closingtime or openingtime, it skips the name parameter?
pawn Код:
if(sscanf(params, "s[12]I(-1)S(null)[20]", task, id, name))
This all works fine but I've tried to add another optional parameter at the end (hour), to use with two new tasks that allow you to set the opening and closing hours for the business.
pawn Код:
if(sscanf(params, "s[12]I(-1)S(null)[20]I(-1)", task, id, name, hour))
So how do I properly add this optional parameter at the end so that if my task is closingtime or openingtime, it skips the name parameter?