Chat Color Help -
Loinal - 20.05.2016
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?
Re: Chat Color Help -
iKevin - 20.05.2016
Read more about it if I got you what you mean here -
https://sampwiki.blast.hk/wiki/SetPlayerColor
Re: Chat Color Help -
Loinal - 20.05.2016
not player colour its player chat color
like
name = Martex then Martex:
Test
Onther Player
hi
Re: Chat Color Help -
Loinal - 20.05.2016
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
Re: Chat Color Help -
Dayrion - 21.05.2016
Hey. I solved your problem.
Change:
PHP код:
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;
}
by :
PHP код:
public OnPlayerText(playerid, text[])
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(!strcmp(PlayerName,"Martex",true)) // You forgot "!"
{
new xText[144];
format(xText, sizeof (xText), "%s {FF0000}(Owner):{00FFE6} %s",PlayerName, text); // You can delete the first %s.
SendClientMessageToAll(-1, xText); // SendClientMessageToAll is better for this way
return 0;
}
else
{
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
SendClientMessageToAll(-1, pText);
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.
Re: Chat Color Help -
Loinal - 21.05.2016
Quote:
Originally Posted by Dayrion
Hey. I solved your problem.
Change:
PHP код:
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;
}
by :
PHP код:
public OnPlayerText(playerid, text[])
{
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
if(!strcmp(PlayerName,"Martex",true)) // You forgot "!"
{
new xText[144];
format(xText, sizeof (xText), "%s {FF0000}(Owner):{00FFE6} %s",PlayerName, text); // You can delete the first %s.
SendClientMessageToAll(-1, xText); // SendClientMessageToAll is better for this way
return 0;
}
else
{
new pText[144];
format(pText, sizeof (pText), "(%d) %s", playerid, text);
SendClientMessageToAll(-1, pText);
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 001: expected token: "-identifier-", but found "*"
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(139) : warning 204: symbol is assigned a value that is never used: "himessage"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
Re: Chat Color Help -
Dayrion - 21.05.2016
Quote:
Originally Posted by Loinal
it gived me error
:
PHP код:
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(1813) : error 001: expected token: "-identifier-", but found "*"
D:\samp folder\XtremeX-Stunting\gamemodes\XtremeX-Stunting.pwn(139) : warning 204: symbol is assigned a value that is never used: "himessage"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.
|
Show us the line where you get the error.
Re: Chat Color Help -
CraTzy - 21.05.2016
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 !
Re: Chat Color Help -
Loinal - 21.05.2016
i want text colour not the player color
Re: Chat Color Help -
CraTzy - 21.05.2016
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