Chat Color Help
#1

Hello Guys i need to make a chat color like

Example:

Loinal: Hi

i want to make only owner can chat with diffrent colors

Example:

Loinal: Hi

Only Owner Have Red Color in chat how?
Reply
#2

Read more about it if I got you what you mean here - https://sampwiki.blast.hk/wiki/SetPlayerColor
Reply
#3

not player colour its player chat color

like

name = Martex then Martex: Test

Onther Playerhi
Reply
#4

public OnPlayerText(playerid, text[])
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(strcmp(PlayerName,"Martex",true))
{
new xText[144];
format(xText, sizeof (xText), "Martex {FF0000}(Owner):{00FFE6} %s",text);
SendPlayerMessageToAll(playerid, xText);
}
else
{
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
SendPlayerMessageToAll(playerid, pText);
}
return 0;
}


it show in game that

Nour: Martex (Owner): test

and when join with martex

Martex: (0) Test

please help
Reply
#5

Hey. I solved your problem.
Change:
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
PlayerName[24];
    
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
    if(
strcmp(PlayerName,"Martex",true))
    {
        new 
xText[144];
        
format(xTextsizeof (xText), "Martex {FF0000}(Owner):{00FFE6} %s",text);
        
SendPlayerMessageToAll(playeridxText);
    }
    else
    {
        new 
pText[144];
        
format(pTextsizeof (pText), "(%d) %s"playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    return 
0;

by :
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
PlayerName[24];
    
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
    if(!
strcmp(PlayerName,"Martex",true)) // You forgot "!"
    
{
        new 
xText[144];
        
format(xTextsizeof (xText), "%s {FF0000}(Owner):{00FFE6} %s",PlayerNametext); // You can delete the first %s.
        
SendClientMessageToAll(-1xText); // SendClientMessageToAll is better for this way
        
return 0;
    }
    else
    {
        new 
pText[144];
        
format(pTextsizeof (pText), "(%d) %s"playeridtext);
        
SendClientMessageToAll(-1pText);
        return 
0// By the way, you can put both return 0 at the end of the function.
    
}

So I will give you some explications. Firstly, you are using "SendPlayerMessageToAll" (I didn't know this). I did some research and I found this:
« Description:
Sends a message in the name of a player to all other players on the server. The line will start with the sender's name in their color, followed by the message in white. »
That's why that wasn't working. Use SendClientMessagePlayerToAll should be easier.
Secondly; I put a "!" before strcmp because without "!", this mean: There is a difference between those 2 strings.
I know my English is bad, but I tried to explain you, your mistakes.
I hope I helped you and if you have any questions about the code, post it here.
Reply
#6

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
Hey. I solved your problem.
Change:
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
PlayerName[24];
    
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
    if(
strcmp(PlayerName,"Martex",true))
    {
        new 
xText[144];
        
format(xTextsizeof (xText), "Martex {FF0000}(Owner):{00FFE6} %s",text);
        
SendPlayerMessageToAll(playeridxText);
    }
    else
    {
        new 
pText[144];
        
format(pTextsizeof (pText), "(%d) %s"playeridtext);
        
SendPlayerMessageToAll(playeridpText);
    }
    return 
0;

by :
PHP код:
public OnPlayerText(playeridtext[])
{
    new 
PlayerName[24];
    
GetPlayerName(playeridPlayerNamesizeof(PlayerName));
    if(!
strcmp(PlayerName,"Martex",true)) // You forgot "!"
    
{
        new 
xText[144];
        
format(xTextsizeof (xText), "%s {FF0000}(Owner):{00FFE6} %s",PlayerNametext); // You can delete the first %s.
        
SendClientMessageToAll(-1xText); // SendClientMessageToAll is better for this way
        
return 0;
    }
    else
    {
        new 
pText[144];
        
format(pTextsizeof (pText), "(%d) %s"playeridtext);
        
SendClientMessageToAll(-1pText);
        return 
0// By the way, you can put both return 0 at the end of the function.
    
}

So I will give you some explications. Firstly, you are using "SendPlayerMessageToAll" (I didn't know this). I did some research and I found this:
« Description:
Sends a message in the name of a player to all other players on the server. The line will start with the sender's name in their color, followed by the message in white. »
That's why that wasn't working. Use SendClientMessagePlayerToAll should be easier.
Secondly; I put a "!" before strcmp because without "!", this mean: There is a difference between those 2 strings.
I know my English is bad, but I tried to explain you, your mistakes.
I hope I helped you and if you have any questions about the code, post it here.
it gived me error

:

PHP код:
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(1813) : error 001expected token"-identifier-"but found "*"
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(139) : warning 204symbol is assigned a value that is never used"himessage"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Reply
#7

Quote:
Originally Posted by Loinal
Посмотреть сообщение
it gived me error

:

PHP код:
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(1813) : error 001expected token"-identifier-"but found "*"
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(139) : warning 204symbol is assigned a value that is never used"himessage"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
1 Error

Show us the line where you get the error.
Reply
#8

u got admin ranks right ?
check if is admin (Owner) level
and change the color
OnPlayerText
hope it helps
sometimes the smallest Coding and the useless one are cool and usefull !
Reply
#9

i want text colour not the player color
Reply
#10

OnPlayerText Set fuckin chat color omfg how dumbass you are omfg omfg muum help me i need to deal with idiots today
OnPlayerText check if owner
set chat color To color you want
its not that hard
there are many fucking tuts about chat color change
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)