SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Plugin Development

Reply
 
Thread Tools Display Modes
Old 11/09/2010, 05:15 AM   #301
nemesis-
Huge Clucker
 
Join Date: Sep 2009
Location: USA
Posts: 237
Reputation: 37
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

Quote:
Originally Posted by Y_Less View Post
I have had a bug reported to me, I'm not going to go in to details until I have released an updated package with precompiled binaries, but an updated specifiers.cpp file has been released to address the issue:

http://y-less.pastebin.ca/1882618
Y_Less,

Was this code fix integrated with the sscanf.zip available for download in the first post of this thread? I did a diff against this and the specifiers.cpp that comes with it and it appears not.. though I've see you've made modifications to the main post.. so.. I'm lost. Which is correct?
nemesis- is offline   Reply With Quote
Old 11/09/2010, 10:16 AM   #302
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,205
Reputation: 759
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

Could I use SSCANF to find an IP in some text? I was thinking something like this:

sscanf(string, "d'.'d'.'d'.'d':'d")

would that work? and if not could someone give me something that will :P
[HLF]Southclaw is offline   Reply With Quote
Old 11/09/2010, 05:36 PM   #303
nemesis-
Huge Clucker
 
Join Date: Sep 2009
Location: USA
Posts: 237
Reputation: 37
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

Quote:
Originally Posted by [HLF]Southclaw View Post
Could I use SSCANF to find an IP in some text? I was thinking something like this:

sscanf(string, "d'.'d'.'d'.'d':'d")

would that work? and if not could someone give me something that will :P
Yes you can use sscanf to detect IP information in text. No, your example will not work.
nemesis- is offline   Reply With Quote
Old 11/09/2010, 06:07 PM   #304
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629
Posts: 16,145
Reputation: 2288
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

"p<.>dddd"

That should do it.
__________________
Y_Less is offline   Reply With Quote
Old 11/09/2010, 06:34 PM   #305
Luka P.
High-roller
 
Luka P.'s Avatar
 
Join Date: Feb 2009
Posts: 1,621
Reputation: 11
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

what does p represent?
Luka P. is offline   Reply With Quote
Old 11/09/2010, 06:39 PM   #306
[03]Garsino
Guest
 
Posts: n/a
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

delimiter
  Reply With Quote
Old 11/09/2010, 06:42 PM   #307
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629
Posts: 16,145
Reputation: 2288
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

I had some clever way in which "p" meant delimiter - "p"adding, or "p"artition or something, but I can't remember what it was.

Anyway, I've confirmed that the code in the first post is not the latest version, however I believe the binaries are.

Edit: I've now got my Linux box nicely up and running and I've added sscanf to SVN there. I'm still working on getting a post-commit build running (hopefully cross-compile for Linux/Windows) but I know it does build for Linux. If anyone would like SVN access just say.

Also, did other Linux users use a custom build file for this? I had to add "-fPIC" to the compile flags to get it to work, am I missing something or was the build script missing something?
__________________

Last edited by Y_Less; 11/09/2010 at 07:41 PM.
Y_Less is offline   Reply With Quote
Old 12/09/2010, 12:50 AM   #308
nemesis-
Huge Clucker
 
Join Date: Sep 2009
Location: USA
Posts: 237
Reputation: 37
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

Quote:
Originally Posted by Y_Less View Post
Also, did other Linux users use a custom build file for this? I had to add "-fPIC" to the compile flags to get it to work, am I missing something or was the build script missing something?
Are you running a 32 or 64bit version of linux?
nemesis- is offline   Reply With Quote
Old 12/09/2010, 03:25 AM   #309
Rachael
Huge Clucker
 
Rachael's Avatar
 
Join Date: Feb 2010
Posts: 390
Reputation: 26
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

I'm testing this, but I thought I would ask anyway. I'm trying to have an optional specifier return 'playerid'.
pawn Code:
CMD:something(playerid,params[])
{
     new target;
     sscanf(params,"U(playerid)",target);
     {
         ...
     }
     return 1;
}

I have not put the sscanf command in an 'if' statement because it doesn't seem nescessary.
I have a simple workaround for this if it is incorrect, but I like the idea of saving a line or two of code.
Rachael is offline   Reply With Quote
Old 12/09/2010, 04:30 AM   #310
mmrk
Big Clucker
 
Join Date: Nov 2008
Location: Estonia
Posts: 133
Reputation: 0
Default Re: [REL] sscanf 2.0 - Updated 04/05/10

This should work
pawn Code:
CMD:something(playerid, params[])
{
    new otherId;
    if(sscanf(params, "ui", otherId)) return SendClientMessage(playerid, COLOR, "/something[playerid]");
    SendClientMessage(otherId, COLOR, "Message to otherid");
    return 1;
}
mmrk 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
Macros (?) for enums/arrays MP2 Scripting Help 16 17/01/2012 08:37 PM
Enums - string arrays SuperViper Scripting Help 3 31/10/2011 11:00 AM
Arrays and enums... [MWR]Blood Scripting Help 9 23/09/2011 11:29 AM
Enums and Arrays Th3Angel Help Archive 6 15/02/2011 12:46 AM


All times are GMT. The time now is 09:07 AM.


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