getting the text between * *
#1

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
Reply
#2

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
Reply
#3

Код:
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;
}
Reply
#4

awsome if u had paypal i could give u a dollar
Reply
#5

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


Forum Jump:


Users browsing this thread: 2 Guest(s)