SA-MP Forums Archive
getting the text between * * - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: getting the text between * * (/showthread.php?tid=156105)



getting the text between * * - aNdReSk - 21.06.2010

hello there, I was wondering how can I get the text between * and *

so that if i type *cries*

it displays that on a 3d label and dont spam chat!

thx


Re: getting the text between * * - mprofitt - 21.06.2010

Quote:
Originally Posted by aNdReSk
hello there, I was wondering how can I get the text between * and *

so that if i type *cries*

it displays that on a 3d label and dont spam chat!

thx
https://sampwiki.blast.hk/wiki/Strins


Re: getting the text between * * - bigcomfycouch - 21.06.2010

Код:
public OnPlayerText(playerid, text[])
{
	new string[128];
	format(string, 128, "%s", text);
	if(string[0] == '*')
	{
	  strdel(string, 0, 1);
	  strdel(string, strfind("*", string, true), strfind("*", string, true)+1);
	  //3d stuff
	}
	return 0;
}



Re: getting the text between * * - aNdReSk - 21.06.2010

awsome if u had paypal i could give u a dollar


Re: getting the text between * * - bigcomfycouch - 21.06.2010

You could also use this because the other code I posted doesn't check if the last digit is also an asterisk

Код:
if(text[0] == '*')
{
	new j = 1;
	while(j < 128)
	{
		if(text[j] == '\0' && text[j-1] == '*')
		{
			new action[128];
			format(action, 128, "%s", text);
			strdel(action, 0, 1);
			strdel(action, j-2, j-1);
			format(string, sizeof(string), "* %s %s", RPN(playerid), action);
			ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			return 0;
		}
		j++;
	}
}