Custom chat
#1

Hey, i have seen on some servers that they have like their name and id in chat.
Something like this: Karl[NDZ] [0].
If someone could tell me how to make this or give me a link to a tutorial to do it, because i dont know what it is called, then i would be really glad!
Reply
#2

Format the string with playername and ID and use SendClientMessage(ToAll) or some sort of nearby chat if you prefer that. Use this in OnPlayerText.
Reply
#3

Quote:
Originally Posted by Karl[NDZ]
Посмотреть сообщение
Hey, i have seen on some servers that they have like their name and id in chat.
Something like this: Karl[NDZ] [0].
If someone could tell me how to make this or give me a link to a tutorial to do it, because i dont know what it is called, then i would be really glad!
Replace this with your normal OnPlayerText:
Код:
public OnPlayerText(playerid, text[])
{
	new string[256], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
	format(string,sizeof(string),"%s(%d): %s",name,playerid,text);
	SendClientMessageToAll(0xFFFFFFFF,string);
	return 0;

}
Reply
#4

pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (textv2), "%s [%d]: %s", name, playerid, text);
    SendPlayerMessageToAll(playerid, textv2);
    return 0;
}
Reply
#5

Quote:
Originally Posted by Littlehelper[MDZ]
Посмотреть сообщение
pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (textv2), "%s [%d]: %s", name, playerid, text);
    SendPlayerMessageToAll(playerid, textv2);
    return 0;
}
That did't work and Roel's made so there is no color in the chat.
Reply
#6

Quote:
Originally Posted by Karl[NDZ]
Посмотреть сообщение
That did't work and Roel's made so there is no color in the chat.
You mean that the text color isn't the same as the player color?
Well for that you need a bigger script because then you have to convert the player colors to text colors.
And you have to set every players color when they login to a random color untill you can use GetPlayerColor.
Reply
#7

Quote:
Originally Posted by Roel
Посмотреть сообщение
You mean that the text color isn't the same as the player color?
Well for that you need a bigger script because then you have to convert the player colors to text colors.
And you have to set every players color when they login to a random color untill you can use GetPlayerColor.
I meant that in the normal chat everyone got their own color when they are talking and in this chat they have like only the white color.
Reply
#8

Yep thats what I said, to make this it will be alot more work.
If you want that only the name and the ID is the color from the player and the text is just white (like normal) it will take much more time then when you change the whole color of the text to the playercolor.
But you can search if there is a script somewhere at the forum, I think there is.
Reply
#9

Try this, I wrote that in the browser so let me know if you get any errors.
pawn Код:
public OnPlayerText(playerid, text[])
{
      new str[256], name[24], Float: color;
      GetPlayerName(playerid, name, sizeof(name));
      color = GetPlayerColor(playerid);
      format(string, sizeof(string), " "%f" %s~w~[%d]:%s", color, name, playerid, text);
      SendClientMessageToAll(0xFFFFFFAA, string);
      return 0;
}
Funny thing is , I don't even have OnPlayerText in my script yet my chat does this on its own, so if ^ that don't work try deleting the whole call back and see what happens when you go in game and talk
Reply
#10

Quote:
Originally Posted by new121
Посмотреть сообщение
Try this, I wrote that in the browser so let me know if you get any errors.
pawn Код:
public OnPlayerText(playerid, text[])
{
      new str[256], name[24], Float: color;
      GetPlayerName(playerid, name, sizeof(name));
      color = GetPlayerColor(playerid);
      format(string, sizeof(string), " "%f" %s~w~[%d]:%s", color, name, playerid, text);
      SendClientMessageToAll(0xFFFFFFAA, string);
      return 0;
}
Funny thing is , I don't even have OnPlayerText in my script yet my chat does this on its own, so if ^ that don't work try deleting the whole call back and see what happens when you go in game and talk
Well my compliments if this will ever work.
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)