strlen 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: strlen question (
/showthread.php?tid=243445)
strlen question -
mrcoolballs - 23.03.2011
I'm just playing with random functions when I decided to use strlen to see how it works, I have come up with a test CMD that returns the amount of characters in what I type:
pawn Код:
if(strcmp(cmd,"/test", true) == 0)
{
new str[128];
new tmp[256];
tmp = strtok(cmdtext,idx);
format(str,sizeof(str),"There are %d characters in this string",strlen(tmp));
SendClientMessage(playerid,0xAA3333AA,str);
return 1;
}
for example, if I type "/test hello" it will return "There are 5 characters in this string", the problem being if I go over 19 characters it still returns that there is only 19 characters in it.
Re: strlen question -
-Rebel Son- - 23.03.2011
You must have somthing in the script that has a string of 19 characters, Or, It's thinking otherwise, Do you have any globals strings/variables?
Re: strlen question -
mrcoolballs - 23.03.2011
No, I have nothing in my script except for that one command, and strtok, which by the way I noticed in the strtok function it has:
New Result[20];
Which would be 19 cells plus the 1 null cell, I wonder if that has anything to do with it? because when I use strlen without the strtok function it can go over 19 characters.