SA-MP Forums Archive
OnPlayerText - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: OnPlayerText (/showthread.php?tid=585891)



OnPlayerText - Aleksabre - 17.08.2015

Код:
public OnPlayerText(playerid, text[])
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(0xFFFFFFFF, chat);
    return 0;
}
So, as a cop, I'm having a blue color(SetPlayerColor) and I added this so I wanted to make if you have the blue colour, your text should also be the blue.
And now, after I've added this, my color is white on mainchat no matter that I have blue color(SetPlayerColor) and it shows the greenish text.

Could you help me how to make so if I have the blue colour as a cop, and when I chat on the main chat, I actually get blue colour instead of white.

The script I've scripted is wrong. Thank you.


Re: OnPlayerText - ChromeAmazing - 17.08.2015

What'd you probably have to do is check whether or not the player is a cop, and if so he'll talk using his the color in SetPlayerColor.


Re: OnPlayerText - Roberto80 - 17.08.2015

Use this
Код:
public OnPlayerText(playerid, text[])
{
if(GetPlayerTeam(playerid) == cop) //edit this!!!
{
    new chat[200], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));
    format(chat, sizeof(chat), "%s (%d): {009900}%s", name, playerid, text);
    SendClientMessageToAll(GetPlayerColor(playerid), chat);
    return 0;
}
}



Re: OnPlayerText - Aleksabre - 17.08.2015

ah so with the teams, alright, thank you