sscanf
#1

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

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]");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)