SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 10/09/2018, 01:31 PM   #1
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 749
Reputation: 43
Default Annoying sscanf id 0 debug

I'm facing that annoying and stupid sscanf id 0 bug.

I'm online, i'm id 0, i type a command on me, result: Player not connected.

Or happens too when someone quits and another one joins replacing his id.

I have the latest sscanf plugin/include, what i have to do to fix this problem once for all?
KinderClans is offline   Reply With Quote
Old 10/09/2018, 01:33 PM   #2
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,315
Reputation: 3191
Default Re: Annoying sscanf id 0 debug

A minimal repro would help:

https://stackoverflow.com/help/mcve

For reference, no-one else has reported a bug like that in sscanf (only of the top three plugins in SA:MP) in like 8 years… Just saying.
Y_Less is offline   Reply With Quote
Old 10/09/2018, 01:35 PM   #3
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 749
Reputation: 43
Default Re: Annoying sscanf id 0 debug

Quote:
Originally Posted by Y_Less View Post
A minimal repro would help:

https://stackoverflow.com/help/mcve
If you're asking for an example code, i'm sorry to say you that this happens to ALL commands which has "u" or "d"...
KinderClans is offline   Reply With Quote
Old 10/09/2018, 01:37 PM   #4
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,315
Reputation: 3191
Default Re: Annoying sscanf id 0 debug

Quote:
Originally Posted by KinderClans View Post
If you're asking for an example code, i'm sorry to say you that this happens to ALL commands which has "u" or "d"...
Then providing an example should be simple...
Y_Less is offline   Reply With Quote
Old 10/09/2018, 01:52 PM   #5
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 749
Reputation: 43
Default Re: Annoying sscanf id 0 debug

Here is, an example command:

pawn Code:
CMD:spawn(playerid, params[])
{
    if (Player[playerid][AccountLevel] < 1) return 0;

    new targetid;
    if (sscanf(params, "u", targetid)) return SCM(playerid, COLOR_RED, "* [USAGE]: /spawn [playerid/name]");

    if (! IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "* The specified player is not connected.");
    if (Player[playerid][AccountLevel] < Player[targetid][AccountLevel]) return SCM(playerid, COLOR_RED, "* You cannot use this command on higher level admin.");
    if (GetPlayerState(playerid) == PLAYER_STATE_SPECTATING)  TogglePlayerSpectating(targetid, false);

    SpawnPlayer(targetid);
    PlayerPlaySound(targetid, 1057, 0.0, 0.0, 0.0);
    PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);

    new buf[128];
    format(buf, sizeof(buf), "* %s %s has respawned you.", AdminLevelName(playerid),ReturnName(playerid, 0));
    SCM(targetid, COLOR_RED, buf);
    format(buf, sizeof(buf), "* You have respawned %s.", ReturnName(targetid, 0));
    SCM(playerid, COLOR_RED, buf);
    return 1;
}
KinderClans is offline   Reply With Quote
Old 10/09/2018, 04:21 PM   #6
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,315
Reputation: 3191
Default Re: Annoying sscanf id 0 debug

I can't compile that. I have no idea how `Player`, `SCM`, and more are defined. Thus, anything I do to get it to compile might hide the apparent but. This is exactly why I gave you that link.
Y_Less is offline   Reply With Quote
Old 10/09/2018, 04:39 PM   #7
NeXTGoD
Little Clucker
 
NeXTGoD's Avatar
 
Join Date: Jul 2018
Posts: 47
Reputation: 4
Default Re: Annoying sscanf id 0 debug

https://pastebin.com/WitzLdmA

Try like this
__________________
.

My SAMP Server:


.
NeXTGoD is offline   Reply With Quote
Old 10/09/2018, 04:41 PM   #8
Y_Less
Beta Tester
 
Y_Less's Avatar
 
Join Date: Jun 2008
Location: 629 - git.io/Y
Posts: 15,315
Reputation: 3191
Default Re: Annoying sscanf id 0 debug

That's the same code with the same problems...
Y_Less is offline   Reply With Quote
Old 10/09/2018, 04:41 PM   #9
GameOvr
Big Clucker
 
Join Date: Jun 2018
Posts: 122
Reputation: 0
Default Re: Annoying sscanf id 0 debug

LOL guys I got the same error before 2 3 weeks ago it's about a PM command, I pmed my self just for checking but it says that it's an invalid playerid
GameOvr is offline   Reply With Quote
Old 10/09/2018, 04:44 PM   #10
iLearner
Gangsta
 
iLearner's Avatar
 
Join Date: Apr 2017
Posts: 632
Reputation: 134
Default Re: Annoying sscanf id 0 debug

I am aware of only 1 issue with sscanf so far (no sure if its an issue actually), using the identifier "u" does not identify an NPC. so for example if userid is an NPC and i use the following code:
PHP Code:
//code above
new userid;
if(
sscanf(params"u"userid)) return 0;
if(!
IsPlayerConnected(userid)) return SendClientMessage(playerid, -1"player not connected");
//rest of code 
the output would be
Quote:
player not connected.
iLearner 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, Many debug errors WTF!!!!! PawnOX Scripting Help 2 09/06/2014 03:50 AM
SQL annoying me. iGetty Scripting Help 7 23/05/2012 01:46 PM
BIG, annoying sscanf 2.5 problem :( Twisted_Insane Scripting Help 9 02/03/2012 01:18 PM
Annoying bug.. xCrAzYx Client Support 8 23/12/2010 03:48 PM
Annoying... Mike Garber Help Archive 10 27/09/2009 01:26 PM


All times are GMT. The time now is 04:57 AM.


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