SA-MP Forums Archive
sscanf - 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)
+--- Thread: sscanf (/showthread.php?tid=326068)



sscanf - SnG.Scot_MisCuDI - 16.03.2012

How can i make it so if the player doesnt type the price and payout it defaults to those numbers? Right now its working as if the player doesnt type the name it defaults to For Sale

pawn Код:
if(sscanf(params,"i(500000)i(250000)S(For Sale)[128]",cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /createbiz [cost] [payout] [name]");
Its not working


Re: sscanf - Thomas. - 16.03.2012

The "i" specifier signifies a required parameter, thus it does not accept a default value.
To allow a default value you should use the optional equivalent (capitalized ("I")).

So your code would be:
pawn Код:
if(sscanf(params,"I(500000)I(250000)S(For Sale)[128]",cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /createbiz [cost] [payout] [name]");