[Tutorial] How to create space with one string or Spacing Strings. (sscanf)
#1

Hey Guys, I have seen where people wanted to use spaces in strings even I had this problem. I experimented with sscanf and found out how to do it.

It is simple. Just put the "s" last. Done. Just joking.

Here is how. You have a command that creates houses or businesses. Example:
pawn Code:
if(sscanf(params,"siii",busid,cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /createbus [name] [cost] [payout] [businessid]");
But when you type it, you have to join the words. Example if you want Clucklin Bell you would have to type Clucklin_Bell with the "underscore".

Example:



If you look at the command above, you will see that it only has space for 1 string. Just Clucklin or Clucklin_Bell because the 2nd thing you will type it will go over into the integers.

Now when you use the command with the string at the end. Exampe:
pawn Code:
if(sscanf(params,"iiis",busid,cost,payout,name))return SendClientMessage(playerid, 0xFF0000AA, "Usage: /createbus [businessid] [cost] [payout] [name]");
Example:

If you look at the 1st picture you will see that i have "Tutorial_Test_1" and the 2nd picture I have "Tutorial <space> Test <space> 2"
Because I placed the string first in the 1st pic and last in the 2nd pic.

:createbus [name] [cost] [payout] [businessid] (This is just a test command) Here a sting would be used for the name. When the string is 1st you will not be able to use spaces.

:createbus [businessid] [cost] [payout] [name] If you look here, you will see that he string is last.

Thanks for having me. I hope this helped.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)