Joining a few different integer values in a single string - 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: Joining a few different integer values in a single string (
/showthread.php?tid=388675)
Joining a few different integer values in a single string -
||123|| - 29.10.2012
Is it possible to store, let's say four different values in a single string?
For example:
pawn Код:
new skin1 = 235;
new pskin2 = 192;
new pskin3 = 190;
new pskin4 = 20;
if I want all these values to merge in a single string, and give out a result like:
I saw a tutorial or something about this a while back, but can't find it. I want to use this so I don't have to create different string values for every house a player purchases, and also because so the player could buy how many he wishes.
Re: Joining a few different integer values in a single string -
JhnzRep - 29.10.2012
pawn Код:
format(string, sizeof(string), "%i%i%i%i", skin1, pskin2, pskin3, pskin4);
Should work.
Re: Joining a few different integer values in a single string -
Revo - 29.10.2012
Quote:
Originally Posted by JhnzRep
pawn Код:
format(string, sizeof(string), "%i%i%i%i, skin1, pskin2, pskin3, pskin4);
Should work.
|
It would if you closed your apostrophe
Re: Joining a few different integer values in a single string -
JhnzRep - 29.10.2012
Quote:
Originally Posted by BuuGhost
It would if you closed your apostrophe
|
Fixed, thanks for pointing that out.
Re: Joining a few different integer values in a single string -
||123|| - 29.10.2012
And how am I going to load them separately again?
Quote:
Originally Posted by BuuGhost
It would if you closed your apostrophe
|
Your signature has a unclosed apostrophe.
Re: Joining a few different integer values in a single string -
ReneG - 29.10.2012
You can't unless you separate the values in the string by a special character, and use either the split function or sscanf.
Re: Joining a few different integer values in a single string -
||123|| - 29.10.2012
Quote:
Originally Posted by VincentDunn
You can't unless you separate the values in the string by a special character, and use either the split function or sscanf.
|
You mean a '-' or a ',' right? ok. But I was thinking, how many many digits can a single string aray hold? I mean I don't think I can avail players to buy houses on a large scale then.