SA-MP Forums Archive
sscanf - specify a string if empty - 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 - specify a string if empty (/showthread.php?tid=538457)



sscanf - specify a string if empty - Natric - 21.09.2014

Alright, recently I have been doing a certain command, I want if the player didn't type anything in the 'doorname' it gives the name None.. how to do that in sscanf.

pawn Код:
if(sscanf(params,"s[32]s[32]", type, doorname))
etc..

like if the doorname is empty set the doorname = "None";

Thanks in advance.


Re: sscanf - specify a string if empty - Pottus - 21.09.2014

Drop the if you don't need that in this case try it like this.

pawn Код:
sscanf(params,"s[32]s[32]", type, doorname);
if(isnull(type)) return SendClientMessage(playerid, -1, "You must specify a type");
if(isnull(doorname)) doorname = "none";