String question - 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: String question (
/showthread.php?tid=349463)
String question -
Mento - 09.06.2012
Say a string contains a integer inside it, example:
pawn Код:
new string[12], number;
number = 7;
format(string, sizeof(string), "%i", number);
Can I somehow take the integer inside the string and use it? Because everytime I try plugging in the string, it gives me a warning:
pawn Код:
warning 213: tag mismatch
Help would be greatly appreciated, thanks for your time.
Re: String question -
GtasaPoliceModz - 09.06.2012
removed
Re: String question -
Mento - 09.06.2012
Argh, please read the original thread, I know how send a string. Maybe I wasn't clear, I want to put a integer into a string, and then use that string to transfer the integer into a function. So how can I take the original integer out of the string and make it fit into a integer function.
Re: String question -
Calgon - 09.06.2012
You've confused me.
If you want to take an integer out of a string, you can use
strval to extract the integer. It only works if it's
just an integer in the string, nothing else.
Also, you can use
valstr to do the contrary - which would be to convert an integer into a string.
Which line do you get an error on by the way?
Re: String question -
MP2 - 09.06.2012
Quote:
Originally Posted by Calgon
It only works if it's just an integer in the string, nothing else.
|
AFAIK it works if there's text too, but after the integer. So "69 is my favourite number" should return 69.