PDA

View Full Version : sscanf


SnG.Scot_MisCuDI
16/03/2012, 03:40 AM
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

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

Thomas.
16/03/2012, 06:57 AM
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:
if(sscanf(params,"I(500000)I(250000)S(For Sale)[128]",cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /createbiz [cost] [payout] [name]");