using sscanf for optional integer inputs at the end of a command ( possible?)
#1

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|
Reply
#2

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;
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)