how to make main chat local chat?
#1

how can i make so when people type in someone in regular chat, it say like this:

Example:

John_Jim: test message

I want to say like this:

John_Jim Says: test message

i want the world "Says"
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    new gName[24], gMessage[250];
    GetPlayerName(playerid, gName, sizeof(gName));
    format(gMessage, sizeof(gMessage), "%s says: %s", gName, text);
    SendClientMessageToAll(0xFFFFFFFF, gMessage);
        return 0;
}
I guess you could try that, don't know if it will work or not.
Reply
#3

pawn Код:
public OnPlayerText(playerid, text[])
{
    new textv2[128], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof (name));
    format(textv2, sizeof (textv2), "%s Says: %s", name, text);
    SendClientMessageToAll(-1, textv2);
    return 0; // ignore the default text and send the custom one
}

edit:

ops too slow LOL

@ the post above

you got to return 0; to prevent it from sending the normal way but yes will work.
Reply
#4

You may check this thread out. It's very useful in your case.
Reply
#5

This tutorial shows you how to do everything associated with roleplay chats.
https://sampforum.blast.hk/showthread.php?tid=336052
Reply
#6

hmm why i get both? when i say "hi" it say two times when i only type once. like this:

John_Jim Says: hi
John_Jim: hi
Reply
#7

Because you may not have "Return 0;" at the end of callback "OnPlayerText".
As stated above.
pawn Код:
return 0; // ignore the default text and send the custom one
Reply
#8

ok i am edit another script. i have this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(strfind(text, "rcon", true) != -1)
    {
        return 0;
    }
    if(strfind(text, "login",true) != -1)
    {
        return 0;
    }
    new string[200]; new pname[24]; GetPlayerName(playerid, pname, 24);
    new pcol = GetPlayerColor(playerid);
    if(GetPVarInt(playerid, "Muted") == 1)
    {
        SendClientMessage(playerid, COLOR_ERROR, "You are muted. You cannot talk.");
        return 0;
    }
    if(GetPVarInt(playerid, "Spawned") == 1)
    {
        if(gTeam[playerid] == Team_Cop || gTeam[playerid] == Team_FBI)
        {
            format(string, 200, "12[CHAT] %s (%d) says: %s", pname, playerid, text);
        }
        if(gTeam[playerid] == Team_Army)
        {
            format(string, 200, "6[CHAT] %s (%d) says: %s", pname, playerid, text);
        }
        if(gTeam[playerid] == Team_Civi)
        {
            if(pcol == COLOR_RED)
            {
                format(string, 200, "4[CHAT] %s (%d) says: %s", pname, playerid, text);
            }
            if(pcol == COLOR_YELLOW)
            {
                format(string, 200, "8[CHAT] %s (%d) says: %s", pname, playerid, text);
            }
            if(pcol == COLOR_ORANGE)
            {
                format(string, 200, "7[CHAT] %s (%d) says: %s", pname, playerid, text);
            }
            if(pcol == COLOR_WHITE)
            {
                format(string, 200, "0[CHAT] %s (%d) says: %s", pname, playerid, text);
            }
        }
    }
    if(GetPVarInt(playerid, "Spawned") == 0)
    {
        format(string, sizeof(string), "[CHAT] %s (%d) says: %s", pname, playerid, text);
    }
    return 1;
}
i added the word "says" myself. how i not see that in game when i type? i dont work?
Reply
#9

change the bottom of your function to this
pawn Код:
SendClientMessageToAll(-1, string);
    return 0; // ignore the default text and send the custom one
}
Reply
#10

Why SendClientMessageToAll when he wants local chat.

To the OP, read the tutorial in my signature.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)