sscanf2 "u" modifier problem! plz help me
#1

Hello all,

I am using sscanf 2 and zcmd lib.

My problem is when im using the "u" modifier it gives me a high numeric int instead of a proper id.

Example:

Код:
COMMAND:giveuser(playerid, params[])
{
	new id;

    if (!sscanf(params, "u", id))
    {
        new string[128];
        format(string, 128, "%d", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, 128, "%s", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
	}
	else
	{
       SendClientMessage(playerid, COLOR_WHITE, "USAGE: /giveuser [id]");
	}

	return 0;
}
when i send the command /giveuser 5 it returns 185 and the same when i send the command /giveuser sircumz.

it should return always id 5 because in my test server i am id 5 (i got 5 bots).

whats wrong! plz help me
Reply
#2

It's because the playerid address has been changed on the 0.3D R2. Try using i or d.
Reply
#3

so i cant use "u" annymore? and only use the /giveuser 5 command?
Reply
#4

Quote:
Originally Posted by sircumz
Посмотреть сообщение
so i cant use "u" annymore? and only use the /giveuser 5 command?
What did you mean? What is the problem using i or d specifier?
Reply
#5

the problem is that is cant use /giveuser sircumz (name or id)
Reply
#6

This should work.

pawn Код:
COMMAND:giveuser(playerid, params[])
{
    new id;

    if (!sscanf(params, "u", id))  SendClientMessage(playerid, COLOR_WHITE, "USAGE: /giveuser [id]");
    else
    {
        new string[128];
        format(string, 128, "%d", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, 128, "%s", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
    }
}
Reply
#7

Update your sscanf. Have you got Server 0.3d or Server 0.3d R2?
Reply
#8

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
This should work.

pawn Код:
COMMAND:giveuser(playerid, params[])
{
    new id;

    if (!sscanf(params, "u", id))  SendClientMessage(playerid, COLOR_WHITE, "USAGE: /giveuser [id]");
    else
    {
        new string[128];
        format(string, 128, "%d", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        format(string, 128, "%s", id);
        SendClientMessage(playerid, COLOR_WHITE, string);
        return 1;
    }
}
this would return the "usage: /giveuser [id]" for the correct syntax.

ot:
if you're using samp 0.3d r2, update your sscanf plugin ( http://www.mediafire.com/?bfp2h0d4231jjdr )
Reply
#9

i got samp 0.3d r2 version and i got the sscanf2 800p version (latest)

just wont work
Reply
#10

Quote:
Originally Posted by sircumz
Посмотреть сообщение
i got samp 0.3d r2 version and i got the sscanf2 800p version (latest)

just wont work
It won't, until SA-MP SDK has been updated.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)