OnPlayerText (RCON ADMIN) -
Mohaowmad - 02.03.2019
Hello
this is my code
Код:
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF0000}[Admin] ";
GetPlayerName(playerid, pName, 24);
format(String, sizeof(String), "%s%s %s", Prefix, pName, text);
SendClientMessageToAll(-1,String);
return 1;
}
return 1;
}
my problem is when i chat with rcon admin all of my chat color will be red altough my teams are Yellow/Blue/Green
like
http://s9.picofile.com/file/8353847126/Untitled.png
i want that Admin Prefix be RED and my name become my colors of my teams
Thanks
Re: OnPlayerText (RCON ADMIN) -
polygxn - 02.03.2019
Just put your team color behind the [Admin] prefix inside the variable.
Re: OnPlayerText (RCON ADMIN) -
Mohaowmad - 02.03.2019
Sorry i Don't Understand :/
Re: OnPlayerText (RCON ADMIN) -
v1k1nG - 02.03.2019
PHP код:
new TeamColor[9];
format(TeamColor, sizeof TeamColor, "{ff0000}"); // Team color here, I put RED just for example
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF0000}[Admin] ";
GetPlayerName(playerid, pName, 24);
format(String, sizeof(String), "%s%s%s %s", Prefix, pName, TeamColor, text);
SendClientMessageToAll(-1,String);
return 1;
}
return 1;
}
Define a global variable, in this case TeamColor, use it to save team colors for cases like this.
Re: OnPlayerText (RCON ADMIN) -
Mohaowmad - 02.03.2019
Thanks m8
i did that
Код HTML:
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
if(gTeam[playerid] == TEAM_1)
{
new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF0000}[Admin] ";
GetPlayerName(playerid, pName, 24);
format(String, sizeof(String), "{FFFF00}%s%s{000000}%s %s", Prefix, TeamColor, pName, text);
SendClientMessageToAll(-1,String);
return 0;
}
if(gTeam[playerid] == TEAM_2)
{
new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF0000}[Admin] ";
GetPlayerName(playerid, pName, 24);
format(String, sizeof(String), "{00FF00}%s%s{000000}%s %s", Prefix, TeamColor, pName, text);
SendClientMessageToAll(-1,String);
return 0;
}
}
return 1;
}
is it right ?
Team 1 and Team 2 has Different Colors
Re: OnPlayerText (RCON ADMIN) -
v1k1nG - 02.03.2019
Some editings, you don't need the team check
PHP код:
new TeamColor[MAX_TEAMS][9]; // Do you have MAX_TEAMS defined?
public OnGameModeInit(){
format(TeamColor[TEAM_1],9, "{ff0000}"); // color 1
format(TeamColor[TEAM_2],9, "{ff0000}"); // color 2
return 1;
}
public OnPlayerText(playerid, text[])
{
if(IsPlayerAdmin(playerid))
{
new pName[MAX_PLAYER_NAME], String[128], Prefix[] = "{FF0000}[Admin] ";
GetPlayerName(playerid, pName, 24);
format(String, sizeof(String), "%s%s%s %s", Prefix, pName, TeamColor[gTeam[playerid]], text);
SendClientMessageToAll(-1,String);
return 1;
}
return 1;
}
Re: OnPlayerText (RCON ADMIN) -
PPC23 - 02.03.2019
If the team color is the same as player's color you can take a look at this:
https://sampwiki.blast.hk/wiki/Color_li...GetPlayerColor
Your code should look like:
Код:
format(String, sizeof(String), "%s{%06x}%s {FFFFFF}%s", Prefix, GetPlayerColor(playerid) >>> 8, pName, text);
Re: OnPlayerText (RCON ADMIN) -
Mohaowmad - 02.03.2019
Tnx man
That Worked Perfectly!