SA-MP Forums Archive
a little question - 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: a little question (/showthread.php?tid=470002)



[SOLVED] string/variable lenght - flrp - 15.10.2013

heya , i have a question lets say i have variable lol

example

new lol;

lol = "alalalalala";


i want to get the number of characters inside the variable
in this case the output would be 11. Please help me.

I need to check when a user does /changename if the name he types is less then 20 characters of lenght.

thanks.


Re: a little question - Classical - 15.10.2013

len(x)?


Re: a little question - DanishHaq - 15.10.2013

Use this:

pawn Код:
if(strlen(nameofvariable) < 1 || strlen(nameofvariable) > 24) return SendClientMessage(playerid, color, "Type your message to send here if he put less than 1 character or more than 24, which is the max_player_name");
It'll check if the length of the string, i.e. stringlength is between 1 and 24, if not, then it will return that message.


Re: a little question - flrp - 15.10.2013

dude thanks. <3