23.03.2011, 03:59
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:
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:
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.
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]");
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]");
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.