SA-MP Forums Archive
strlen problem - 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: strlen problem (/showthread.php?tid=664607)



strlen problem - bosmania - 05.03.2019

if(strlen(inputtext) > 4 && strlen(inputtext) < 1)
{
SendClientMessage(playerid, COLOR_GREY, "Tag allowed lenght 1-4 charachters");
ShowPlayerDialog(playerid, DIALOG_CLANTAG, DIALOG_STYLE_INPUT, "Clan tag:", "Choose you clan tag:", "Choose" , "Cancel");
return 1;
}
this is the lenght restriction when im creating the clan tag,i can still enter a tag over 4 charachters or under 1,wich is nothing,i can basicly just press enter and the tag will be set to a blank space and it still works,it's like strlen is ignored by the script


Re: strlen problem - NaS - 05.03.2019

You're checking if the length is longer than 4 AND shorter than 1 character. It can't be both!

You need to check if it's longer than 4 OR shorter than 1.


Re: strlen problem - bosmania - 05.03.2019

Quote:
Originally Posted by NaS
Посмотреть сообщение
You're checking if the length is longer than 4 AND shorter than 1 character. It can't be both!

You need to check if it's longer than 4 OR shorter than 1.
sily me,it works now thx