[Help] OnPlayerText
#1

Hello all , i want to add some code into my OnPlayerText and i added but now i want that only in case that player type any special command so that code will be followed . E.g. if player type /blue then only in that case player text message color changes to blue and appear his message in blue color. Just tell me where to put the CMD or if(strcmp) etc . i have the code of changing the text to blue.
Reply
#2

It's nearly impossible to do this.
Reply
#3

You could add as many colors as you want:

pawn Код:
new PlayerTextColor[MAX_PLAYERS];
pawn Код:
COMMAND:setcolor(playerid, params[])
{
    if(strcmp(params, "blue", true)==0) PlayerTextColor[playerid] = 0x0000FFFF;
    else if(strcmp(params, "red", true)==0) PlayerTextColor[playerid] = 0xFF0000FF;
    else if(strcmp(params, "green", true)==0) PlayerTextColor[playerid] = 0x00FF00FF;
    else if(strcmp(params, "yellow", true)==0) PlayerTextColor[playerid] = 0xFFFF00FF;
    else if(strcmp(params, "purple", true)==0) PlayerTextColor[playerid] = 0xFF00FFFF;
    else return SendClientMessage(playerid, -1, "Use: /setcolor [red/blue/green/yellow/purple]");
    SendClientMessage(playerid, PlayerTextColor[playerid], "You have changed your textcolor");
    return 1;
}
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(PlayerTextColor[playerid] != 0)
    {
        new string[128], pname[24];
        GetPlayerName(playerid, pname, 24);
        format(string, sizeof(string), "%s: %s", pname, text);
        SendClientMessageToAll(PlayerTextColor[playerid], string);
        return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)