using sscanf for optional integer inputs at the end of a command ( possible?) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: using sscanf for optional integer inputs at the end of a command ( possible?) (
/showthread.php?tid=89206)
using sscanf for optional integer inputs at the end of a command ( possible?) -
iLinx - 31.07.2009
command : /buygun [weapon] [amount]
is it possible to make the amount optional, so if they only put in weapon it still gives the weapon just not the amount ?
this is my line for the sscanf
Код:
if(sscanf(params[], "ii", wid, amount)) return 0;
sorry i cant attach the full code, im coding this gamemode on my laptop and its network card is fried x|
Re: using sscanf for optional integer inputs at the end of a command ( possible?) -
MadeMan - 31.07.2009
I haven't tested, but there is an optional string you can use in sscanf, so maybe store the amount on a string and then use strval() to get the integer from it?
pawn Код:
if(sscanf(params, "iz", wid, amount)) return 0;