strmid HELP PLEASE.
#1

I made this but this doesn't work good...
when I enter more than 128 it's just shows nothing

Код:
CMD:me(playerid, params[])
{
	new string[256],action[256], act[256], act2[256];
	if(sscanf(params, "s[256]", action)) return SyntaxMSG(playerid, "/me [action]");
	
	if(strval(action) > 128)
	{
		strmid(act, action, 0, 128);
		strmid(act2, action, 128, 256);
		format(string, sizeof(string), "* %s %s...", GetNameWithMask(playerid), act);
		ProxDetector(30, playerid, string, COLOR_PURPLE);
		format(string, sizeof(string), "...%s", act2);
		ProxDetector(30, playerid, string, COLOR_PURPLE);
	}
	else
	{
		format(string, sizeof(string), "* %s %s", GetNameWithMask(playerid), action);
		ProxDetector(30, playerid, string, COLOR_PURPLE);
	}
	return 1;
}
Reply
#2

I would do from 0 to 128 and then 129 to 257 and increase the sizes.
Reply
#3

strlen

Though chat I/O is limited to 128 characters, so this command is useless anyway. A player can NEVER enter more than 128 characters in the chatbox.
Reply
#4

Okay, can I make like a function instead of adding the whole code all the time?

Код:
CMD:low(playerid,params[])
{
	new string[256], action[128], act[128], act2[128];
	if(sscanf(params,"s[256]",action)) return SyntaxMSG(playerid, "/low [low chat]");
	if(strlen(action) > 90)
	{
		strmid(act, action, 0, 90);
		strmid(act2, action, 90, 128);
		format(string,sizeof(string), "%s says [low]: %s...", GetNameWithMask(playerid), act);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		format(string, sizeof(string), "...%s", act2);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
	else
	{
		format(string,sizeof(string), "%s says [low]: %s", GetNameWithMask(playerid), action);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
	return 1;
}
Reply
#5

Help plox
Okay, can I make like a function instead of adding the whole code all the time?

Код:
CMD:low(playerid,params[])
{
	new string[256], action[128], act[128], act2[128];
	if(sscanf(params,"s[256]",action)) return SyntaxMSG(playerid, "/low [low chat]");
	if(strlen(action) > 90)
	{
		strmid(act, action, 0, 90);
		strmid(act2, action, 90, 128);
		format(string,sizeof(string), "%s says [low]: %s...", GetNameWithMask(playerid), act);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
		format(string, sizeof(string), "...%s", act2);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
	else
	{
		format(string,sizeof(string), "%s says [low]: %s", GetNameWithMask(playerid), action);
		ProxDetectorV(3.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
	}
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)