SA-MP Forums Archive
Computer can't count :) - 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: Computer can't count :) (/showthread.php?tid=122588)



Computer can't count :) - pascallj - 22.01.2010

Hello,

I'm making a login script but when I want to read a line from a file and compare it with stringcompare it returns false. Now I've found that if there is a line below, the characters for a new line (\r\n) are counted too. See Wiki and then strcmp. So I want to cut them of with strlen, but then they are also counted.

So if the file is this:

Код:
Pascal
125
and this is my code: (if tmpread contains the first line)

Код:
new tmpreadl = strlen(tmpread);
new tmpreads[128];
valstr(tmpreads, tmpreadl);
SendClientMessage(playerid, COLOR_PURPLE, tmpreads);
It returns 8 but if I count Pascal, it's still 6.

I hope you understand .


Greetz,
Pascal


Re: Computer can't count :) - pascallj - 23.01.2010

Kaaaa, bump. --srry --