sscanf2 "u" modifier problem! plz help me -
sircumz - 10.01.2012
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
Re: sscanf2 "u" modifier problem! plz help me - T0pAz - 10.01.2012
It's because the playerid address has been changed on the 0.3D R2. Try using i or d.
Re: sscanf2 "u" modifier problem! plz help me -
sircumz - 10.01.2012
so i cant use "u" annymore? and only use the /giveuser 5 command?
Re: sscanf2 "u" modifier problem! plz help me - T0pAz - 10.01.2012
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?
Re: sscanf2 "u" modifier problem! plz help me -
sircumz - 10.01.2012
the problem is that is cant use /giveuser sircumz (name or id)
Re: sscanf2 "u" modifier problem! plz help me -
TheArcher - 10.01.2012
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;
}
}
Re: sscanf2 "u" modifier problem! plz help me -
mitosking - 10.01.2012
Update your sscanf. Have you got Server 0.3d or Server 0.3d R2?
Re: sscanf2 "u" modifier problem! plz help me -
[Diablo] - 10.01.2012
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 )
Re: sscanf2 "u" modifier problem! plz help me -
sircumz - 10.01.2012
i got samp 0.3d r2 version and i got the sscanf2 800p version (latest)
just wont work
Re: sscanf2 "u" modifier problem! plz help me - T0pAz - 10.01.2012
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.