SA-MP Forums Archive
OnPlayerText + GetPlayerColor - 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 + GetPlayerColor (/showthread.php?tid=482926)



OnPlayerText + GetPlayerColor - Kyance - 23.12.2013

Basically, I've tried following this:
https://sampforum.blast.hk/showthread.php?tid=333430
But the name always shows black for me.
I currently use this one, since theirs was buggy for me D:

pawn Код:
public OnPlayerText(playerid, text[])
{
        new name[MAX_PLAYER_NAME];
    new string[128];
    GetPlayerName(playerid, name, sizeof(name));
        //other scripts here
        if(!PlayerInfo[playerid][pMuted])
    {
        format(string, sizeof(string), "[%d]%s: {FFFFFF}%s", playerid, name, text);
        SendClientMessageToAll(-1,string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "[MUTE] - You can't talk while you're muted!");
        return 0;
    }
    return 0; // Return 0 at the end as well to prevent the default chat from being sent
}
Any way to create it, so it shows the players color, instead of the -1(White), or the bugged one(black)?


Re: OnPlayerText + GetPlayerColor - xVIP3Rx - 23.12.2013

Try this, also note that GetPlayerColor only works properly if SetPlayerColor has been used beforehand. (wiki)
pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name));
    new string[128];
    //other scripts here
    if(!PlayerInfo[playerid][pMuted])
    {
        format(string, sizeof(string), "[%d]{%h}%s: {FFFFFF}%s", playerid, GetPlayerColor(playerid) >>> 8, name, text);
        SendClientMessageToAll(-1,string);
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "[MUTE] - You can't talk while you're muted!");
        return 0;
    }
    return 0; // Return 0 at the end as well to prevent the default chat from being sent
}
source


Re: OnPlayerText + GetPlayerColor - newbienoob - 23.12.2013

"GetPlayerColor will return nothing unless SetPlayerColor has been used!"
https://sampwiki.blast.hk/wiki/GetPlayerColor