AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ColorChat message limit (check max lenght) (https://forums.alliedmods.net/showthread.php?t=204131)

alonelive 12-28-2012 06:47

ColorChat message limit (check max lenght)
 
How i can check max lenght of message?

PHP Code:

ColorChat(0GREEN"%s is the best player of today's counter-strike party! He is 123456789012345678990 123 123 12 312123123123 123123123(for example)"winnername

In this example base lenght of message is 128 chars. If player has a long nickname (player's NICKNAME + BASE text of message), server may crashes? 191 chars limit..
I need a checker of max lenght this message..
Help me please :)

AngeIII 12-28-2012 11:44

Re: ColorChat message limit (check max lenght)
 
you can limit the nickname with only 32 chars. 128+32<191

fysiks 12-28-2012 21:00

Re: ColorChat message limit (check max lenght)
 
Quote:

Originally Posted by alonelive (Post 1861839)
server may crashes?

Try it and see.

alonelive 12-29-2012 00:21

Re: ColorChat message limit (check max lenght)
 
Quote:

Originally Posted by AngeIII (Post 1861939)
you can limit the nickname with only 32 chars. 128+32<191

And if i have some nicknames in this message?

The best player is Player !
or
The best player is Player, Player1, Player2, Player3 ... !
I want set a check of max lenght message.. But i don't know , how exactly i can set this.

rastafari 12-29-2012 01:59

Re: ColorChat message limit (check max lenght)
 
Use Notepad++, highlight the message and check its length.

AngeIII 12-29-2012 03:39

Re: ColorChat message limit (check max lenght)
 
check with
native strlen(const string[]);

your length current and future (for example nick).

len=strlen(msg)
if(len+strlen(nick)>191)...
else
{
len+=strlen(nick)
...
}


All times are GMT -4. The time now is 13:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.