Limiting number of characters in a string
#1

Hi guys, I would like to limit the amount of characters in a string to 39. This is what I have so far:

Код:
COMMAND:helpme(playerid, params[])
{
	format(string, sizeof(string), "%s-%s",sendername,params);
	RefreshHelpMeChatBox();
	return 1;
}
I need it to send a message to the user if they have used more than 39 characters in the string... how can I do this?

Thanks
Reply
#2

Strlen.
Reply
#3

pawn Код:
COMMAND:helpme(playerid, params[])
{
    format(string, sizeof(string), "%s-%s",sendername,params);
    if(strlen(params) > 39)
    {
        //Your code here
    }
    RefreshHelpMeChatBox();
    return 1;
}
Reply
#4

Works, thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)