OnPlayerText
#1

Hey guys I'm finishing with my /mask command but I have one problem, I want when masked player will speak it will write like this:

Stranger: text..

I've tried this
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Masked[playerid] == 1)
    {
        new str[128];
        format(str, sizeof(str), "Stranger says: %s", text);
        SendClientMessage(playerid, COLOR_YELLOW,str);
       
    }
    return 1;
}
It's true it says Stranger: text.. but above this msg it shows my real IG name and message, I don't want to use GetPlayerName and SetPlayerName so people will just simply press TAB and see who's name changed... how can I do so it will write only "Stranger: text"?
Reply
#2

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Masked[playerid] == 1)
    {
        new str[128];
        format(str, sizeof(str), "Stranger says: %s", text);
        SendClientMessage(playerid, COLOR_YELLOW,str);
       
    }
    /*
    else
    {
        // code for normal chat (name etc) if you want
    }
    */

    return 0; // <-- returning 0 to prevent the default chat to be shown.
}
Reply
#3

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(Masked[playerid] == 1)
    {
        new str[128];
        format(str, sizeof(str), "Stranger says: %s", text);
        SendClientMessage(playerid, COLOR_YELLOW,str);
        return 0;
    }
    return 1;
}
That will do what you want, the "return 1" in OnPlayerText sends the message, using "return 0" will just stop the code without sending the message. I hope you understand how it works now.

Best regards,
Jesse
Reply
#4

Thanks to both of you guys It's working perfect and you just helped me to finish my /mask command
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)