SA-MP Forums Archive
Sscanf 2.6 problem - 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 2.6 problem (/showthread.php?tid=335193)



Sscanf 2.6 problem - Admigo - 17.04.2012

Heey all,

I have a problem with my sscanf.
I downloaded the newest sscanf 2.6.
But when i used commands like pm or other commands with playerid it detects playerid 0.
Example:When i want to send a pm to playerid 3 it sends the pm to playerid 0.

How can i fix this?

Thanks Admigo


Re: Sscanf 2.6 problem - ViniBorn - 17.04.2012

Show your command

]]


Re: Sscanf 2.6 problem - Admigo - 17.04.2012

Код:
//define top of script
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//onplayercommand
dcmd(pm,2,cmdtext);
//the command
dcmd_pm(playerid,params[])
{
	new string[128];
	new ID;
	new cmdreason[100];
	if(sscanf(params, "us[100]", ID, cmdreason))
	{
	    SendClientMessage(playerid,COLOR_RED,"USAGE: /pm (Player Name/ID) (Message)");
	    return 1;
	}
    if(!IsPlayerConnected(ID))
	{
	    format(string, sizeof(string), "The Player ID (%d) is not connected to the server.",ID);
	    SendClientMessage(playerid,COLOR_RED,string);
	    return 1;
    }
    if(playerid == ID)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot pm yourself!");
	    return 1;
    }
	format(string, sizeof(string), "[Private Message] Sent to: %s(%d): %s",PlayerName(ID),ID,cmdreason);
	SendClientMessage(playerid,COLOR_YELLOW,string);

	format(string, sizeof(string), "[Private Message] From: %s(%d) %s",PlayerName(playerid),playerid,cmdreason);
	SendClientMessage(ID,COLOR_YELLOW,string);


    PlayerPlaySound(ID,1085,0.0,0.0,0.0);
	return 1;
}
Since yesterday i got this problem.
All my dcmd commands are bugged.
How can i fix this?


Re: Sscanf 2.6 problem - ViniBorn - 17.04.2012

It's a FS ?


Re: Sscanf 2.6 problem - Admigo - 17.04.2012

Nope,its in my gamemode. I am using 0.3d R2 on a linux server.
The plugin is loaded good. Yesterday my script worked perfectly.


Re: Sscanf 2.6 problem - IstuntmanI - 17.04.2012

Move DCMD to ZCMD.


Re: Sscanf 2.6 problem - Admigo - 17.04.2012

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Move DCMD to ZCMD.
Is it hard to change them from DCMD to ZCMD because i have lots of commands.


Re: Sscanf 2.6 problem - Mark™ - 17.04.2012

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Move DCMD to ZCMD.
That won't fix the problem.


Re: Sscanf 2.6 problem - Admigo - 17.04.2012

Can a wrong Specifiers in one command bug all commands?


Re: Sscanf 2.6 problem - Jonny5 - 17.04.2012

I dont think so..
by wrong you mean one that is supported by sscanf but not correct for your input?
I think anything else would give an error.


does it work with using the name instead of the ID?