Double specifier?. sscanf - 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: Double specifier?. sscanf (
/showthread.php?tid=593882)
Double specifier?. sscanf -
GranaT3 - 10.11.2015
Hello. Could we put two specifiers for 1 Parameter ?. For example: "
is[5], intstring". To use a parameter as an integer and string.
Re : Double specifier?. sscanf -
Dutheil - 11.11.2015
No langages allow you to mix an integer and a string.
I don't see what do you want to make.
Re: Double specifier?. sscanf -
Kevln - 11.11.2015
In that case, just use a string and convert that string in to a value when needed, and use the string as it is when necessary.
Re: Double specifier?. sscanf -
ThePhenix - 11.11.2015
Quote:
Originally Posted by GranaT3
Hello. Could we put two specifiers for 1 Parameter ?. For example: "is[5], intstring". To use a parameter as an integer and string.
|
Elaborate...
Re: Double specifier?. sscanf -
J0sh... - 11.11.2015
Quote:
Originally Posted by ThePhenix
Elaborate...
|
Nothing to.
He wants to set:
PHP код:
new whatever[50]; //String, right?
//he wants to do this
whatever = 20; //int
What will not work.
Re : Re: Double specifier?. sscanf -
Dutheil - 11.11.2015
Quote:
Originally Posted by Jamester
PHP код:
new whatever[50]; //String, right?
//he wants to do this
whatever = 20; //int
What will not work.
|
Pawn isn't made for this use.
Re: Double specifier?. sscanf -
Kevln - 11.11.2015
Just use a string and get its integer value with strval.
Re : Re: Double specifier?. sscanf -
Dutheil - 11.11.2015
Quote:
Originally Posted by Kevln
Just use a string and get its integer value with strval.
|
sscanf does it.
Re: Re : Re: Double specifier?. sscanf -
Kevln - 11.11.2015
Quote:
Originally Posted by Dutheil
sscanf does it.
|
Of course.
pawn Код:
new string[3], integer;
strcat(string, "55");
if(sscanf(string, "i", integer))
{
// Use "integer".
}
else
{
// Use "string".
}
Either way.
Re: Re : Re: Double specifier?. sscanf -
J0sh... - 13.11.2015
Quote:
Originally Posted by Dutheil
Pawn isn't made for this use.
|
I know. Did you read my post?