SSCANF check within SSCANF check
#3

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
"faction 1" is considered as a whole string on your first sscanf usage. You can have optional parameter on sscanf to accept an integer in case if it's given.
pawn Код:
sscanf(params, "s[20]I("#INVALID_PLAYER_ID")", section, factionid)

//factionid will be INVALID_PLAYER_ID if "/editservercar faction" is executed.
//Will hold any other value if "/editservercar faction <somevalue>" is executed.
Another way is using SSCANF_QUIET to simply ignore any integer value after "faction" in your first usage. But I would recommend the first way because you don't have to use sscanf twice then, as per your current code.
pawn Код:
sscanf(params, "?<SSCANF_QUIET=1>s[20]{i}", section)
Your first approach worked out for me, cheers!
Reply


Messages In This Thread
SSCANF check within SSCANF check - by JaydenJason - 18.01.2017, 11:58
Re: SSCANF check within SSCANF check - by Lordzy - 18.01.2017, 13:33
Re: SSCANF check within SSCANF check - by JaydenJason - 18.01.2017, 14:04

Forum Jump:


Users browsing this thread: 1 Guest(s)