Multiple sscanf lines in one command
#4

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
You're checking if the parameter is a string and in the next sscanf line you're checking if it's an integer. It can't be string and integer at the same time.

Use optional parameters

Код:
if(sscanf(params,"s[50]I(-1)", choice,choice2)
Now the second parameter (integer) is optional
If a person uses take order but doesn't give a value for choice2​ , it defaults to -1.
However if they choose a valid number the remaining codes are executed.

Also remove the second sscanf line.
A horrible way to create a command that has arguments which vary. What you should do is use params to check for the first argument (the option), then use sscanf with {s[5]}{s[6]}i if equal to "take order" then your command can be /cmd take order (number).

Ez pz lemon sqz
Reply


Messages In This Thread
Multiple sscanf lines in one command - by NealPeteros - 12.06.2017, 13:05
Re: Multiple sscanf lines in one command - by DavidBilla - 12.06.2017, 13:25
Re: Multiple sscanf lines in one command - by NealPeteros - 12.06.2017, 13:33
Re: Multiple sscanf lines in one command - by CheezIt - 12.06.2017, 14:26

Forum Jump:


Users browsing this thread: 1 Guest(s)