Add < text > in chat
#1

Hi, I am leaving you today with a question regarding the intrusion into the chat. I know that a lot of people have already done and I'm thinking how to do it.

An example of honey for cyanating messages:

Auri: Hi,Forum SAMP, how are you?

After connecting to the screen < surprised > to show us in progress, which will just look.

Auri: Hi,Forum SAMP, < surprised > how are you?

Can anyone help me with this?
Reply
#2

Quote:
Originally Posted by Auri
Посмотреть сообщение
Hi, I am leaving you today with a question regarding the intrusion into the chat. I know that a lot of people have already done and I'm thinking how to do it.

An example of honey for cyanating messages:

Auri: Hi,Forum SAMP, how are you?

After connecting to the screen < surprised > to show us in progress, which will just look.

Auri: Hi,Forum SAMP, < surprised > how are you?

Can anyone help me with this?
I don't think i fully understand your issue because of your broken English but what i know is that you are trying to insert something into a message and this is how to do so:

PHP код:

    
new name[MAX_PLAYER_NAME], string[228];// define the needed variables
  
    
GetPlayerName(playeridnamesizeof(name));// Getting the players name
  
    
format(stringsizeof(string), "Hi, FORUM SAMP,  %s how are you today"name);// Inserting the players name into the message
   
//%s is used to input strings, so the player name is a string and it would be inputted there. 
    
SendClientMessage(playerid,0xFFFF00FFstring); // Sending the message to the player with his/her name inserted in it 
Reply
#3

Use this Strreplace function - https://sampforum.blast.hk/showthread.php?tid=396978

to replace opening angular bracket with "\"NEW_COLOR_NAME\"<" and closing bracket with ">\"OLD_COLOR_NAME\"".

for example,
Код:
new str[20] = "Hi <smiles> Sir."
strreplace(str, "<", "{FF0000}<");
strreplace(str, ">", ">{FFFF00}");

SendClientMessage(playerid, 0xFFFF00FF, str); //This Will output,
Hi <smiles> Sir.
Reply
#4

I need to add command to chat example

if i used open "<" and close ">" in chate

Auri: Hi, my name is Auri < smile >.

but may be other example

Auri: Hi, < smile > my name is Auri.

You can call it BBCODE in chat.
Reply
#5

If you want the brackets to appear as same color as other text and only the emote inside the brackets to be different color, then just adjust the position of color inside strreplace.
Reply
#6

Quote:
Originally Posted by GTLS
Посмотреть сообщение
If you want the brackets to appear as same color as other text and only the emote inside the brackets to be different color, then just adjust the position of color inside strreplace.
I use this code and i have a problem.

Код:
text[0] = toupper(text[0]);	
	new str[170];
	strreplace (text, "<", "{FF0000} <");
	strreplace (text, ">", ">");
	
	if(CharacterInfo[playerid][pAdminDuty])
	{
		new name[64];

		switch(CharacterInfo[playerid][pAdmin])
		{
			case 1:
				format(name, sizeof(name), "{E6E6E6}%s ({FF9900}Support{E6E6E6})", CharacterInfo[playerid][pGlobalNick]);
			case 2,3,4:
				format(name, sizeof(name), "{E6E6E6}%s ({8B00B0}GameMaster{E6E6E6})", CharacterInfo[playerid][pGlobalNick]);
			case 5,6:
				format(name, sizeof(name), "{E6E6E6}%s ({B00000}Administrator{E6E6E6})", CharacterInfo[playerid][pGlobalNick]);
		}

		format(str, sizeof(str), "%s: %s", name, text);
		SendWrappedMessageToPlayerRange(playerid, COLOR_FADE1, COLOR_FADE1, COLOR_FADE1, COLOR_FADE1, COLOR_FADE1, str, 10);
	}
	else
	{
		
		if(!(CharacterInfo[playerid][pTog] & TOG_SAY))
			ApplyAnimation(playerid, "PED", "IDLE_chat", 1.0, 0, 0, 0, 0, 0);
		

		format(str, sizeof(str), "%s say: %s", PlayerName2(playerid), text);
		SetPlayerChatBubble(playerid, text, 0xDADADAFF, 10.0, 4000);
		SendWrappedMessageToPlayerRange(playerid, COLOR_FADE1, COLOR_FADE2, COLOR_FADE3, COLOR_FADE4, COLOR_FADE5, str, 10);
	}
Warning:
Код:
roleplay.pwn(952) : warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
roleplay.pwn(953) : warning 224: indeterminate array size in "sizeof" expression (symbol "maxlength")
Reply
#7

What lines are they and do code work in game? They are just warning you will still be able to run the code to test it.
Reply
#8

I check this and not work



Line 952 and 953:

Код:
strreplace (text, "<", "{FF0000} <");
strreplace (text, ">", ">");
Reply
#9

Test it once without all that admin stuff. Check if adding text manually works or not.like Hi <smile> sir. If that works, there is some other problem in your admin code. We will look at that later.
Reply
#10

I tested without all that function, on a clear script. And again its not work.

Screen:

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)