SA-MP Forums

Go Back   SA-MP Forums > SA-MP Server > Server Support

Reply
 
Thread Tools Display Modes
Old 17/06/2020, 08:45 PM   #1
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 225
Reputation: 54
Default A little help with sscanf

Hello.
I have a "problem" using multiple text string in sscanf params:

The cmd:
PHP Code:
 /sendinfo [JR_Junior] [Nick_Name] [No reason] [No details
PHP Code:
CMD:sendinfo(playerid,params[])
{
    new 
admin[25],account[25],reason[128],details[128];

    if(!
sscanf(params"s[25]s[25]s[128]s[128]",admin,account,reason,details))
    {
        
printf("%s | %s | %s | %s",admin,account,reason,details);
    }
    return 
1;

The result is:
PHP Code:
JR_Junior Nick_Name No reason No details 
Any solution?
Thank you!
__________________
"You can disrespect peoples work, but then don't be surprised when they go away." - Kalcor
JR_Junior is offline   Reply With Quote
Old 18/06/2020, 09:30 PM   #2
Shadow_
Gangsta
 
Shadow_'s Avatar
 
Join Date: Nov 2008
Location: Vatican City
Posts: 539
Reputation: 56
Default Re: A little help with sscanf

Code:
 CMD:sendinfo(playerid,params[])
{
    new admin[25],account[25],reason[128],details[128];

    if(sscanf(params, "s[25]s[25]s[128]s[128]",admin,account,reason,details)) return SendClientMessage(playerid, -1,  "/sendinfo <string> <string> <string> <string>");

    printf("%s | %s | %s | %s",admin,account,reason,details);
    return 1;
}
Worked fine for me?

Code:
 Testing | Testing | Tesing | TESTINGEVENLONGERTESTING
My discord if you want to discuss more "Shadow_#0001"

Edit: I also just tried the exact copy of your CMD and it worked fine. So maybe if you have an issues its likely with the rest of your command not this snippet you've put forward.
__________________
Shadow_ is offline   Reply With Quote
Old 18/06/2020, 10:53 PM   #3
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 225
Reputation: 54
Default Re: A little help with sscanf

Quote:
Originally Posted by Shadow_ View Post
Code:
 CMD:sendinfo(playerid,params[])
{
    new admin[25],account[25],reason[128],details[128];

    if(sscanf(params, "s[25]s[25]s[128]s[128]",admin,account,reason,details)) return SendClientMessage(playerid, -1,  "/sendinfo <string> <string> <string> <string>");

    printf("%s | %s | %s | %s",admin,account,reason,details);
    return 1;
}
Worked fine for me?

Code:
 Testing | Testing | Tesing | TESTINGEVENLONGERTESTING
My discord if you want to discuss more "Shadow_#0001"

Edit: I also just tried the exact copy of your CMD and it worked fine. So maybe if you have an issues its likely with the rest of your command not this snippet you've put forward.
Works fine only if you do not type more than 1 word in the reason, but try again this cmd:
PHP Code:
/sendinfo <Testing> <Testing> <Tesing again> <TESTINGEVENLONGERTESTING>

ResultTesting Testing Tesing again TESTINGEVENLONGERTESTING 
__________________
"You can disrespect peoples work, but then don't be surprised when they go away." - Kalcor
JR_Junior is offline   Reply With Quote
Old 19/06/2020, 02:04 PM   #4
Shadow_
Gangsta
 
Shadow_'s Avatar
 
Join Date: Nov 2008
Location: Vatican City
Posts: 539
Reputation: 56
Default Re: A little help with sscanf

I'm not sure you can use sscanf in that way. My advise would be to use dialogs.
__________________
Shadow_ is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SSCANF Warning [Help] (sscanf warning: Invalid data length.) rajabilal555 Scripting Help 1 21/06/2016 11:14 AM
[HELP]Is it possible? To Color Embed in SSCANF? Maybe SSCANF Bug/ISSUE? Guest4390857394857 Scripting Help 14 30/07/2014 04:11 AM
sscanf & zcmd help..! sscanf inside strcmp PaulDinam Scripting Help 2 26/02/2013 12:47 PM
help !! sscanf - sscanf error: System not initialised. zod23 Scripting Help 1 03/08/2012 08:54 AM
sscanf - sscanf error: System not initialised. Deal-or-die Scripting Help 4 26/06/2012 02:44 PM


All times are GMT. The time now is 08:45 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.