SA-MP Forums Archive
strmid HELP PLEASE. - 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: strmid HELP PLEASE. (/showthread.php?tid=415729)



strmid HELP PLEASE. - PaulDinam - 14.02.2013

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;
}



Re: strmid HELP PLEASE. - HarrisonC - 14.02.2013

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


Re: strmid HELP PLEASE. - Vince - 14.02.2013

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.


Re: strmid HELP PLEASE. - PaulDinam - 14.02.2013

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;
}



Re: strmid HELP PLEASE. - PaulDinam - 14.02.2013

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;
}