Little help. - 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: Little help. (
/showthread.php?tid=302303)
Little help. -
TheArcher - 08.12.2011
I'd like to know if is possible that a condition can be checked if the string is empty.
Re: Little help. -
[ABK]Antonio - 08.12.2011
You can download sscanf2 and use that...I have no idea without it because I only work with sscanf...
if(sscanf(params, "s", msg)) //Checks if a string has been entered
https://sampwiki.blast.hk/wiki/Fast_Commands#sscanf
Re: Little help. -
TheArcher - 08.12.2011
Indeed i want to do without sscanf. It's only a line to check it why sscanf for 1 function?
I was thinkig about
pawn Код:
new hi[] = ""; // String empty
if(!hi == '\0') // if hi isn't a NULL string? This should work?
Re: Little help. -
[ABK]Antonio - 08.12.2011
ahh here we are
https://sampwiki.blast.hk/wiki/Strtok
Re: Little help. -
Fj0rtizFredde - 08.12.2011
If you use zcmd you can use the "isnull" function.

Or else you could use strlen.
Re: Little help. -
[Diablo] - 08.12.2011
pawn Код:
if(!strlen(string[]))
{
// code to execute
}
not tested, since i always use sscanf
Re: Little help. -
[ABK]Antonio - 08.12.2011
if(strlen(hi) == 0) return 1;
EDIT: actually 0 would be 1 wouldnt it?