strlen not working
#2

Issue:

Look at this line, you have the string size for 'text' set to the size of 10, yet in your sscanf function your telling it the string can fit the size of 50 in it?

Код:
if(sscanf(params, "s[50]", text)) return SCM(playerid, COLOR_WHITE, "SYNTAX: /vipname [name]"); // "s[50]" should be "s[10]"
There also no need to create a variable to hold the value of strlen, when you only use it once.

Also: Why are you checking if the strlen is more then 10 after everything else? Move it to after you call your sscanf function. However you don't even need to do that, since sscanf will cut off the text after 10.

Код:
if( strlen( text ) > 10 ) return SCM( playerid, COLOR_WHITE, "{FFB870}Maximum allowed characters are 10." ); // if you must use it
Reply


Messages In This Thread
strlen not working - by YouHack - 16.01.2017, 19:45
Re: strlen not working - by azzerking - 16.01.2017, 19:53
Re: strlen not working - by saffierr - 16.01.2017, 23:02
Re: strlen not working - by YouHack - 17.01.2017, 13:23
Re: strlen not working - by MiiSha - 18.01.2017, 02:20
Re: strlen not working - by azzerking - 19.01.2017, 21:20
Re: strlen not working - by Rufio - 19.01.2017, 23:15

Forum Jump:


Users browsing this thread: 2 Guest(s)