SA-MP Forums Archive
sscanf-->what to put in if statement - 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-->what to put in if statement (/showthread.php?tid=421625)



sscanf-->what to put in if statement - HurtLocker - 10.03.2013

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.


Re: sscanf-->what to put in if statement - -CyRAX - 10.03.2013

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

It works to player NAME ant ID.


Re: sscanf-->what to put in if statement - RajatPawar - 10.03.2013

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.


Re: sscanf-->what to put in if statement - HurtLocker - 10.03.2013

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


Re: sscanf-->what to put in if statement - -CyRAX - 10.03.2013

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


Re: sscanf-->what to put in if statement - JaKe Elite - 10.03.2013

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

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


Re: sscanf-->what to put in if statement - HurtLocker - 10.03.2013

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.