SA-MP Forums Archive
Limiting number of characters in a string - 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: Limiting number of characters in a string (/showthread.php?tid=395196)



Solved - lewismichaelbbc - 25.11.2012

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


Re: Limiting number of characters in a string - Dolby - 25.11.2012

Strlen.


Re: Limiting number of characters in a string - maramizo - 25.11.2012

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



Re: Limiting number of characters in a string - lewismichaelbbc - 25.11.2012

Works, thanks