sscanf help, two string parameter - 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: sscanf help, two string parameter (
/showthread.php?tid=609505)
sscanf help, two string parameter -
DoomerLSRPES - 13.06.2016
I have a command which requires you to select an option and then asks you to enter a text.
/sign put [text]
This is my sscanf
if(sscanf(params, "s[32]s[128]", option, text))
option should be 'put'
text should be whatever is in [text]
But it doesn't work. Why? What specifiers should I be using?
Thanks.
Re: sscanf help, two string parameter -
Konstantinos - 13.06.2016
This can be done without the use of sscanf since it is only expecting a single parameter after which is string.
pawn Код:
if (!strcmp(params, "put", true, 3))
{
// "params[3]" in replace of "text"
}
Respuesta: sscanf help, two string parameter -
DoomerLSRPES - 13.06.2016
Doesn't work.
Re: sscanf help, two string parameter -
Stinged - 13.06.2016
Quote:
Originally Posted by Konstantinos
This can be done without the use of sscanf since it is only expecting a single parameter after which is string.
pawn Код:
if (!strcmp(params, "put", true, 3)) { // "params[3]" in replace of "text" }
|
Shouldn't it be params[4] and "put " though?
Because
I think if you use "put", this would work: /sign puttext
Re: sscanf help, two string parameter -
Konstantinos - 13.06.2016
Quote:
Originally Posted by Stinged
Shouldn't it be params[4] and "put " though?
Because I think if you use "put", this would work: /sign puttext
|
You are correct, sorry about that.
pawn Код:
if (!strcmp(params, "put ", true, 4))
{
// "params[4]" in replace of "text"
}