Double line in chat
#1

hi all,i've a problem:

I've this OnPlayerText to show the ID of the players in chat and many other things:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new idtext[128];
    format(idtext, sizeof(idtext), "(ID: %d): %s", playerid, text);
    SendPlayerMessageToAll(playerid, idtext);
    new name[MAX_PLAYER_NAME],ircMsg[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(ircMsg, sizeof(ircMsg), "04[ID: %d] 07%s: %s", playerid, name, text);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, ircMsg);
    new TCount, KMessage[128];
    TCount = GetPVarInt(playerid, "TextSpamCount");
    TCount++;
    SetPVarInt(playerid, "TextSpamCount", TCount);
    if(TCount == 3) {
        SendClientMessage(playerid, 0xFFFFFF, "STFU! Stop flooding.");
    }
    else if(TCount == 4) {
        GetPlayerName(playerid, KMessage, sizeof(KMessage));
        format(KMessage, sizeof(KMessage), "[Anti-Spam]: %s has been kicked for chat spamming.", KMessage);
        SendClientMessageToAll(COLOR_RED, KMessage);
        new str[100];
        format(str,sizeof str,"0,10%s.",KMessage);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
        print(KMessage);
        Kick(playerid);
    }

    SetTimerEx("ResetCount", SpamLimit, false, "i", playerid);
    if(text[0] == ';')
   {
     new string[128];
     GetPlayerName(playerid, name, 30);
     format(string, sizeof(string), "Team Chat: %s [ID: %d]: %s", name, playerid, text[1]);
     for(new i = 0; i < MAX_PLAYERS; i++)
     {
        if(GetPlayerTeam(playerid) == GetPlayerTeam(i))
        {
           SendClientMessage(i,COLOR_YELLOW,string);
           new str[136];
           format(str,sizeof str,"0,3Team Chat: %s [ID: %d]: %s", name, playerid, text[1]);
           IRC_GroupSay(gGroupID, IRC_CHANNEL, str);
           return 0;
        }

     }
     return 0;
   }
    return 1;
}
But im getting,ingame chat:

test ID 0: message
test : message

Why double?

I wanna show only the

test ID 0: message.

Thanks and Merry christmas!
Reply
#2

You have to make the last "return 1" into "return 0" to block their original text.
Reply
#3

Thanks,it's worked.
Reply
#4

Glad it helped And merry christmas to you too
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)