sscanf-->what to put in if statement
#1

If someone could show me a guide on what to put there in various sscanf commands' cases I would really appreciate it.

Код:
if(sscanf(params, "HERE", id)) return SendClientMessage(playerid,0xFF0000AA,"Correct Usage:/goto [ID]");
I know that for id we use d.
Reply
#2

if(sscanf(params, "u", id)) return SendClientMessage(playerid,0xFF0000AA,"Correct Usage:/goto [ID]");

It works to player NAME ant ID.
Reply
#3

http://ysi.wikia.com/wiki/Pluginscanf
You use it like:
pawn Код:
new my_integer,
      my_string[128]
;
if(sscanf(params, "us[128]", my_integer, my_string)) return USAGE;
That will check if you have a playerID/Name after your command and a string after that.
You can use the same things in CAPITAL to make it optional.
Like:
pawn Код:
if(sscanf(params, "uU", my_integer, my_integer2)) return USAGE;
Will make the my_integer2 parameter optional.
Reply
#4

cyrax, you are wrong about this, if you put "u" for id doesn't work. Rajat, thanks for the guide!
Reply
#5

I did not realize what I had in mind. But who cares about that now.
Reply
#6

Actually, Hurtlocker you're wrong, Cyrax is right.

u - playername/playerid.
Read the sscanf topic next time..
Reply
#7

Quote:
Originally Posted by Romel
Посмотреть сообщение
Actually, Hurtlocker you're wrong, Cyrax is right.

u - playername/playerid.
Read the sscanf topic next time..
Romel, you think I replied without testing? If I put "u" instead of "d" for id, I get error. More specifically, in the command's script /goto for example, if I put "u" i keep getting message "player is not connected" even if I put a valid id.

EDIT: Damn, I just noticed that in ******'s sscanf page https://sampforum.blast.hk/showthread.php?tid=120356 there is a simple guide about specifiers, exactly what I started this topic for.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)